From: Pierre Ossman Date: Thu, 2 Sep 2021 14:51:03 +0000 (+0200) Subject: Merge branch 'fullscreens-added-removed' of https://github.com/x11clone/x11clone X-Git-Tag: v1.11.90~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=238a309aa1a94cb19fd1c364a58f40dec38d49b6;p=tigervnc.git Merge branch 'fullscreens-added-removed' of https://github.com/x11clone/x11clone --- 238a309aa1a94cb19fd1c364a58f40dec38d49b6 diff --cc vncviewer/DesktopWindow.cxx index 7936deb7,f0aae11a..ef023a5b --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@@ -832,14 -690,30 +849,36 @@@ int DesktopWindow::fltkHandle(int event { int ret; + // FLTK keeps spamming bogus FL_MOVE events if _any_ X event is + // received with the mouse pointer outside our windows + // https://github.com/fltk/fltk/issues/76 + if ((event == FL_MOVE) && (win == NULL)) + return 0; + ret = Fl::handle_(event, win); + switch (event) { + case FL_SCREEN_CONFIGURATION_CHANGED: + // Screens removed or added. Recreate fullscreen window if + // necessary. On Windows, adding a second screen only works + // reliable if we are using a timer. Otherwise, the window will + // not be resized to cover the new screen. A timer makes sense + // also on other systems, to make sure that whatever desktop + // environment has a chance to deal with things before we do. + // Please note that when using FullscreenSystemKeys on macOS, the + // display configuration cannot be changed: macOS will not detect + // added or removed screens and there will be no + // FL_SCREEN_CONFIGURATION_CHANGED event. This is by design: + // "When you capture a display, you have exclusive use of the + // display. Other applications and system services are not allowed + // to use the display or change its configuration. In addition, + // they are not notified of display changes" + if (staticSelf->fullscreen_active()) { + Fl::remove_timeout(reconfigureFullscreen, staticSelf); + Fl::add_timeout(0.5, reconfigureFullscreen, staticSelf); + } + } + // This is hackish and the result of the dodgy focus handling in FLTK. // The basic problem is that FLTK's view of focus and the system's tend // to differ, and as a result we do not see all the FL_FOCUS events we