From afdbbcc44f5e140f64b0de4cc3eff9be3b5142d4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 8 Feb 2025 14:09:54 +0100 Subject: Don't enable full screen until MapNotify Modern mutter (GNOME's window manager) has an internal race condition where changing state early is unreliable. Waiting for the MapNotify seems to get us past the unreliable zone. --- vncviewer/DesktopWindow.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 2bf63b8f..d54a92b3 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -222,14 +222,6 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, // Adjust layout now that we're visible and know our final size repositionWidgets(); - if (delayedFullscreen) { - // Hack: Fullscreen requests may be ignored, so we need a timeout for - // when we should stop waiting. We also really need to wait for the - // resize, which can come after the fullscreen event. - Fl::add_timeout(0.5, handleFullscreenTimeout, this); - fullscreen_on(); - } - // Throughput graph for debugging if (vlog.getLevel() >= LogWriter::LEVEL_DEBUG) { memset(&stats, 0, sizeof(stats)); @@ -947,6 +939,19 @@ int DesktopWindow::fltkDispatch(int event, Fl_Window *win) } break; + case FL_SHOW: + // In this particular place, FL_SHOW means an actual MapNotify, + // which means we can continue enabling initial fullscreen. + if (dw->delayedFullscreen) { + // Hack: Fullscreen requests may be ignored, so we need a + // timeout for when we should stop waiting. We also really need + // to wait for the resize, which can come after the fullscreen + // event. + Fl::add_timeout(0.5, handleFullscreenTimeout, dw); + dw->fullscreen_on(); + } + break; + case FL_RELEASE: // We usually fail to grab the mouse if a mouse button was // pressed when we gained focus (e.g. clicking on our window), -- cgit v1.2.3