Parcourir la source

KonvergoWindow: fix some more resize issues

The webScaleChanged signal does not only affect webScale. Who would have
thought? It's needed for normal resize events too. So remove the signal
from notifyScale() (where it's evidently useless), and emit it on every
potential size change. Also, the return value of some properties which
use "NOTIFY webScaleChanged" depend on other stuff, like the desktop
mode, so move the signal emission to until after all these things have
changed.
Vincent Lang il y a 8 ans
Parent
commit
fad0a1526f
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      src/ui/KonvergoWindow.cpp

+ 6 - 2
src/ui/KonvergoWindow.cpp

@@ -59,6 +59,7 @@ KonvergoWindow::KonvergoWindow(QWindow* parent) :
 
   QRect loadedGeo = loadGeometry();
   notifyScale(loadedGeo.size());
+  emit webScaleChanged();
 
   connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated,
           this, &KonvergoWindow::updateMainSectionSettings);
@@ -365,6 +366,7 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
       m_webDesktopMode = newDesktopMode;
       emit webDesktopModeChanged();
       emit webUrlChanged();
+      emit webScaleChanged();
     }
     else
     {
@@ -380,12 +382,13 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
       SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", fullscreen);
       QTimer::singleShot(0, [=]
       {
+        m_webDesktopMode = newDesktopMode;
         auto s = size();
         QLOG_DEBUG() << "compute scale for mode switch" << s;
         notifyScale(s);
-        m_webDesktopMode = newDesktopMode;
         emit webDesktopModeChanged();
         emit webUrlChanged();
+        emit webScaleChanged();
 
         if (m_webDesktopMode)
           SystemComponent::Get().setCursorVisibility(true);
@@ -544,6 +547,7 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 
   InputComponent::Get().cancelAutoRepeat();
   notifyScale(size());
+  emit webScaleChanged();
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -632,7 +636,6 @@ void KonvergoWindow::notifyScale(const QSize& size)
     m_lastWindowScale = windowScale;
     m_lastWebScale = webScale;
     emit SystemComponent::Get().updateScale(webScale);
-    emit webScaleChanged();
   }
 }
 
@@ -666,6 +669,7 @@ void KonvergoWindow::resizeEvent(QResizeEvent* event)
   #endif
 
   notifyScale(event->size());
+  emit webScaleChanged();
   QQuickWindow::resizeEvent(event);
 }