Merge pull request #8180 from sergey-push/8145-Mouse_Position_is_unknown_until_first_mouse_event
8145 - Mouse Position is unknown until first mouse event on X11
This commit is contained in:
commit
aab6687523
2 changed files with 11 additions and 1 deletions
|
@ -2167,6 +2167,9 @@ void OS_Windows::run() {
|
||||||
if (!main_loop)
|
if (!main_loop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Process all events before the main initialization so the cursor will get initialized properly
|
||||||
|
process_events(); // get rid of pending events
|
||||||
|
|
||||||
main_loop->init();
|
main_loop->init();
|
||||||
|
|
||||||
uint64_t last_ticks = get_ticks_usec();
|
uint64_t last_ticks = get_ticks_usec();
|
||||||
|
|
|
@ -1277,8 +1277,12 @@ void OS_X11::process_xevents() {
|
||||||
case EnterNotify: {
|
case EnterNotify: {
|
||||||
if (main_loop && !mouse_mode_grab)
|
if (main_loop && !mouse_mode_grab)
|
||||||
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
|
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);
|
input->set_mouse_in_window(true);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
minimized = false;
|
minimized = false;
|
||||||
|
@ -1900,6 +1904,9 @@ void OS_X11::run() {
|
||||||
if (!main_loop)
|
if (!main_loop)
|
||||||
return;
|
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();
|
main_loop->init();
|
||||||
|
|
||||||
//uint64_t last_ticks=get_ticks_usec();
|
//uint64_t last_ticks=get_ticks_usec();
|
||||||
|
|
Loading…
Reference in a new issue