Commit d046eab5 authored by Benoit's avatar Benoit Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7b82f269
......@@ -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;
......
......@@ -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 ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment