[vlc-devel] [PATCH] qt: fix automatic resize on X11 with HiDPI

Pierre Lamot pierre at videolabs.io
Wed Nov 15 16:09:28 CET 2017


---
 modules/gui/qt/main_interface.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 29d495c15d..6d6ec219c7 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1299,6 +1299,11 @@ void MainInterface::resizeWindow(int w, int h)
 #if ! HAS_QT510 && defined(QT5_HAS_X11)
     if( QX11Info::isPlatformX11() )
     {
+#if HAS_QT56
+        qreal dpr = devicePixelRatioF();
+#else
+        qreal dpr = devicePixelRatio();
+#endif
         QSize size(w, h);
         size = size.boundedTo(maximumSize()).expandedTo(minimumSize());
         /* X11 window managers are not required to accept geometry changes on
@@ -1308,8 +1313,8 @@ void MainInterface::resizeWindow(int w, int h)
          * request until the ConfigureNotify event on success
          * and not at all if it is rejected. */
         XMoveResizeWindow( QX11Info::display(), winId(),
-                          geometry().x(), geometry().y(),
-                          (unsigned int)size.width(), (unsigned int)size.height());
+                          geometry().x() * dpr, geometry().y() * dpr,
+                          (unsigned int)size.width() * dpr, (unsigned int)size.height() * dpr);
         return;
     }
 #endif
-- 
2.14.1



More information about the vlc-devel mailing list