summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-05 07:51:10 +0200
committerGitHub <noreply@github.com>2022-09-05 07:51:10 +0200
commitcaa5e889123ffa0893196703f1ae4ad17a302f90 (patch)
tree6b8bd1ae7d9ec06021a578b795977ce7381490c5
parente7a0a97c0bc5d86644e62d537503e3b05313a01c (diff)
parentef02f06b8c6153abdf42ae93dbcbdbf43faa0e4e (diff)
Merge pull request #65343 from MatthewZelriche/XSendEventCrashFix
Fix XSendEvent crash & bootsplash.
-rw-r--r--platform/linuxbsd/display_server_x11.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 607c583df8..c619e8eceb 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -4900,6 +4900,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
}
show_window(main_window);
+ XSync(x11_display, False);
+ _validate_mode_on_map(main_window);
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
@@ -5046,24 +5048,13 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
cursor_set_shape(CURSOR_BUSY);
- Vector<XEvent> save_events;
- while (XPending(x11_display) > 0) {
- XEvent xevent{ 0 };
- XNextEvent(x11_display, &xevent);
- if (xevent.type == ConfigureNotify) {
- _window_changed(&xevent);
- } 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);
+ // Search the X11 event queue for ConfigureNotify events and process all
+ // that are currently queued early, so we can get the final window size
+ // for correctly drawing of the bootsplash.
+ XEvent config_event;
+ while (XCheckTypedEvent(x11_display, ConfigureNotify, &config_event)) {
+ _window_changed(&config_event);
}
-
events_thread.start(_poll_events_thread, this);
_update_real_mouse_position(windows[MAIN_WINDOW_ID]);