[vlc-devel] [PATCH] Qt: videos can no longer be larger than the screen

BenoitDuPayrat benoit at videolabs.io
Mon Jun 27 10:25:10 CEST 2016


Ticket #7641
Prevents resizing to larger than the screen resolution.
This fixes a bug where the window resizing would not grow larger than the screen but the video widget would.
---
 modules/gui/qt/main_interface.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index f30b10d..08c86bd 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -785,7 +785,29 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h )
          * will always get called.
          */
         if (b_autoresize)
+        {
+            QRect screen = QApplication::desktop()->availableGeometry();
+            if( h > screen.height() )
+            {
+                w = screen.width();
+                h = screen.height();
+                if( !b_minimalView )
+                {
+                    if( menuBar()->isVisible() )
+                        h -= menuBar()->height();
+                    if( controls->isVisible() )
+                        h -= controls->height();
+                    if( statusBar()->isVisible() )
+                        h -= statusBar()->height();
+                    if( inputC->isVisible() )
+                        h -= inputC->height();
+                }
+                h -= style()->pixelMetric(QStyle::PM_TitleBarHeight);
+                h -= style()->pixelMetric(QStyle::PM_LayoutBottomMargin);
+                h -= 2 * style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+            }
             videoWidget->setSize( w, h );
+        }
         else
             videoWidget->setSize( videoWidget->width(), videoWidget->height() );
     }
-- 
2.8.1



More information about the vlc-devel mailing list