[vlc-commits] qt: Restore window size & position when leaving fullscreen

Hugo Beauzée-Luyssen git at videolan.org
Wed Jan 18 19:05:50 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Jan 18 19:04:13 2017 +0100| [f1614cf49166a303a1d2190a94d97c2214fe0e92] | committer: Hugo Beauzée-Luyssen

qt: Restore window size & position when leaving fullscreen

Based on the issue reporter's patch
Fix #11691

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

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

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 894da7a..747e654 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -814,7 +814,9 @@ void MainInterface::setVideoFullScreen( bool fs )
         /* To be sure window is on proper-screen in xinerama */
         if( !screenres.contains( pos() ) )
         {
-            msg_Dbg( p_intf, "Moving video to correct screen");
+            lastWinPosition = pos();
+            lastWinSize = size();
+            msg_Dbg( p_intf, "Moving video to correct position");
             move( QPoint( screenres.x(), screenres.y() ) );
         }
 
@@ -830,10 +832,16 @@ void MainInterface::setVideoFullScreen( bool fs )
     }
     else
     {
-        /* TODO do we want to restore screen and position ? (when
-         * qt-fullscreen-screennumber is forced) */
         setMinimalView( b_minimalView );
         setInterfaceFullScreen( b_interfaceFullScreen );
+        if( lastWinPosition.isNull() == false )
+        {
+            move( lastWinPosition );
+            resize( lastWinSize );
+            lastWinPosition = QPoint();
+            lastWinSize = QSize();
+        }
+
     }
     videoWidget->sync();
 }
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index 02c0fd9..7c396ea 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -156,6 +156,8 @@ protected:
 
     /* Status and flags */
     QWidget             *stackCentralOldWidget;
+    QPoint              lastWinPosition;
+    QSize               lastWinSize;  /// To restore the same window size when leaving fullscreen
 
     QMap<QWidget *, QSize> stackWidgetsSizes;
 



More information about the vlc-commits mailing list