[vlc-devel] commit: Fix toggling when Video is not embedded ( COCQUEBERT Cédric )

git version control git at videolan.org
Thu Nov 13 18:24:52 CET 2008


vlc | branch: 0.9-bugfix | COCQUEBERT Cédric <cedric.cocquebert at cea.fr> | Thu Nov 13 18:05:25 2008 +0100| [1fe5ac7cfd439904dd3c682b4baa8f85768a6897] | committer: Jean-Baptiste Kempf 

Fix toggling when Video is not embedded

Slight modification by jb
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit fbb04b5b0db0eca95dd44746c71bbafa2530acde)

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

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

 modules/video_output/msw/events.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 7d05ac7..b953e1a 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -1140,12 +1140,18 @@ static int Control( vout_thread_t *p_vout, int i_query, va_list args )
 }
 
 
-/* Internal wrapper over GetWindowPlacement / SetWindowPlacement */
-static void SetWindowState(HWND hwnd, int nShowCmd)
+/* Internal wrapper over GetWindowPlacement */
+static WINDOWPLACEMENT getWindowState(HWND hwnd)
 {
     WINDOWPLACEMENT window_placement;
     window_placement.length = sizeof(WINDOWPLACEMENT);
     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;
     SetWindowPlacement( hwnd, &window_placement );
     SetWindowPos( hwnd, 0, 0, 0, 0, 0,
@@ -1167,11 +1173,17 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
     HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
         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;
 
+    /* We want to go to Fullscreen */
     if( p_vout->b_fullscreen )
     {
         msg_Dbg( p_vout, "entering fullscreen mode" );
+
         /* Change window style, no borders and no title bar */
         int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
         SetWindowLong( hwnd, GWL_STYLE, i_style );
@@ -1190,7 +1202,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
         }
 
         /* Maximize window */
-        SetWindowState( hwnd, SW_SHOWMAXIMIZED );
+        SetWindowState( hwnd, SW_SHOWMAXIMIZED, window_placement );
 
         if( p_vout->p_sys->hparent )
         {
@@ -1218,7 +1230,7 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
         SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
 
         /* Normal window */
-        SetWindowState( hwnd, SW_SHOWNORMAL );
+        SetWindowState( hwnd, SW_SHOWNORMAL, window_placement );
 
         if( p_vout->p_sys->hparent )
         {




More information about the vlc-devel mailing list