vlc_linux/vlc-3.0.16/modules/gui/qt/main_interface.cpp
// The provided size is in physical pixels, coming from the core.
The provided size is in physical pixels, coming from the core.
The provided size is in physical pixels coming from the core .
void MainInterface::setVideoSize( unsigned int w, unsigned int h )
{
    if (!isFullScreen() && !isMaximized() )
    {
        if (b_autoresize)
        {
            QRect screen = QApplication::desktop()->availableGeometry();
#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();
                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);
            }
            else
            {
                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
            videoWidget->setSize( videoWidget->width(), videoWidget->height() );
    }
}
void MainInterface :: setVideoSize ( unsigned int w , unsigned int h ) { if ( ! isFullScreen ( ) && ! isMaximized ( ) ) { if ( b_autoresize ) { QRect screen = QApplication :: desktop ( ) -> availableGeometry ( ) ; #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 ( ) ; 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 ) ; } else { w = qRound ( ( float ) w / factor ) ; h = qRound ( ( float ) h / factor ) ; msg_Dbg ( p_intf , " " , w , h ) ; } videoWidget -> setSize ( w , h ) ; } else videoWidget -> setSize ( videoWidget -> width ( ) , videoWidget -> height ( ) ) ; } }
The provided size is in physical pixels, coming from the core.
The provided size is in physical pixels coming from the core .
/* 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.
         */ // Convert the size in logical pixels