summaryrefslogtreecommitdiff
path: root/platform/x11/os_x11.cpp
diff options
context:
space:
mode:
authorSergey Pusnei <sergey.pusnei@gmail.com>2017-03-27 21:37:23 -0400
committerSergey Pusnei <sergey.pusnei@gmail.com>2017-03-28 19:18:40 -0400
commitc79e998d1f12b281530b15d3015e7128418c8a60 (patch)
treefe6d6505feb14da32efd69a104b27c372af8bfd9 /platform/x11/os_x11.cpp
parentd4740a98537b1e7dcb6fb48176abdebe27eee83c (diff)
8145 - Mouse Position is unknown until first mouse event on X11 & Win
- X11 update input->pos on EnterNotify - X11 & Win call first-time events processing before main initialization
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r--platform/x11/os_x11.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 6aeab21c7f..4606a90835 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1277,8 +1277,12 @@ void OS_X11::process_xevents() {
case EnterNotify: {
if (main_loop && !mouse_mode_grab)
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
- if (input)
+ if (input) {
+ // Update mouse position. It is triggered before mouse motion.
+ Point2i pos(event.xmotion.x, event.xmotion.y);
+ input->set_mouse_pos(pos);
input->set_mouse_in_window(true);
+ }
} break;
case FocusIn:
minimized = false;
@@ -1900,6 +1904,9 @@ void OS_X11::run() {
if (!main_loop)
return;
+ // Process all events before the main initialization so the cursor will get initialized properly
+ process_xevents(); // get rid of pending events
+
main_loop->init();
//uint64_t last_ticks=get_ticks_usec();