Merge pull request #65111 from MatthewZelriche/DroppedXEventFix
Fix dropped XEvents early in main window lifetime.
This commit is contained in:
commit
7ced3a6e37
1 changed files with 11 additions and 4 deletions
|
@ -5013,17 +5013,24 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
||||||
}
|
}
|
||||||
cursor_set_shape(CURSOR_BUSY);
|
cursor_set_shape(CURSOR_BUSY);
|
||||||
|
|
||||||
XEvent xevent;
|
Vector<XEvent> save_events;
|
||||||
while (XPending(x11_display) > 0) {
|
while (XPending(x11_display) > 0) {
|
||||||
|
XEvent xevent{ 0 };
|
||||||
XNextEvent(x11_display, &xevent);
|
XNextEvent(x11_display, &xevent);
|
||||||
if (xevent.type == ConfigureNotify) {
|
if (xevent.type == ConfigureNotify) {
|
||||||
_window_changed(&xevent);
|
_window_changed(&xevent);
|
||||||
} else if (xevent.type == MapNotify) {
|
} else {
|
||||||
// Have we failed to set fullscreen while the window was unmapped?
|
// Don't discard this event, we must resend it...
|
||||||
_validate_mode_on_map(main_window);
|
save_events.push_back(xevent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resend events that would have been dropped by the early event queue
|
||||||
|
// processing we just performed.
|
||||||
|
for (XEvent &ev : save_events) {
|
||||||
|
XSendEvent(x11_display, ev.xany.window, False, 0, &ev);
|
||||||
|
}
|
||||||
|
|
||||||
events_thread.start(_poll_events_thread, this);
|
events_thread.start(_poll_events_thread, this);
|
||||||
|
|
||||||
_update_real_mouse_position(windows[MAIN_WINDOW_ID]);
|
_update_real_mouse_position(windows[MAIN_WINDOW_ID]);
|
||||||
|
|
Loading…
Reference in a new issue