[vlc-commits] Qt: video returns to maximized state from full screen

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


vlc | branch: master | BenoitDuPayrat <benoit at videolabs.io> | Mon Jul  4 16:25:58 2016 +0200| [236368591759c74410cb5903dd1d0940120d4275] | committer: Jean-Baptiste Kempf

Qt: video returns to maximized state from full screen

A boolean is used to memorize whether the window was maximized before entering fullscreen.
The state is correctly restored when leaving fullscreen.

Close #3851

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

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

 modules/gui/qt/main_interface.cpp |   22 ++++++++++++++++++++++
 modules/gui/qt/main_interface.hpp |    1 +
 2 files changed, 23 insertions(+)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index c9612df..b4bf2be 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -106,6 +106,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     b_interfaceFullScreen= false;
     b_hasPausedWhenMinimized = false;
     i_kc_offset          = false;
+    b_maximizedView      = false;
 
     /* Ask for Privacy */
     FirstRun::CheckAndRun( this, p_intf );
@@ -1369,6 +1370,27 @@ void MainInterface::changeEvent(QEvent *event)
         Qt::WindowStates newState = windowState();
         Qt::WindowStates oldState = windowStateChangeEvent->oldState();
 
+        /* b_maximizedView stores if the window was maximized before entering fullscreen.
+         * It is set when entering maximized mode, unset when leaving it to normal mode.
+         * Upon leaving full screen, if b_maximizedView is set,
+         * the window should be maximized again. */
+        if( newState & Qt::WindowMaximized &&
+            !( oldState & Qt::WindowMaximized ) )
+            b_maximizedView = true;
+
+        if( !( newState & Qt::WindowMaximized ) &&
+            oldState & Qt::WindowMaximized &&
+            !b_videoFullScreen )
+            b_maximizedView = false;
+
+        if( !( newState & Qt::WindowFullScreen ) &&
+            oldState & Qt::WindowFullScreen &&
+            b_maximizedView )
+        {
+            showMaximized();
+            return;
+        }
+
         if( newState & Qt::WindowMinimized )
         {
             b_hasPausedWhenMinimized = false;
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index dcf6cc9..18ab8ce 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -170,6 +170,7 @@ private:
     bool                 b_minimalView;         ///< Minimal video
     bool                 b_interfaceFullScreen;
     bool                 b_pauseOnMinimize;
+    bool                 b_maximizedView;
 
     /* States */
     bool                 playlistVisible;       ///< Is the playlist visible ?



More information about the vlc-commits mailing list