summaryrefslogtreecommitdiff
path: root/platform/linuxbsd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /platform/linuxbsd
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/context_gl_x11.cpp9
-rw-r--r--platform/linuxbsd/context_gl_x11.h1
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.h1
-rw-r--r--platform/linuxbsd/display_server_x11.cpp121
-rw-r--r--platform/linuxbsd/export/export.cpp3
-rw-r--r--platform/linuxbsd/godot_linuxbsd.cpp1
-rw-r--r--platform/linuxbsd/joypad_linux.cpp30
-rw-r--r--platform/linuxbsd/key_mapping_x11.cpp12
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp25
-rw-r--r--platform/linuxbsd/os_linuxbsd.h1
-rw-r--r--platform/linuxbsd/vulkan_context_x11.cpp1
-rw-r--r--platform/linuxbsd/vulkan_context_x11.h1
12 files changed, 0 insertions, 206 deletions
diff --git a/platform/linuxbsd/context_gl_x11.cpp b/platform/linuxbsd/context_gl_x11.cpp
index 308d68521a..c9b95b41a3 100644
--- a/platform/linuxbsd/context_gl_x11.cpp
+++ b/platform/linuxbsd/context_gl_x11.cpp
@@ -46,22 +46,18 @@
typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
struct ContextGL_X11_Private {
-
::GLXContext glx_context;
};
void ContextGL_X11::release_current() {
-
glXMakeCurrent(x11_display, None, nullptr);
}
void ContextGL_X11::make_current() {
-
glXMakeCurrent(x11_display, x11_window, p->glx_context);
}
void ContextGL_X11::swap_buffers() {
-
glXSwapBuffers(x11_display, x11_window);
}
@@ -85,7 +81,6 @@ static void set_class_hint(Display *p_display, Window p_window) {
}
Error ContextGL_X11::initialize() {
-
//const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte *)"glXCreateContextAttribsARB");
@@ -167,7 +162,6 @@ Error ContextGL_X11::initialize() {
switch (context_type) {
case GLES_2_0_COMPATIBLE: {
-
p->glx_context = glXCreateNewContext(x11_display, fbconfig, GLX_RGBA_TYPE, 0, true);
ERR_FAIL_COND_V(!p->glx_context, ERR_UNCONFIGURED);
} break;
@@ -192,7 +186,6 @@ Error ContextGL_X11::initialize() {
}
int ContextGL_X11::get_window_width() {
-
XWindowAttributes xwa;
XGetWindowAttributes(x11_display, x11_window, &xwa);
@@ -235,13 +228,11 @@ void ContextGL_X11::set_use_vsync(bool p_use) {
use_vsync = p_use;
}
bool ContextGL_X11::is_using_vsync() const {
-
return use_vsync;
}
ContextGL_X11::ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type) :
x11_window(p_x11_window) {
-
default_video_mode = p_default_video_mode;
x11_display = p_x11_display;
diff --git a/platform/linuxbsd/context_gl_x11.h b/platform/linuxbsd/context_gl_x11.h
index 2c0643c95a..7aed280c98 100644
--- a/platform/linuxbsd/context_gl_x11.h
+++ b/platform/linuxbsd/context_gl_x11.h
@@ -42,7 +42,6 @@
struct ContextGL_X11_Private;
class ContextGL_X11 {
-
public:
enum ContextType {
GLES_2_0_COMPATIBLE,
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.h b/platform/linuxbsd/crash_handler_linuxbsd.h
index 94b4649690..9bb03579bc 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.h
+++ b/platform/linuxbsd/crash_handler_linuxbsd.h
@@ -32,7 +32,6 @@
#define CRASH_HANDLER_X11_H
class CrashHandler {
-
bool disabled;
public:
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index f016892453..e2f0a53f0f 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -204,7 +204,6 @@ void DisplayServerX11::_update_real_mouse_position(const WindowData &wd) {
if (xquerypointer_result) {
if (win_x > 0 && win_y > 0 && win_x <= wd.size.width && win_y <= wd.size.height) {
-
last_mouse_pos.x = win_x;
last_mouse_pos.y = win_y;
last_mouse_pos_valid = true;
@@ -354,7 +353,6 @@ void DisplayServerX11::_flush_mouse_motion() {
}
void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
-
_THREAD_SAFE_METHOD_
if (p_mode == mouse_mode)
@@ -367,7 +365,6 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
bool showCursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED);
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
-
if (showCursor) {
XDefineCursor(x11_display, E->get().x11_window, cursors[current_cursor]); // show cursor
} else {
@@ -377,7 +374,6 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
mouse_mode = p_mode;
if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED) {
-
//flush pending motion events
_flush_mouse_motion();
WindowData &main_window = windows[MAIN_WINDOW_ID];
@@ -409,14 +405,11 @@ DisplayServerX11::MouseMode DisplayServerX11::mouse_get_mode() const {
}
void DisplayServerX11::mouse_warp_to_position(const Point2i &p_to) {
-
_THREAD_SAFE_METHOD_
if (mouse_mode == MOUSE_MODE_CAPTURED) {
-
last_mouse_pos = p_to;
} else {
-
/*XWindowAttributes xwa;
XGetWindowAttributes(x11_display, x11_window, &xwa);
printf("%d %d\n", xwa.x, xwa.y); needed? */
@@ -451,7 +444,6 @@ int DisplayServerX11::mouse_get_button_state() const {
}
void DisplayServerX11::clipboard_set(const String &p_text) {
-
_THREAD_SAFE_METHOD_
internal_clipboard = p_text;
@@ -460,7 +452,6 @@ void DisplayServerX11::clipboard_set(const String &p_text) {
}
static String _clipboard_get_impl(Atom p_source, Window x11_window, ::Display *x11_display, String p_internal_clipboard, Atom target) {
-
String ret;
Atom type;
@@ -471,7 +462,6 @@ static String _clipboard_get_impl(Atom p_source, Window x11_window, ::Display *x
Window Sown = XGetSelectionOwner(x11_display, p_source);
if (Sown == x11_window) {
-
return p_internal_clipboard;
};
@@ -531,7 +521,6 @@ static String _clipboard_get(Atom p_source, Window x11_window, ::Display *x11_di
}
String DisplayServerX11::clipboard_get() const {
-
_THREAD_SAFE_METHOD_
String ret;
@@ -545,7 +534,6 @@ String DisplayServerX11::clipboard_get() const {
}
int DisplayServerX11::get_screen_count() const {
-
_THREAD_SAFE_METHOD_
// Using Xinerama Extension
@@ -560,7 +548,6 @@ int DisplayServerX11::get_screen_count() const {
return count;
}
Point2i DisplayServerX11::screen_get_position(int p_screen) const {
-
_THREAD_SAFE_METHOD_
if (p_screen == SCREEN_OF_MAIN_WINDOW) {
@@ -615,7 +602,6 @@ Rect2i DisplayServerX11::screen_get_usable_rect(int p_screen) const {
}
int DisplayServerX11::screen_get_dpi(int p_screen) const {
-
_THREAD_SAFE_METHOD_
if (p_screen == SCREEN_OF_MAIN_WINDOW) {
@@ -659,7 +645,6 @@ int DisplayServerX11::screen_get_dpi(int p_screen) const {
return 96;
}
bool DisplayServerX11::screen_is_touchscreen(int p_screen) const {
-
_THREAD_SAFE_METHOD_
#ifndef _MSC_VER
@@ -680,7 +665,6 @@ Vector<DisplayServer::WindowID> DisplayServerX11::get_window_list() const {
}
DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
_THREAD_SAFE_METHOD_
WindowID id = _create_window(p_mode, p_flags, p_rect);
@@ -694,7 +678,6 @@ DisplayServer::WindowID DisplayServerX11::create_sub_window(WindowMode p_mode, u
}
void DisplayServerX11::delete_sub_window(WindowID p_id) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_id));
@@ -725,7 +708,6 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
}
void DisplayServerX11::window_attach_instance_id(ObjectID p_instance, WindowID p_window) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -733,19 +715,16 @@ void DisplayServerX11::window_attach_instance_id(ObjectID p_instance, WindowID p
}
ObjectID DisplayServerX11::window_get_attached_instance_id(WindowID p_window) const {
-
ERR_FAIL_COND_V(!windows.has(p_window), ObjectID());
const WindowData &wd = windows[p_window];
return wd.instance_id;
}
DisplayServerX11::WindowID DisplayServerX11::get_window_at_screen_position(const Point2i &p_position) const {
-
return INVALID_WINDOW_ID;
}
void DisplayServerX11::window_set_title(const String &p_title, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -759,7 +738,6 @@ void DisplayServerX11::window_set_title(const String &p_title, WindowID p_window
}
void DisplayServerX11::window_set_rect_changed_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -768,7 +746,6 @@ void DisplayServerX11::window_set_rect_changed_callback(const Callable &p_callab
}
void DisplayServerX11::window_set_window_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -777,7 +754,6 @@ void DisplayServerX11::window_set_window_event_callback(const Callable &p_callab
}
void DisplayServerX11::window_set_input_event_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -785,7 +761,6 @@ void DisplayServerX11::window_set_input_event_callback(const Callable &p_callabl
wd.input_event_callback = p_callable;
}
void DisplayServerX11::window_set_input_text_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -794,7 +769,6 @@ void DisplayServerX11::window_set_input_text_callback(const Callable &p_callable
}
void DisplayServerX11::window_set_drop_files_callback(const Callable &p_callable, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -803,7 +777,6 @@ void DisplayServerX11::window_set_drop_files_callback(const Callable &p_callable
}
int DisplayServerX11::window_get_current_screen(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), -1);
@@ -823,7 +796,6 @@ int DisplayServerX11::window_get_current_screen(WindowID p_window) const {
return 0;
}
void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -847,7 +819,6 @@ void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window
}
void DisplayServerX11::window_set_transient(WindowID p_window, WindowID p_parent) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(p_window == p_parent);
@@ -883,7 +854,6 @@ void DisplayServerX11::window_set_transient(WindowID p_window, WindowID p_parent
}
Point2i DisplayServerX11::window_get_position(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Point2i());
@@ -893,7 +863,6 @@ Point2i DisplayServerX11::window_get_position(WindowID p_window) const {
}
void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -926,7 +895,6 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
}
void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -959,7 +927,6 @@ void DisplayServerX11::window_set_max_size(const Size2i p_size, WindowID p_windo
}
}
Size2i DisplayServerX11::window_get_max_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -969,7 +936,6 @@ Size2i DisplayServerX11::window_get_max_size(WindowID p_window) const {
}
void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1002,7 +968,6 @@ void DisplayServerX11::window_set_min_size(const Size2i p_size, WindowID p_windo
}
}
Size2i DisplayServerX11::window_get_min_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1012,7 +977,6 @@ Size2i DisplayServerX11::window_get_min_size(WindowID p_window) const {
}
void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1074,7 +1038,6 @@ void DisplayServerX11::window_set_size(const Size2i p_size, WindowID p_window) {
}
}
Size2i DisplayServerX11::window_get_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1082,7 +1045,6 @@ Size2i DisplayServerX11::window_get_size(WindowID p_window) const {
return wd.size;
}
Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), Size2i());
@@ -1113,7 +1075,6 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
}
bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1163,7 +1124,6 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
}
void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -1195,7 +1155,6 @@ void DisplayServerX11::_set_wm_maximized(WindowID p_window, bool p_enabled) {
}
void DisplayServerX11::_set_wm_fullscreen(WindowID p_window, bool p_enabled) {
-
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
@@ -1280,7 +1239,6 @@ void DisplayServerX11::_set_wm_fullscreen(WindowID p_window, bool p_enabled) {
}
void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1341,7 +1299,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
} break;
case WINDOW_MODE_MAXIMIZED: {
-
_set_wm_maximized(p_window, false);
} break;
}
@@ -1386,7 +1343,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
wd.fullscreen = true;
} break;
case WINDOW_MODE_MAXIMIZED: {
-
_set_wm_maximized(p_window, true);
} break;
@@ -1394,7 +1350,6 @@ void DisplayServerX11::window_set_mode(WindowMode p_mode, WindowID p_window) {
}
DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), WINDOW_MODE_WINDOWED);
@@ -1493,7 +1448,6 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
}
void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1534,7 +1488,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
} break;
case WINDOW_FLAG_BORDERLESS: {
-
Hints hints;
Atom property;
hints.flags = 2;
@@ -1548,7 +1501,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
wd.borderless = p_enabled;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
ERR_FAIL_COND_MSG(wd.transient_parent != INVALID_WINDOW_ID, "Can't make a window transient if the 'on top' flag is active.");
if (p_enabled && wd.fullscreen) {
_set_wm_maximized(p_window, true);
@@ -1582,7 +1534,6 @@ void DisplayServerX11::window_set_flag(WindowFlags p_flag, bool p_enabled, Windo
}
}
bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
@@ -1590,15 +1541,12 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
switch (p_flag) {
case WINDOW_FLAG_RESIZE_DISABLED: {
-
return wd.resize_disabled;
} break;
case WINDOW_FLAG_BORDERLESS: {
-
bool borderless = wd.borderless;
Atom prop = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
if (prop != None) {
-
Atom type;
int format;
unsigned long len;
@@ -1616,7 +1564,6 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
return borderless;
} break;
case WINDOW_FLAG_ALWAYS_ON_TOP: {
-
return wd.on_top;
} break;
case WINDOW_FLAG_TRANSPARENT: {
@@ -1630,7 +1577,6 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
}
void DisplayServerX11::window_request_attention(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1657,7 +1603,6 @@ void DisplayServerX11::window_request_attention(WindowID p_window) {
}
void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1679,12 +1624,10 @@ void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
}
bool DisplayServerX11::window_can_draw(WindowID p_window) const {
-
//this seems to be all that is provided by X11
return window_get_mode(p_window) != WINDOW_MODE_MINIMIZED;
}
bool DisplayServerX11::can_any_window_draw() const {
-
_THREAD_SAFE_METHOD_
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
@@ -1697,7 +1640,6 @@ bool DisplayServerX11::can_any_window_draw() const {
}
void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1716,7 +1658,6 @@ void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_win
}
}
void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_window) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
@@ -1736,7 +1677,6 @@ void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_
}
void DisplayServerX11::cursor_set_shape(CursorShape p_shape) {
-
_THREAD_SAFE_METHOD_
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
@@ -1763,11 +1703,9 @@ DisplayServerX11::CursorShape DisplayServerX11::cursor_get_shape() const {
return current_cursor;
}
void DisplayServerX11::cursor_set_custom_image(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
-
_THREAD_SAFE_METHOD_
if (p_cursor.is_valid()) {
-
Map<CursorShape, Vector<Variant>>::Element *cursor_c = cursors_cache.find(p_shape);
if (cursor_c) {
@@ -1906,7 +1844,6 @@ DisplayServerX11::LatinKeyboardVariant DisplayServerX11::get_latin_keyboard_vari
}
DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display, Window p_window, Atom p_property) {
-
Atom actual_type;
int actual_format;
unsigned long nitems;
@@ -1935,11 +1872,9 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display,
}
static Atom pick_target_from_list(Display *p_display, Atom *p_list, int p_count) {
-
static const char *target_type = "text/uri-list";
for (int i = 0; i < p_count; i++) {
-
Atom atom = p_list[i];
if (atom != None && String(XGetAtomName(p_display, atom)) == target_type)
@@ -1949,7 +1884,6 @@ static Atom pick_target_from_list(Display *p_display, Atom *p_list, int p_count)
}
static Atom pick_target_from_atoms(Display *p_disp, Atom p_t1, Atom p_t2, Atom p_t3) {
-
static const char *target_type = "text/uri-list";
if (p_t1 != None && String(XGetAtomName(p_disp, p_t1)) == target_type)
return p_t1;
@@ -1964,7 +1898,6 @@ static Atom pick_target_from_atoms(Display *p_disp, Atom p_t1, Atom p_t2, Atom p
}
void DisplayServerX11::_get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state) {
-
state->set_shift((p_x11_state & ShiftMask));
state->set_control((p_x11_state & ControlMask));
state->set_alt((p_x11_state & Mod1Mask /*|| p_x11_state&Mod5Mask*/)); //altgr should not count as alt
@@ -1972,7 +1905,6 @@ void DisplayServerX11::_get_key_modifier_state(unsigned int p_x11_state, Ref<Inp
}
unsigned int DisplayServerX11::_get_mouse_button_state(unsigned int p_x11_button, int p_x11_type) {
-
unsigned int mask = 1 << (p_x11_button - 1);
if (p_x11_type == ButtonPress) {
@@ -1985,7 +1917,6 @@ unsigned int DisplayServerX11::_get_mouse_button_state(unsigned int p_x11_button
}
void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo) {
-
WindowData wd = windows[p_window];
// X11 functions don't know what const is
XKeyEvent *xkeyevent = p_event;
@@ -2029,7 +1960,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
}
if (xkeyevent->type == KeyPress && wd.xic) {
-
Status status;
#ifdef X_HAVE_UTF8_STRING
int utf8len = 8;
@@ -2093,7 +2023,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
memfree(utf8string);
#else
do {
-
int mnbytes = XmbLookupString(xic, xkeyevent, xmbstring, xmblen - 1, &keysym_unicode, &status);
xmbstring[mnbytes] = '\0';
@@ -2161,7 +2090,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
// difference in time is below a threshold.
if (xkeyevent->type != KeyPress) {
-
p_echo = false;
// make sure there are events pending,
@@ -2240,7 +2168,6 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data) {
-
WARN_PRINT("Input method stopped");
DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
ds->xim = nullptr;
@@ -2251,7 +2178,6 @@ void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
}
void DisplayServerX11::_window_changed(XEvent *event) {
-
WindowID window_id = MAIN_WINDOW_ID;
// Assign the event to the relevant window
@@ -2316,7 +2242,6 @@ void DisplayServerX11::_dispatch_input_events(const Ref<InputEvent> &p_event) {
}
void DisplayServerX11::_dispatch_input_event(const Ref<InputEvent> &p_event) {
-
Variant ev = p_event;
Variant *evp = &ev;
Variant ret;
@@ -2353,7 +2278,6 @@ void DisplayServerX11::_send_window_event(const WindowData &wd, WindowEvent p_ev
}
}
void DisplayServerX11::process_events() {
-
_THREAD_SAFE_METHOD_
do_mouse_warp = false;
@@ -2384,9 +2308,7 @@ void DisplayServerX11::process_events() {
}
if (XGetEventData(x11_display, &event.xcookie)) {
-
if (event.xcookie.type == GenericEvent && event.xcookie.extension == xi.opcode) {
-
XIDeviceEvent *event_data = (XIDeviceEvent *)event.xcookie.data;
int index = event_data->detail;
Vector2 pos = Vector2(event_data->event_x, event_data->event_y);
@@ -2493,7 +2415,6 @@ void DisplayServerX11::process_events() {
//XIAllowTouchEvents(x11_display, event_data->deviceid, event_data->detail, x11_window, XIAcceptTouch);
case XI_TouchEnd: {
-
bool is_begin = event_data->evtype == XI_TouchBegin;
Ref<InputEventScreenTouch> st;
@@ -2522,14 +2443,12 @@ void DisplayServerX11::process_events() {
} break;
case XI_TouchUpdate: {
-
Map<int, Vector2>::Element *curr_pos_elem = xi.state.find(index);
if (!curr_pos_elem) { // Defensive
break;
}
if (curr_pos_elem->value() != pos) {
-
Ref<InputEventScreenDrag> sd;
sd.instance();
sd->set_window_id(window_id);
@@ -2581,7 +2500,6 @@ void DisplayServerX11::process_events() {
// Show and update the cursor if confined and the window regained focus.
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
-
if (mouse_mode == MOUSE_MODE_CONFINED)
XUndefineCursor(x11_display, E->get().x11_window);
else if (mouse_mode == MOUSE_MODE_CAPTURED) // or re-hide it in captured mode
@@ -2612,7 +2530,6 @@ void DisplayServerX11::process_events() {
if (mouse_mode_grab) {
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
-
//dear X11, I try, I really try, but you never work, you do whathever you want.
if (mouse_mode == MOUSE_MODE_CAPTURED) {
// Show the cursor if we're in captured mode so it doesn't look weird.
@@ -2629,7 +2546,6 @@ void DisplayServerX11::process_events() {
// Release every pointer to avoid sticky points
for (Map<int, Vector2>::Element *E = xi.state.front(); E; E = E->next()) {
-
Ref<InputEventScreenTouch> st;
st.instance();
st->set_index(E->key());
@@ -2649,7 +2565,6 @@ void DisplayServerX11::process_events() {
break;
case ButtonPress:
case ButtonRelease: {
-
/* exit in case of a mouse button press */
last_timestamp = event.xbutton.time;
if (mouse_mode == MOUSE_MODE_CAPTURED) {
@@ -2674,13 +2589,10 @@ void DisplayServerX11::process_events() {
mb->set_pressed((event.type == ButtonPress));
if (event.type == ButtonPress) {
-
uint64_t diff = OS::get_singleton()->get_ticks_usec() / 1000 - last_click_ms;
if (mb->get_button_index() == last_click_button_index) {
-
if (diff < 400 && Vector2(last_click_pos).distance_to(Vector2(event.xbutton.x, event.xbutton.y)) < 5) {
-
last_click_ms = 0;
last_click_pos = Point2i(-100, -100);
last_click_button_index = -1;
@@ -2701,7 +2613,6 @@ void DisplayServerX11::process_events() {
} break;
case MotionNotify: {
-
// The X11 API requires filtering one-by-one through the motion
// notify events, in order to figure out which event is the one
// generated by warping the mouse pointer.
@@ -2757,7 +2668,6 @@ void DisplayServerX11::process_events() {
}
if (!last_mouse_pos_valid) {
-
last_mouse_pos = pos;
last_mouse_pos_valid = true;
}
@@ -2820,7 +2730,6 @@ void DisplayServerX11::process_events() {
} break;
case KeyPress:
case KeyRelease: {
-
last_timestamp = event.xkey.time;
// key event is a little complex, so
@@ -2828,7 +2737,6 @@ void DisplayServerX11::process_events() {
_handle_key_event(window_id, (XKeyEvent *)&event);
} break;
case SelectionRequest: {
-
XSelectionRequestEvent *req;
XEvent e, respond;
e = event;
@@ -2851,7 +2759,6 @@ void DisplayServerX11::process_events() {
clip.length());
respond.xselection.property = req->property;
} else if (req->target == XInternAtom(x11_display, "TARGETS", 0)) {
-
Atom data[7];
data[0] = XInternAtom(x11_display, "TARGETS", 0);
data[1] = XInternAtom(x11_display, "UTF8_STRING", 0);
@@ -2892,7 +2799,6 @@ void DisplayServerX11::process_events() {
case SelectionNotify:
if (event.xselection.target == requested) {
-
Property p = _read_property(x11_display, windows[window_id].x11_window, XInternAtom(x11_display, "PRIMARY", 0));
Vector<String> files = String((char *)p.data).split("\n", false);
@@ -2931,7 +2837,6 @@ void DisplayServerX11::process_events() {
}
else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_enter) {
-
//File(s) have been dragged over the window, check for supported target (text/uri-list)
xdnd_version = (event.xclient.data.l[1] >> 24);
Window source = event.xclient.data.l[0];
@@ -2942,7 +2847,6 @@ void DisplayServerX11::process_events() {
} else
requested = pick_target_from_atoms(x11_display, event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);
} else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_position) {
-
//xdnd position event, reply with an XDND status message
//just depending on type of data for now
XClientMessageEvent m;
@@ -2961,7 +2865,6 @@ void DisplayServerX11::process_events() {
XSendEvent(x11_display, event.xclient.data.l[0], False, NoEventMask, (XEvent *)&m);
XFlush(x11_display);
} else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_drop) {
-
if (requested != None) {
xdnd_source_window = event.xclient.data.l[0];
if (xdnd_version >= 1)
@@ -2992,7 +2895,6 @@ void DisplayServerX11::process_events() {
XFlush(x11_display);
if (do_mouse_warp) {
-
XWarpPointer(x11_display, None, windows[MAIN_WINDOW_ID].x11_window,
0, 0, 0, 0, (int)windows[MAIN_WINDOW_ID].size.width / 2, (int)windows[MAIN_WINDOW_ID].size.height / 2);
@@ -3024,7 +2926,6 @@ void DisplayServerX11::_update_context(WindowData &wd) {
XClassHint *classHint = XAllocClassHint();
if (classHint) {
-
CharString name_str;
switch (context) {
case CONTEXT_EDITOR:
@@ -3058,7 +2959,6 @@ void DisplayServerX11::_update_context(WindowData &wd) {
}
}
void DisplayServerX11::set_context(Context p_context) {
-
_THREAD_SAFE_METHOD_
context = p_context;
@@ -3167,12 +3067,10 @@ Vector<String> DisplayServerX11::get_rendering_drivers_func() {
}
DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
return memnew(DisplayServerX11(p_rendering_driver, p_mode, p_flags, p_resolution, r_error));
}
DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, uint32_t p_flags, const Rect2i &p_rect) {
-
//Create window
long visualMask = VisualScreenMask;
@@ -3254,7 +3152,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
XChangeProperty(x11_display, wd.x11_window, xdnd_aware, XA_ATOM, 32, PropModeReplace, (unsigned char *)&xdnd_version, 1);
if (xim && xim_style) {
-
wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)nullptr);
if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, nullptr) != nullptr) {
WARN_PRINT("XGetICValues couldn't obtain XNFilterEvents value");
@@ -3267,7 +3164,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
WARN_PRINT("XCreateIC couldn't create wd.xic");
}
} else {
-
wd.xic = nullptr;
WARN_PRINT("XCreateIC couldn't create wd.xic");
}
@@ -3279,9 +3175,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
windows[id] = wd;
{
-
if (p_flags & WINDOW_FLAG_RESIZE_DISABLED_BIT) {
-
XSizeHints *xsh;
xsh = XAllocSizeHints();
@@ -3345,7 +3239,6 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
}
if (id != MAIN_WINDOW_ID) {
-
XSizeHints my_hints = XSizeHints();
my_hints.flags = PPosition | PSize; /* I want to specify position and size */
@@ -3395,14 +3288,12 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
//set cursor
if (cursors[current_cursor] != None) {
-
XDefineCursor(x11_display, wd.x11_window, cursors[current_cursor]);
}
return id;
}
DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode p_mode, uint32_t p_flags, const Vector2i &p_resolution, Error &r_error) {
-
Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
r_error = OK;
@@ -3411,7 +3302,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
mouse_mode = MOUSE_MODE_VISIBLE;
for (int i = 0; i < CURSOR_MAX; i++) {
-
cursors[i] = None;
img[i] = nullptr;
}
@@ -3446,7 +3336,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
// Try to support IME if detectable auto-repeat is supported
if (xkb_dar == True) {
-
#ifdef X_HAVE_UTF8_STRING
// Xutf8LookupString will be used later instead of XmbLookupString before
// the multibyte sequences can be converted to unicode string.
@@ -3523,10 +3412,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (xim_styles) {
xim_style = 0L;
for (int i = 0; i < xim_styles->count_styles; i++) {
-
if (xim_styles->supported_styles[i] ==
(XIMPreeditNothing | XIMStatusNothing)) {
-
xim_style = xim_styles->supported_styles[i];
break;
}
@@ -3561,7 +3448,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
context_vulkan = memnew(VulkanContextX11);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
@@ -3583,7 +3469,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
getenv("PRIMUS_libGL") ||
getenv("PRIMUS_LOAD_GLOBAL") ||
getenv("BUMBLEBEE_SOCKET")) {
-
print_verbose("Optirun/primusrun detected. Skipping GPU detection");
use_prime = 0;
}
@@ -3595,7 +3480,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
for (int i = 0; i < libraries.size(); ++i) {
if (FileAccess::exists(libraries[i] + "/libGL.so.1") ||
FileAccess::exists(libraries[i] + "/libGL.so")) {
-
print_verbose("Custom libGL override detected. Skipping GPU detection");
use_prime = 0;
}
@@ -3649,7 +3533,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
//create RenderingDevice if used
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
//temporary
rendering_device_vulkan = memnew(RenderingDeviceVulkan);
rendering_device_vulkan->initialize(context_vulkan);
@@ -3695,7 +3578,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
for (int i = 0; i < CURSOR_MAX; i++) {
-
static const char *cursor_file[] = {
"left_ptr",
"xterm",
@@ -3831,7 +3713,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK;
}
DisplayServerX11::~DisplayServerX11() {
-
//destroy all windows
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) {
#ifdef VULKAN_ENABLED
@@ -3850,7 +3731,6 @@ DisplayServerX11::~DisplayServerX11() {
//destroy drivers
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
-
if (rendering_device_vulkan) {
rendering_device_vulkan->finalize();
memdelete(rendering_device_vulkan);
@@ -3881,7 +3761,6 @@ DisplayServerX11::~DisplayServerX11() {
}
void DisplayServerX11::register_x11_driver() {
-
register_create_function("x11", create_func, get_rendering_drivers_func);
}
diff --git a/platform/linuxbsd/export/export.cpp b/platform/linuxbsd/export/export.cpp
index 53e3ce8f85..86ea95c563 100644
--- a/platform/linuxbsd/export/export.cpp
+++ b/platform/linuxbsd/export/export.cpp
@@ -38,7 +38,6 @@
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size);
void register_linuxbsd_exporter() {
-
Ref<EditorExportPlatformPC> platform;
platform.instance();
@@ -62,7 +61,6 @@ void register_linuxbsd_exporter() {
}
static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
-
// Patch the header of the "pck" section in the ELF file so that it corresponds to the embedded data
FileAccess *f = FileAccess::open(p_path, FileAccess::READ_WRITE);
@@ -139,7 +137,6 @@ static Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start,
bool found = false;
for (int i = 0; i < num_sections; ++i) {
-
int64_t section_header_pos = section_table_pos + i * section_header_size;
f->seek(section_header_pos);
diff --git a/platform/linuxbsd/godot_linuxbsd.cpp b/platform/linuxbsd/godot_linuxbsd.cpp
index 710ba3ca40..6a0c2a4a5d 100644
--- a/platform/linuxbsd/godot_linuxbsd.cpp
+++ b/platform/linuxbsd/godot_linuxbsd.cpp
@@ -37,7 +37,6 @@
#include "os_linuxbsd.h"
int main(int argc, char *argv[]) {
-
OS_LinuxBSD os;
setlocale(LC_CTYPE, "");
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp
index f57f74907f..e74371ca52 100644
--- a/platform/linuxbsd/joypad_linux.cpp
+++ b/platform/linuxbsd/joypad_linux.cpp
@@ -59,7 +59,6 @@ JoypadLinux::Joypad::Joypad() {
}
JoypadLinux::Joypad::~Joypad() {
-
for (int i = 0; i < MAX_ABS; i++) {
if (abs_info[i]) {
memdelete(abs_info[i]);
@@ -94,7 +93,6 @@ JoypadLinux::~JoypadLinux() {
}
void JoypadLinux::joy_thread_func(void *p_user) {
-
if (p_user) {
JoypadLinux *joy = (JoypadLinux *)p_user;
joy->run_joypad_thread();
@@ -115,7 +113,6 @@ void JoypadLinux::run_joypad_thread() {
#ifdef UDEV_ENABLED
void JoypadLinux::enumerate_joypads(udev *p_udev) {
-
udev_enumerate *enumerate;
udev_list_entry *devices, *dev_list_entry;
udev_device *dev;
@@ -126,13 +123,11 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) {
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(dev_list_entry, devices) {
-
const char *path = udev_list_entry_get_name(dev_list_entry);
dev = udev_device_new_from_syspath(p_udev, path);
const char *devnode = udev_device_get_devnode(dev);
if (devnode) {
-
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
MutexLock lock(joy_mutex);
@@ -145,7 +140,6 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) {
}
void JoypadLinux::monitor_joypads(udev *p_udev) {
-
udev_device *dev = nullptr;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", nullptr);
@@ -153,7 +147,6 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
int fd = udev_monitor_get_fd(mon);
while (!exit_udev) {
-
fd_set fds;
struct timeval tv;
int ret;
@@ -172,15 +165,12 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
dev = udev_monitor_receive_device(mon);
if (dev && udev_device_get_devnode(dev) != 0) {
-
MutexLock lock(joy_mutex);
String action = udev_device_get_action(dev);
const char *devnode = udev_device_get_devnode(dev);
if (devnode) {
-
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
-
if (action == "add")
open_joypad(devnode);
else if (String(action) == "remove")
@@ -198,7 +188,6 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
#endif
void JoypadLinux::monitor_joypads() {
-
while (!exit_udev) {
{
MutexLock lock(joy_mutex);
@@ -216,9 +205,7 @@ void JoypadLinux::monitor_joypads() {
}
int JoypadLinux::get_joy_from_path(String p_path) const {
-
for (int i = 0; i < JOYPADS_MAX; i++) {
-
if (joypads[i].devpath == p_path) {
return i;
}
@@ -229,7 +216,6 @@ int JoypadLinux::get_joy_from_path(String p_path) const {
void JoypadLinux::close_joypad(int p_id) {
if (p_id == -1) {
for (int i = 0; i < JOYPADS_MAX; i++) {
-
close_joypad(i);
};
return;
@@ -239,7 +225,6 @@ void JoypadLinux::close_joypad(int p_id) {
Joypad &joy = joypads[p_id];
if (joy.fd != -1) {
-
close(joy.fd);
joy.fd = -1;
attached_devices.remove(attached_devices.find(joy.devpath));
@@ -248,7 +233,6 @@ void JoypadLinux::close_joypad(int p_id) {
}
static String _hex_str(uint8_t p_byte) {
-
static const char *dict = "0123456789abcdef";
char ret[3];
ret[2] = 0;
@@ -260,7 +244,6 @@ static String _hex_str(uint8_t p_byte) {
}
void JoypadLinux::setup_joypad_properties(int p_id) {
-
Joypad *joy = &joypads[p_id];
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
@@ -274,16 +257,12 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
return;
}
for (int i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
-
if (test_bit(i, keybit)) {
-
joy->key_map[i] = num_buttons++;
}
}
for (int i = BTN_MISC; i < BTN_JOYSTICK; ++i) {
-
if (test_bit(i, keybit)) {
-
joy->key_map[i] = num_buttons++;
}
}
@@ -294,7 +273,6 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
continue;
}
if (test_bit(i, absbit)) {
-
joy->abs_map[i] = num_axes++;
joy->abs_info[i] = memnew(input_absinfo);
if (ioctl(joy->fd, EVIOCGABS(i), joy->abs_info[i]) < 0) {
@@ -315,11 +293,9 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
}
void JoypadLinux::open_joypad(const char *p_path) {
-
int joy_num = input->get_unused_joy_id();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
-
unsigned long evbit[NBITS(EV_MAX)] = { 0 };
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
@@ -369,7 +345,6 @@ void JoypadLinux::open_joypad(const char *p_path) {
setup_joypad_properties(joy_num);
sprintf(uid, "%04x%04x", BSWAP16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
-
uint16_t vendor = BSWAP16(inpid.vendor);
uint16_t product = BSWAP16(inpid.product);
uint16_t version = BSWAP16(inpid.version);
@@ -380,7 +355,6 @@ void JoypadLinux::open_joypad(const char *p_path) {
String uidname = uid;
int uidlen = MIN(name.length(), 11);
for (int i = 0; i < uidlen; i++) {
-
uidname = uidname + _hex_str(name[i]);
}
uidname += "00";
@@ -437,7 +411,6 @@ void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
}
Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const {
-
int min = p_abs->minimum;
int max = p_abs->maximum;
Input::JoyAxis jx;
@@ -457,12 +430,10 @@ Input::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value
}
void JoypadLinux::process_joypads() {
-
if (joy_mutex.try_lock() != OK) {
return;
}
for (int i = 0; i < JOYPADS_MAX; i++) {
-
if (joypads[i].fd == -1)
continue;
@@ -474,7 +445,6 @@ void JoypadLinux::process_joypads() {
while ((len = read(joy->fd, events, (sizeof events))) > 0) {
len /= sizeof(events[0]);
for (int j = 0; j < len; j++) {
-
input_event &ev = events[j];
// ev may be tainted and out of MAX_KEY range, which will cause
diff --git a/platform/linuxbsd/key_mapping_x11.cpp b/platform/linuxbsd/key_mapping_x11.cpp
index 78bd2b71a0..daf7326024 100644
--- a/platform/linuxbsd/key_mapping_x11.cpp
+++ b/platform/linuxbsd/key_mapping_x11.cpp
@@ -33,7 +33,6 @@
/***** SCAN CODE CONVERSION ******/
struct _XTranslatePair {
-
KeySym keysym;
unsigned int keycode;
};
@@ -181,7 +180,6 @@ static _XTranslatePair _xkeysym_to_keycode[] = {
};
struct _TranslatePair {
-
unsigned int keysym;
unsigned int keycode;
};
@@ -301,10 +299,8 @@ static _TranslatePair _scancode_to_keycode[] = {
};
unsigned int KeyMappingX11::get_scancode(unsigned int p_code) {
-
unsigned int keycode = KEY_UNKNOWN;
for (int i = 0; _scancode_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
-
if (_scancode_to_keycode[i].keycode == p_code) {
keycode = _scancode_to_keycode[i].keysym;
break;
@@ -315,7 +311,6 @@ unsigned int KeyMappingX11::get_scancode(unsigned int p_code) {
}
unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
-
// kinda bruteforce.. could optimize.
if (p_keysym < 0x100) // Latin 1, maps 1-1
@@ -323,7 +318,6 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
// look for special key
for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
-
if (_xkeysym_to_keycode[idx].keysym == p_keysym)
return _xkeysym_to_keycode[idx].keycode;
}
@@ -332,7 +326,6 @@ unsigned int KeyMappingX11::get_keycode(KeySym p_keysym) {
}
KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
-
// kinda bruteforce.. could optimize.
if (p_code < 0x100) // Latin 1, maps 1-1
@@ -340,7 +333,6 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
// look for special key
for (int idx = 0; _xkeysym_to_keycode[idx].keysym != 0; idx++) {
-
if (_xkeysym_to_keycode[idx].keycode == p_code)
return _xkeysym_to_keycode[idx].keysym;
}
@@ -353,7 +345,6 @@ KeySym KeyMappingX11::get_keysym(unsigned int p_code) {
// Tables taken from FOX toolkit
struct _XTranslateUnicodePair {
-
KeySym keysym;
unsigned int unicode;
};
@@ -1125,7 +1116,6 @@ static _XTranslateUnicodePair _xkeysym_to_unicode[_KEYSYM_MAX] = {
};
unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
-
/* Latin-1 */
if (p_keysym >= 0x20 && p_keysym <= 0x7e)
return p_keysym;
@@ -1155,7 +1145,6 @@ unsigned int KeyMappingX11::get_unicode_from_keysym(KeySym p_keysym) {
}
struct _XTranslateUnicodePairReverse {
-
unsigned int unicode;
KeySym keysym;
};
@@ -1919,7 +1908,6 @@ static _XTranslateUnicodePairReverse _unicode_to_xkeysym[_UNICODE_MAX] = {
};
KeySym KeyMappingX11::get_keysym_from_unicode(unsigned int p_unicode) {
-
/* Latin 1 */
if (p_unicode >= 0x20 && p_unicode <= 0x7e)
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index 7b76f7394b..7c7a27add0 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -55,21 +55,18 @@
#endif
void OS_LinuxBSD::initialize() {
-
crash_handler.initialize();
OS_Unix::initialize_core();
}
void OS_LinuxBSD::initialize_joypads() {
-
#ifdef JOYDEV_ENABLED
joypad = memnew(JoypadLinux(Input::get_singleton()));
#endif
}
String OS_LinuxBSD::get_unique_id() const {
-
static String machine_id;
if (machine_id.empty()) {
if (FileAccess *f = FileAccess::open("/etc/machine-id", FileAccess::READ)) {
@@ -84,7 +81,6 @@ String OS_LinuxBSD::get_unique_id() const {
}
void OS_LinuxBSD::finalize() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
@@ -99,24 +95,20 @@ void OS_LinuxBSD::finalize() {
}
MainLoop *OS_LinuxBSD::get_main_loop() const {
-
return main_loop;
}
void OS_LinuxBSD::delete_main_loop() {
-
if (main_loop)
memdelete(main_loop);
main_loop = nullptr;
}
void OS_LinuxBSD::set_main_loop(MainLoop *p_main_loop) {
-
main_loop = p_main_loop;
}
String OS_LinuxBSD::get_name() const {
-
#ifdef __linux__
return "Linux";
#elif defined(__FreeBSD__)
@@ -129,7 +121,6 @@ String OS_LinuxBSD::get_name() const {
}
Error OS_LinuxBSD::shell_open(String p_uri) {
-
Error ok;
List<String> args;
args.push_back(p_uri);
@@ -144,12 +135,10 @@ Error OS_LinuxBSD::shell_open(String p_uri) {
}
bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) {
-
return p_feature == "pc";
}
String OS_LinuxBSD::get_config_path() const {
-
if (has_environment("XDG_CONFIG_HOME")) {
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("HOME")) {
@@ -160,7 +149,6 @@ String OS_LinuxBSD::get_config_path() const {
}
String OS_LinuxBSD::get_data_path() const {
-
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else if (has_environment("HOME")) {
@@ -171,7 +159,6 @@ String OS_LinuxBSD::get_data_path() const {
}
String OS_LinuxBSD::get_cache_path() const {
-
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("HOME")) {
@@ -182,46 +169,37 @@ String OS_LinuxBSD::get_cache_path() const {
}
String OS_LinuxBSD::get_system_dir(SystemDir p_dir) const {
-
String xdgparam;
switch (p_dir) {
case SYSTEM_DIR_DESKTOP: {
-
xdgparam = "DESKTOP";
} break;
case SYSTEM_DIR_DCIM: {
-
xdgparam = "PICTURES";
} break;
case SYSTEM_DIR_DOCUMENTS: {
-
xdgparam = "DOCUMENTS";
} break;
case SYSTEM_DIR_DOWNLOADS: {
-
xdgparam = "DOWNLOAD";
} break;
case SYSTEM_DIR_MOVIES: {
-
xdgparam = "VIDEOS";
} break;
case SYSTEM_DIR_MUSIC: {
-
xdgparam = "MUSIC";
} break;
case SYSTEM_DIR_PICTURES: {
-
xdgparam = "PICTURES";
} break;
case SYSTEM_DIR_RINGTONES: {
-
xdgparam = "MUSIC";
} break;
@@ -237,7 +215,6 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir) const {
}
void OS_LinuxBSD::run() {
-
force_quit = false;
if (!main_loop)
@@ -251,7 +228,6 @@ void OS_LinuxBSD::run() {
//uint64_t frame=0;
while (!force_quit) {
-
DisplayServer::get_singleton()->process_events(); // get rid of pending events
#ifdef JOYDEV_ENABLED
joypad->process_joypads();
@@ -363,7 +339,6 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
}
OS_LinuxBSD::OS_LinuxBSD() {
-
main_loop = nullptr;
force_quit = false;
diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h
index 391f29e8a3..4295721c68 100644
--- a/platform/linuxbsd/os_linuxbsd.h
+++ b/platform/linuxbsd/os_linuxbsd.h
@@ -43,7 +43,6 @@
#include "servers/rendering_server.h"
class OS_LinuxBSD : public OS_Unix {
-
virtual void delete_main_loop();
bool force_quit;
diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp
index 1798a7026e..2eaa9f9446 100644
--- a/platform/linuxbsd/vulkan_context_x11.cpp
+++ b/platform/linuxbsd/vulkan_context_x11.cpp
@@ -36,7 +36,6 @@ const char *VulkanContextX11::_get_platform_surface_extension() const {
}
Error VulkanContextX11::window_create(DisplayServer::WindowID p_window_id, ::Window p_window, Display *p_display, int p_width, int p_height) {
-
VkXlibSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = nullptr;
diff --git a/platform/linuxbsd/vulkan_context_x11.h b/platform/linuxbsd/vulkan_context_x11.h
index 6e144ab2d9..af3d923cfe 100644
--- a/platform/linuxbsd/vulkan_context_x11.h
+++ b/platform/linuxbsd/vulkan_context_x11.h
@@ -35,7 +35,6 @@
#include <X11/Xlib.h>
class VulkanContextX11 : public VulkanContext {
-
virtual const char *_get_platform_surface_extension() const;
public: