]> git.mxchange.org Git - flightgear.git/commitdiff
Base fullscreen detection on window decoration
authorThorstenB <brehmt@gmail.com>
Mon, 26 Nov 2012 23:02:28 +0000 (00:02 +0100)
committerThorstenB <brehmt@gmail.com>
Mon, 26 Nov 2012 23:02:28 +0000 (00:02 +0100)
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

index d08b7923784326e918d6fc2acf6e89912ee8ecab..196f634260a7047ff04be2a7cf8554c78fede3e1 100644 (file)
@@ -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