[vlc-devel] [PATCH 3/3] Qt: Set proper vout size on hidpi setups.

Anatoliy Anischovich lin.aaa.lin at gmail.com
Sat Jul 30 15:38:35 CEST 2016


---
 modules/gui/qt/components/interface_widgets.cpp | 23 +++++++++++++++++------
 modules/gui/qt/components/interface_widgets.hpp |  3 +++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index db590c5..7ac73b6 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -178,6 +178,21 @@ WId VideoWidget::request( struct vout_window_t *p_wnd, unsigned int *pi_width,
     return stable->winId();
 }
 
+
+void VideoWidget::reportSize( unsigned int w, unsigned int h )
+{
+    if( p_window == NULL )
+        return;
+
+#ifdef HAS_QT56
+    qreal ratio = devicePixelRatioF();
+    w *= ratio;
+    h *= ratio;
+#endif
+
+    vout_window_ReportSize( p_window, w, h );
+}
+
 /* Set the Widget to the correct Size */
 /* Function has to be called by the parent
    Parent has to care about resizing itself */
@@ -188,8 +203,7 @@ void VideoWidget::setSize( unsigned int w, unsigned int h )
      */
     if( (unsigned)size().width() == w && (unsigned)size().height() == h )
     {
-        if( p_window != NULL )
-            vout_window_ReportSize( p_window, w, h );
+        reportSize( w, h );
         return;
     }
 
@@ -207,10 +221,7 @@ void VideoWidget::setSize( unsigned int w, unsigned int h )
 
 void VideoWidget::resizeEvent( QResizeEvent *event )
 {
-    if( p_window != NULL )
-        vout_window_ReportSize( p_window, event->size().width(),
-                                event->size().height() );
-
+    reportSize( event->size().width(), event->size().height() );
     QWidget::resizeEvent( event );
 }
 
diff --git a/modules/gui/qt/components/interface_widgets.hpp b/modules/gui/qt/components/interface_widgets.hpp
index a07119e..c1ff2d5 100644
--- a/modules/gui/qt/components/interface_widgets.hpp
+++ b/modules/gui/qt/components/interface_widgets.hpp
@@ -77,6 +77,9 @@ private:
 
     QWidget *stable;
     QLayout *layout;
+
+    void reportSize( unsigned int, unsigned int );
+
 signals:
     void sizeChanged( int, int );
 
-- 
2.7.3



More information about the vlc-devel mailing list