浏览代码

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 年之前
父节点
当前提交
2299576aee
共有 1 个文件被更改,包括 9 次插入9 次删除
  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();