Parcourir la source

Fix resolution when returning from fullscreen on OSX

Before these lines when return from fullscreen on OSX it always
returned to a window that was as big as the fullscreen. That was
because on windows we had to instruct it to scale the content to
max width. On OSX we need to instruct it what the size should be
when we return to windowed mode instead.

Did I say that I love cross-platform stuff and fullscreen. It's great.
Tobias Hieta il y a 9 ans
Parent
commit
434e64dafe
1 fichiers modifiés avec 13 ajouts et 8 suppressions
  1. 13 8
      src/ui/KonvergoWindow.cpp

+ 13 - 8
src/ui/KonvergoWindow.cpp

@@ -70,15 +70,8 @@ KonvergoWindow::KonvergoWindow(QWindow* parent) : QQuickWindow(parent), m_debugL
 
 #ifdef KONVERGO_OPENELEC
   setVisibility(QWindow::FullScreen);
-#elif !defined(Q_OS_MAC)
-  updateFullscreenState(false);
 #else
-  // this is such a hack. But I could not get it to enter into fullscreen
-  // mode if I didn't trigger this after a while.
-  //
-  QTimer::singleShot(500, [=]() {
-    updateFullscreenState(false);
-  });
+  updateFullscreenState(false);
 #endif
 
   emit enableVideoWindowSignal();
@@ -139,7 +132,19 @@ void KonvergoWindow::loadGeometry()
   if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fullscreen").toBool())
   {
     QLOG_DEBUG() << "Load FullScreen geo...";
+
+    // On OSX we need to set the geometry to the size we want when we
+    // return from fullscreen otherwise when we exit fullscreen it
+    // will stay small or big. On Windows we need to set it to max
+    // resolution for the screen (i.e. fullscreen) otherwise it will
+    // just scale the webcontent to the minimum size we have defined
+    //
+#ifdef Q_OS_MAC
+    setGeometry(rc);
+#else
     setGeometry(myScreen->geometry());
+#endif
+    
     setScreen(myScreen);
   }
   else