vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Mon Mar 13 11:27:32 2017 +0100| [42d42d676ea7e515c0cc308038c305efe7c63f89] | committer: Hugo Beauzée-Luyssen
qt: Account for DPI scaling when resizing the video widget > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=42d42d676ea7e515c0cc308038c305efe7c63f89 --- modules/gui/qt/main_interface.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp index f44a872..49a59b6 100644 --- a/modules/gui/qt/main_interface.cpp +++ b/modules/gui/qt/main_interface.cpp @@ -769,6 +769,7 @@ void MainInterface::releaseVideoSlot( void ) stackCentralOldWidget = bgWidget; } +// The provided size is in physical pixels, coming from the core. void MainInterface::setVideoSize( unsigned int w, unsigned int h ) { if (!isFullScreen() && !isMaximized() ) @@ -782,7 +783,12 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h ) if (b_autoresize) { QRect screen = QApplication::desktop()->availableGeometry(); - if( h > screen.height() ) +#if HAS_QT56 + float factor = videoWidget->devicePixelRatioF(); +#else + float factor = 1.0f; +#endif + if( (float)h / factor > screen.height() ) { w = screen.width(); h = screen.height(); @@ -801,6 +807,13 @@ void MainInterface::setVideoSize( unsigned int w, unsigned int h ) h -= style()->pixelMetric(QStyle::PM_LayoutBottomMargin); h -= 2 * style()->pixelMetric(QStyle::PM_DefaultFrameWidth); } + else + { + // Convert the size in logical pixels + w = qRound( (float)w / factor ); + h = qRound( (float)h / factor ); + msg_Dbg( p_intf, "Logical video size: %ux%u", w, h ); + } videoWidget->setSize( w, h ); } else _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
