vlc | branch: master | Romain Vimont <ro...@videolabs.io> | Fri Apr 13 18:37:19 
2018 +0200| [6d2b1762d241cae069ad35c4ba390b789b271205] | committer: 
Jean-Baptiste Kempf

qt: postpone resize if fullscreen is enabled

Starting a video may resize the window (if autoresize is enabled). If
the video is started fullscreen, however, the window is not resized, so
its size is unexpected once fullscreen is disabled.

The initial fullscreen mode should not prevent autoresize, so resize the
window when disabling fullscreen.

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

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

 modules/gui/qt/main_interface.cpp | 13 +++++++++++--
 modules/gui/qt/main_interface.hpp |  9 ++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp 
b/modules/gui/qt/main_interface.cpp
index e3b76ee228..b5a5724f18 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -915,9 +915,18 @@ void MainInterface::setVideoFullScreen( bool fs )
         if( lastWinPosition.isNull() == false )
         {
             move( lastWinPosition );
-            resizeWindow( lastWinSize.width(), lastWinSize.height() );
             lastWinPosition = QPoint();
-            lastWinSize = QSize();
+            if( !pendingResize.isValid() )
+            {
+                resizeWindow( lastWinSize.width(), lastWinSize.height() );
+                lastWinSize = QSize();
+            }
+        }
+        if( pendingResize.isValid() )
+        {
+            /* apply resize requested while fullscreen was enabled */
+            resizeStack( pendingResize.width(), pendingResize.height() );
+            pendingResize = QSize(); // consume
         }
 
     }
diff --git a/modules/gui/qt/main_interface.hpp 
b/modules/gui/qt/main_interface.hpp
index 5f60d2f307..2fcf2d36e7 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -170,6 +170,8 @@ protected:
     QSize               lastWinSize;  /// To restore the same window size when 
leaving fullscreen
     QScreen             *lastWinScreen;
 
+    QSize               pendingResize; // to be applied when fullscreen is 
disabled
+
     QMap<QWidget *, QSize> stackWidgetsSizes;
 
     /* Flags */
@@ -240,7 +242,12 @@ protected slots:
 
     void resizeStack( int w, int h )
     {
-        if( !isFullScreen() && !isMaximized() && !b_isWindowTiled )
+        if( isFullScreen() )
+        {
+            /* postpone resize, will be applied once fullscreen is disabled */
+            pendingResize = QSize( w, h );
+        }
+        else if( !isMaximized() && !b_isWindowTiled )
         {
             if( b_minimalView )
                 resizeWindow( w, h ); /* Oh yes, it shouldn't

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to