From 7e9d58705c550af692faa646751094a6ae0beaf5 Mon Sep 17 00:00:00 2001 From: Benoit du Payrat Date: Mon, 4 Jul 2016 16:12:07 +0200 Subject: [PATCH] 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 --- 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 b4bf2be81f..60800b4cf9 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() ); } -- 2.11.4.GIT