Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
2299576aee
1 zmenil súbory, kde vykonal 9 pridanie a 9 odobranie
  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();