Browse Source

Remove all host scaling

Vincent Lang 7 years ago
parent
commit
cfb4da0c17
3 changed files with 2 additions and 124 deletions
  1. 1 71
      src/ui/KonvergoWindow.cpp
  2. 0 27
      src/ui/KonvergoWindow.h
  3. 1 26
      src/ui/webview.qml

+ 1 - 71
src/ui/KonvergoWindow.cpp

@@ -39,7 +39,6 @@ public:
 KonvergoWindow::KonvergoWindow(QWindow* parent) :
   QQuickWindow(parent),
   m_debugLayer(false),
-  m_lastWindowScale(-1), m_lastWebScale(-1), m_tvUIw(-1), m_tvUIh(-1),
   m_ignoreFullscreenSettingsChange(0),
   m_showedUpdateDialog(false),
   m_osxPresentationOptions(0),
@@ -73,7 +72,6 @@ KonvergoWindow::KonvergoWindow(QWindow* parent) :
 #endif
 
   QRect loadedGeo = loadGeometry();
-  updateSizeDependendProperties(loadedGeo.size());
 
   connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated,
           this, &KonvergoWindow::updateMainSectionSettings);
@@ -421,9 +419,6 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
         {
           PlayerComponent::Get().stop();
           m_webDesktopMode = newDesktopMode;
-          auto s = size();
-          QLOG_DEBUG() << "compute scale for mode switch" << s;
-          updateSizeDependendProperties(s);
           emit webDesktopModeChanged();
           emit webUrlChanged();
 
@@ -580,7 +575,6 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 #endif
 
   InputComponent::Get().cancelAutoRepeat();
-  updateSizeDependendProperties(size());
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -659,47 +653,6 @@ void KonvergoWindow::toggleDebug()
   }
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-void KonvergoWindow::updateSizeDependendProperties(const QSize& size)
-{
-  m_eventRecursionDepth++;
-  ScopedDecrementer decrement(&m_eventRecursionDepth);
-  if (m_eventRecursionDepth > MAX_RECURSION_DEPTH)
-  {
-    QLOG_ERROR() << "Maximum recursion depth reached! (updateSizeDependendProperties)";
-    return;
-  }
-
-  qreal windowScale = CalculateScale(size);
-  if (windowScale != m_lastWindowScale)
-  {
-    m_lastWindowScale = windowScale;
-    emit windowScaleChanged();
-  }
-
-  qreal webScale = CalculateWebScale(size, devicePixelRatio());
-  if (webScale != m_lastWebScale)
-  {
-    m_lastWebScale = webScale;
-    emit SystemComponent::Get().updateScale(webScale);
-    emit webScaleChanged();
-  }
-
-  qreal tvW = qRound64(qMin((qreal)(size.height() * 16) / 9, (qreal)size.width()));
-  if (tvW != m_tvUIw)
-  {
-    m_tvUIw = tvW;
-    emit tvUIWidthChanged();
-  }
-
-  qreal tvH = qRound64(qMin((qreal)(size.width() * 9) / 16, (qreal)size.height()));
-  if (tvH != m_tvUIh)
-  {
-    m_tvUIh = tvH;
-    emit tvUIHeightChanged();
-  }
-}
-
 /////////////////////////////////////////////////////////////////////////////////////////
 void KonvergoWindow::resizeEvent(QResizeEvent* event)
 {
@@ -729,32 +682,9 @@ void KonvergoWindow::resizeEvent(QResizeEvent* event)
   }
   #endif
 
-  updateSizeDependendProperties(event->size());
   QQuickWindow::resizeEvent(event);
 }
 
