From: ThorstenB Date: Mon, 26 Nov 2012 23:02:28 +0000 (+0100) Subject: Base fullscreen detection on window decoration X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=57410852b92f65603e246f549683ff9a0c85cf24;p=flightgear.git 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. --- 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