]> git.mxchange.org Git - flightgear.git/commitdiff
toggle fullscreen: also adapt GUI plane when resizing
authorThorstenB <brehmt@gmail.com>
Sat, 17 Nov 2012 23:00:15 +0000 (00:00 +0100)
committerThorstenB <brehmt@gmail.com>
Sat, 17 Nov 2012 23:00:15 +0000 (00:00 +0100)
src/Viewer/fg_os_osgviewer.cxx

index 6d18862b40b2d13710f5e375db8b37f329b2684d..d08b7923784326e918d6fc2acf6e89912ee8ecab 100644 (file)
@@ -351,14 +351,17 @@ void fgOSFullScreen()
                << x << ", " << y << ") x (" << width << ", " << height << "), fullscreen: " << isFullScreen);
         if (isFullScreen)
         {
-            // disable fullscreen mode, restore previous window size/coordinates
-            window->setWindowDecoration(true);
             // limit x,y coordinates and window size to screen area
             if (previous_x + previous_width > (int)screenWidth)
                 previous_x = 0;
             if (previous_y + previous_height > (int)screenHeight)
                 previous_y = 0;
-            window->setWindowRectangle(previous_x, previous_y, previous_width, previous_height);
+
+            // disable fullscreen mode, restore previous window size/coordinates
+            x = previous_x;
+            y = previous_y;
+            width = previous_width;
+            height = previous_height;
         }
         else
         {
@@ -368,11 +371,20 @@ void fgOSFullScreen()
             previous_width = width;
             previous_height = height;
 
-            // enable fullscreen
-            window->setWindowDecoration(false);
-            window->setWindowRectangle(0, 0, screenWidth, screenHeight);
+            // enable fullscreen mode, set new width/height
+            x = 0;
+            y = 0;
+            width = screenWidth;
+            height = screenHeight;
         }
 
+        // set xsize/ysize properties to adapt GUI planes
+        fgSetInt("/sim/startup/xsize", width);
+        fgSetInt("/sim/startup/ysize", height);
+
+        // reconfigure window
+        window->setWindowDecoration(isFullScreen);
+        window->setWindowRectangle(x, y, width, height);
         window->grabFocusIfPointerInWindow();
     }
 }