-/////////////////////////////////////////////////////////////////////////////////////////
-#define ROUND(x) (qRound(x * 1000) / 1000.0)
-
-/////////////////////////////////////////////////////////////////////////////////////////
-qreal KonvergoWindow::CalculateScale(const QSize& size)
-{
-  qreal horizontalScale = (qreal)size.width() / (qreal)WEBUI_SIZE.width();
-  qreal verticalScale = (qreal)size.height() / (qreal)WEBUI_SIZE.height();
-  return ROUND(qMin(horizontalScale, verticalScale));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-qreal KonvergoWindow::CalculateWebScale(const QSize& size, qreal devicePixelRatio)
-{
-  qreal horizontalScale = (qreal)size.width() / (qreal)WEBUI_SIZE.width();
-  qreal verticalScale = (qreal)size.height() / (qreal)WEBUI_SIZE.height();
-
-  qreal minScale = qMin(horizontalScale, qMin(verticalScale, (qreal)(WEBUI_MAX_HEIGHT / devicePixelRatio) / (qreal)WEBUI_SIZE.height()));
-  qreal minWinScale = 240.0 / (qreal)WEBUI_SIZE.height();
-  return ROUND(qMax(minWinScale, minScale));
-}
-
 /////////////////////////////////////////////////////////////////////////////////////////
 QScreen* KonvergoWindow::loadLastScreen()
 {
@@ -782,7 +712,7 @@ QString KonvergoWindow::webUrl()
   if (m_webDesktopMode)
     return url;
 
-  return url + QString("?initialScale=%0").arg(webScale());
+  return url + QString("?initialScale=%0").arg(1);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////

+ 0 - 27
src/ui/KonvergoWindow.h

@@ -29,15 +29,10 @@ class KonvergoWindow : public QQuickWindow
   Q_PROPERTY(bool showDebugLayer MEMBER m_debugLayer NOTIFY debugLayerChanged)
   Q_PROPERTY(QString debugInfo MEMBER m_debugInfo NOTIFY debugInfoChanged)
   Q_PROPERTY(QString videoInfo MEMBER m_videoInfo NOTIFY debugInfoChanged)
-  Q_PROPERTY(qreal webScale READ webScale NOTIFY webScaleChanged)
-  Q_PROPERTY(qreal webHeightMax READ webHeightMax CONSTANT)
-  Q_PROPERTY(qreal windowScale READ windowScale NOTIFY windowScaleChanged)
   Q_PROPERTY(QSize windowMinSize READ windowMinSize CONSTANT)
   Q_PROPERTY(bool alwaysOnTop READ isAlwaysOnTop WRITE setAlwaysOnTop)
   Q_PROPERTY(bool webDesktopMode MEMBER m_webDesktopMode NOTIFY webDesktopModeChanged)
   Q_PROPERTY(QString webUrl READ webUrl NOTIFY webUrlChanged)
-  Q_PROPERTY(qreal tvUIWidth READ tvUIWidth NOTIFY tvUIWidthChanged)
-  Q_PROPERTY(qreal tvUIHeight READ tvUIHeight NOTIFY tvUIHeightChanged)
 
 public:
   static void RegisterClass();
@@ -91,34 +86,17 @@ public:
       setVisibility(QWindow::Minimized);
   }
 
-  qreal windowScale() { return m_lastWindowScale; }
-  qreal webScale() { return m_lastWebScale; }
-  qreal webHeightMax() { return WEBUI_MAX_HEIGHT; }
   QSize windowMinSize() { return WINDOWW_MIN_SIZE; }
   QString webUrl();
 
-  qreal tvUIWidth()
-  {
-    return m_tvUIw;
-  }
-
-  qreal tvUIHeight()
-  {
-    return m_tvUIh;
-  }
-
 Q_SIGNALS:
   void fullScreenSwitched();
-  void webScaleChanged();
-  void windowScaleChanged();
   void enableVideoWindowSignal();
   void debugLayerChanged();
   void debugInfoChanged();
   void reloadWebClient();
   void webDesktopModeChanged();
   void webUrlChanged();
-  void tvUIWidthChanged();
-  void tvUIHeightChanged();
 
 protected:
   void focusOutEvent(QFocusEvent* ev) override;
@@ -138,7 +116,6 @@ private slots:
   void updateCurrentScreen();
 
 private:
-  void updateSizeDependendProperties(const QSize& size);
   void saveGeometry();
   QRect loadGeometry();
   QRect loadGeometryRect();
@@ -149,7 +126,6 @@ private:
   QScreen* findCurrentScreen();
 
   bool m_debugLayer;
-  qreal m_lastWindowScale, m_lastWebScale, m_tvUIw, m_tvUIh;
   QTimer* m_infoTimer;
   QString m_debugInfo, m_systemDebugInfo, m_videoInfo;
   int m_ignoreFullscreenSettingsChange;
@@ -162,9 +138,6 @@ private:
   int m_eventRecursionDepth;
 
   void setWebMode(bool newDesktopMode, bool fullscreen);
-
-  static qreal CalculateScale(const QSize& size);
-  static qreal CalculateWebScale(const QSize& size, qreal devicePixelRatio);
 };
 
 #endif // KONVERGOWINDOW_H

+ 1 - 26
src/ui/webview.qml

@@ -125,11 +125,6 @@ KonvergoWindow
     id: action_redo
   }
 
-  function maxWebScale()
-  {
-    return webHeightMax ? ((webHeightMax / Screen.devicePixelRatio) / 720) : 10;
-  }
-
   MpvVideo
   {
     id: video
@@ -154,24 +149,7 @@ KonvergoWindow
     onLinkHovered: web.currentHoveredUrl = hoveredUrl
     width: mainWindow.width
     height: mainWindow.height
-
-    scale:
-    {
-      if (mainWindow.webDesktopMode)
-      {
-        return 1;
-      }
-      else if (mainWindow.windowScale < mainWindow.maxWebScale())
-      {
-        // Web renders at windows scale, no scaling
-        return 1;
-      }
-      else
-      {
-        // Web should max out at maximum scaling
-        return mainWindow.windowScale / mainWindow.maxWebScale();
-      }
-    }
+    scale: 1
 
     Component.onCompleted:
     {
@@ -292,9 +270,6 @@ KonvergoWindow
         var dbg = mainWindow.debugInfo + "Window and web\n";
         dbg += "  Window size: " + parent.width + "x" + parent.height + " - " + web.width + "x" + web.height + "\n";
         dbg += "  DevicePixel ratio: " + Screen.devicePixelRatio + "\n";
-        dbg += "  Web Max Height: " + (webHeightMax / Screen.devicePixelRatio) + " / Max scale: " + mainWindow.maxWebScale() + "\n";
-        dbg += "  Web scale: " + webScale + " / Window scale: " + windowScale + "\n";
-        dbg += "  Scale applied: " + web.scale + "\n";
 
         return dbg;
       }