summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-03 20:36:39 +0200
committerGitHub <noreply@github.com>2022-09-03 20:36:39 +0200
commit7ced3a6e3777e519df1cd7cbbdfd2ee543709b4b (patch)
treea59c0dc7ba2dd7c5558d24d65b65c72fee301d8c /platform
parent3faf9e18f198ef9127a380f0fac0fcca641da2f1 (diff)
parent91ba9bcb03d3d8da8772a75585f1e08c4f339108 (diff)
Merge pull request #65111 from MatthewZelriche/DroppedXEventFix
Fix dropped XEvents early in main window lifetime.
Diffstat (limited to 'platform')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index a329c7ee8c..3979cab084 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -5013,17 +5013,24 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
cursor_set_shape(CURSOR_BUSY);
- XEvent xevent;
+ Vector<XEvent> save_events;
while (XPending(x11_display) > 0) {
+ XEvent xevent{ 0 };
XNextEvent(x11_display, &xevent);
if (xevent.type == ConfigureNotify) {
_window_changed(&xevent);
- } else if (xevent.type == MapNotify) {
- // Have we failed to set fullscreen while the window was unmapped?
- _validate_mode_on_map(main_window);
+ } else {
+ // Don't discard this event, we must resend it...
+ 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);
_update_real_mouse_position(windows[MAIN_WINDOW_ID]);