Commit 1fe5ac7c authored by COCQUEBERT Cédric's avatar COCQUEBERT Cédric Committed by Jean-Baptiste Kempf

Fix toggling when Video is not embedded

Slight modification by jb
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit fbb04b5b)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 03c979c4
...@@ -1140,12 +1140,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -1140,12 +1140,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
} }
/* Internal wrapper over GetWindowPlacement / SetWindowPlacement */ /* Internal wrapper over GetWindowPlacement */
static void SetWindowState(HWND hwnd, int nShowCmd) static WINDOWPLACEMENT getWindowState(HWND hwnd)
{ {
WINDOWPLACEMENT window_placement; WINDOWPLACEMENT window_placement;
window_placement.length = sizeof(WINDOWPLACEMENT); window_placement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement( hwnd, &window_placement ); GetWindowPlacement( hwnd, &window_placement );
return window_placement;
}
/* Internal wrapper over SetWindowPlacement */
static void SetWindowState(HWND hwnd, int nShowCmd,WINDOWPLACEMENT window_placement)
{
window_placement.showCmd = nShowCmd; window_placement.showCmd = nShowCmd;
SetWindowPlacement( hwnd, &window_placement ); SetWindowPlacement( hwnd, &window_placement );
SetWindowPos( hwnd, 0, 0, 0, 0, 0, SetWindowPos( hwnd, 0, 0, 0, 0, 0,
...@@ -1167,11 +1173,17 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout ) ...@@ -1167,11 +1173,17 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ? HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd; p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
/* Save the current windows placement/placement to restore
when fullscreen is over */
WINDOWPLACEMENT window_placement = getWindowState( hwnd );
p_vout->b_fullscreen = ! p_vout->b_fullscreen; p_vout->b_fullscreen = ! p_vout->b_fullscreen;
/* We want to go to Fullscreen */
if( p_vout->b_fullscreen ) if( p_vout->b_fullscreen )
{ {
msg_Dbg( p_vout, "entering fullscreen mode" ); msg_Dbg( p_vout, "entering fullscreen mode" );
/* Change window style, no borders and no title bar */ /* Change window style, no borders and no title bar */
int i_style = WS_CLIPCHILDREN | WS_VISIBLE; int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
SetWindowLong( hwnd, GWL_STYLE, i_style ); SetWindowLong( hwnd, GWL_STYLE, i_style );
...@@ -1190,7 +1202,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout ) ...@@ -1190,7 +1202,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
} }
/* Maximize window */ /* Maximize window */
SetWindowState( hwnd, SW_SHOWMAXIMIZED ); SetWindowState( hwnd, SW_SHOWMAXIMIZED, window_placement );
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->hparent )
{ {
...@@ -1218,7 +1230,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout ) ...@@ -1218,7 +1230,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style ); SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
/* Normal window */ /* Normal window */
SetWindowState( hwnd, SW_SHOWNORMAL ); SetWindowState( hwnd, SW_SHOWNORMAL, window_placement );
if( p_vout->p_sys->hparent ) if( p_vout->p_sys->hparent )
{ {
......
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