diff options
author | MatthewZelriche <67518084+MatthewZelriche@users.noreply.github.com> | 2022-08-30 08:35:19 -0600 |
---|---|---|
committer | MatthewZelriche <67518084+MatthewZelriche@users.noreply.github.com> | 2022-09-01 07:42:03 -0600 |
commit | 91ba9bcb03d3d8da8772a75585f1e08c4f339108 (patch) | |
tree | 1883b22eb325a825e8110caf8a74eb51a4f475b8 /platform/linuxbsd/display_server_x11.cpp | |
parent | 728785d5328172acd4cc4b182914aea5d234fea4 (diff) |
Fix dropped XEvents early in main window lifetime.
The DisplayServerX11 constructor processes pending events shortly
after constructing the main window. However, it discards pending events
on the event queue that it is not interested in. This results in these
events never making it to the main events thread and as a result are
never processed. We need to save the events we don't handle in
DisplayServerX11 so that they can be resent for later handling by the
events thread.
Diffstat (limited to 'platform/linuxbsd/display_server_x11.cpp')
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 0d619904bc..de92d7a75b 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -4991,17 +4991,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]); |