Browse Source

KonvergoWindow: fix toggling fullscreen with external WM commands

At least on Linux, a WM can change the fullscreen state of a Window.
This didn't resize the window correctly, because loadGeometry() uses the
fullscreen setting, which was updated after calling loadGeometry(). Fix
this by swapping the code blocks around and updating the fullscreen
setting before calling loadGeometry().
Vincent Lang 8 years ago
parent
commit
2299576aee
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/ui/KonvergoWindow.cpp

+ 9 - 9
src/ui/KonvergoWindow.cpp

@@ -389,6 +389,15 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 {
   QLOG_DEBUG() << (visibility == QWindow::FullScreen ? "FullScreen" : "Windowed") << "visbility set to " << visibility;
 
+  if (visibility == QWindow::FullScreen || visibility == QWindow::Windowed)
+  {
+    m_ignoreFullscreenSettingsChange++;
+    ScopedDecrementer decrement(&m_ignoreFullscreenSettingsChange);
+
+    bool fs = visibility == QWindow::FullScreen;
+    SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", fs);
+  }
+
   if (visibility == QWindow::Windowed)
   {
     loadGeometry();
@@ -405,15 +414,6 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 #endif
   }
 
-  if (visibility == QWindow::FullScreen || visibility == QWindow::Windowed)
-  {
-    m_ignoreFullscreenSettingsChange++;
-    ScopedDecrementer decrement(&m_ignoreFullscreenSettingsChange);
-
-    bool fs = visibility == QWindow::FullScreen;
-    SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", fs);
-  }
-
   if (visibility == QWindow::Minimized)
     InputComponent::Get().cancelAutoRepeat();