diff options
Diffstat (limited to 'platform/x11/os_x11.cpp')
| -rw-r--r-- | platform/x11/os_x11.cpp | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index dbc3914410..2d33d25773 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -116,24 +116,22 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au /** XLIB INITIALIZATION **/ x11_display = XOpenDisplay(NULL); + char *modifiers = NULL; Bool xkb_dar = False; if (x11_display) { XAutoRepeatOn(x11_display); xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, NULL); - } - - char *modifiers = NULL; - // Try to support IME if detectable auto-repeat is supported - - if (xkb_dar == True) { + // Try to support IME if detectable auto-repeat is supported + if (xkb_dar == True) { // Xutf8LookupString will be used later instead of XmbLookupString before // the multibyte sequences can be converted to unicode string. #ifdef X_HAVE_UTF8_STRING - modifiers = XSetLocaleModifiers(""); + modifiers = XSetLocaleModifiers(""); #endif + } } if (modifiers == NULL) { @@ -141,8 +139,6 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au WARN_PRINT("IME is disabled"); } modifiers = XSetLocaleModifiers("@im=none"); - } - if (modifiers == NULL) { WARN_PRINT("Error setting locale modifiers"); } @@ -538,6 +534,8 @@ void OS_X11::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); + memdelete(power_manager); + if (xrandr_handle) dlclose(xrandr_handle); @@ -1603,8 +1601,7 @@ void OS_X11::process_xevents() { Point2i pos(event.xmotion.x, event.xmotion.y); if (mouse_mode == MOUSE_MODE_CAPTURED) { -#if 1 - //Vector2 c = Point2i(current_videomode.width/2,current_videomode.height/2); + if (pos == Point2i(current_videomode.width / 2, current_videomode.height / 2)) { //this sucks, it's a hack, etc and is a little inaccurate, etc. //but nothing I can do, X11 sucks. @@ -1617,17 +1614,6 @@ void OS_X11::process_xevents() { pos = last_mouse_pos + (pos - center); center = new_center; do_mouse_warp = window_has_focus; // warp the cursor if we're focused in -#else - //Dear X11, thanks for making my life miserable - - center.x = current_videomode.width / 2; - center.y = current_videomode.height / 2; - pos = last_mouse_pos + (pos - center); - if (pos == last_mouse_pos) - break; - XWarpPointer(x11_display, None, x11_window, - 0, 0, 0, 0, (int)center.x, (int)center.y); -#endif } if (!last_mouse_pos_valid) { |