From 57410852b92f65603e246f549683ff9a0c85cf24 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Tue, 27 Nov 2012 00:02:28 +0100 Subject: [PATCH] Base fullscreen detection on window decoration rather than window size, since the size of full screen windows can change: e.g. Xinerama mode automatically resizes fullscreen windows to cover the area belonging to a single display only - so the "(Xinerama) screen area == window size" check always failed - even in fullscreen mode. --- src/Viewer/fg_os_osgviewer.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Viewer/fg_os_osgviewer.cxx b/src/Viewer/fg_os_osgviewer.cxx index d08b79237..196f63426 100644 --- a/src/Viewer/fg_os_osgviewer.cxx +++ b/src/Viewer/fg_os_osgviewer.cxx @@ -345,10 +345,17 @@ void fgOSFullScreen() int height; window->getWindowRectangle(x, y, width, height); - bool isFullScreen = x == 0 && y == 0 && width == (int)screenWidth && height == (int)screenHeight; + /* Note: the simple "is window size == screen size" check to detect full screen state doesn't work with + * X screen servers in Xinerama mode, since the reported screen width (or height) exceeds the maximum width + * (or height) usable by a single window (Xserver automatically shrinks/moves the full screen window to fit a + * single display) - so we detect full screen mode using "WindowDecoration" state instead. + * "false" - even when a single window is display in fullscreen */ + //bool isFullScreen = x == 0 && y == 0 && width == (int)screenWidth && height == (int)screenHeight; + bool isFullScreen = !window->getWindowDecoration(); SG_LOG(SG_VIEW, SG_DEBUG, "Toggling fullscreen. Previous window rectangle (" - << x << ", " << y << ") x (" << width << ", " << height << "), fullscreen: " << isFullScreen); + << x << ", " << y << ") x (" << width << ", " << height << "), fullscreen: " << isFullScreen + << ", number of screens: " << wsi->getNumScreens()); if (isFullScreen) { // limit x,y coordinates and window size to screen area -- 2.39.5