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

BenoitDuPayrat git at videolan.org
Mon Jul 4 19:27:51 CEST 2016


vlc | branch: master | BenoitDuPayrat <benoit at videolabs.io> | Mon Jul  4 16:12:07 2016 +0200| [c03a0c755cb6d510a231e8bf8bfcbfd5a9deb54f] | committer: Jean-Baptiste Kempf

Qt: videos can no longer be larger than the screen

If an attempt is made to resize the video widget to a size larger than the screen,
it will be resized to a sensible size, filling the screen instead.

Close #12852

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c03a0c755cb6d510a231e8bf8bfcbfd5a9deb54f
---

 modules/gui/qt/main_interface.cpp |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index b4bf2be..60800b4 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -784,9 +784,33 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h )
         /* Resize video widget to video size, or keep it at the same
          * size. Call setSize() either way so that vout_window_ReportSize
          * will always get called.
+         * If the video size is too large for the screen, resize it
+         * to the screen size.
          */
         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() );
     }



More information about the vlc-commits mailing list