[vlc-devel] [PATCH] Win32 directx/direct3d/opengl: fullscreen mode improved

Sergey Volk sergey.volk at gmail.com
Wed May 2 16:12:26 CEST 2007


Hi,
Current implementation of directx video output modules (directx, direct3d,
glwin32) leaves main interface window visible when the user toggles
fullscreen mode. This causes two problems: (a) the user sees empty main
interface window when he switches to another application or cycles through
existing windows using Alt-Tab and (b) main interface window overlaps video
window when he toggles "video-on-top" option while fullscreen mode is
active. In order to fix both these issues, we should hide main interface
window when entering fullscreen mode and restore it when leaving fullscreen
mode. But some GUI modules (in particular qt4 module) may need to call
show() for main interface window in order to apply "video-on-top" flag, so
in order to avoid condition (b) described earlier we need also to hide
VOUT_SET_STAY_ON_TOP queries from main interface window while we are in
fullscreen mode and update "video-on-top" status for main window when we are
leaving fullscreen mode.

I have also noticed that there is a code in
src/video_output/vout_intf.c:FullscreenCallback (line 1151), which sets
video-on-top variable to false, when entering fullscreen mode. I think this
code should be removed, there is no point in disabling video-on-top option,
as the user may change this option in fullscreen mode anyway (through mouse
/ hotkey controls, at least). So video_output modules should be aware that
video-on-top variable may be toggled in fullscreen mode and should handle
such situations appropriately. I'm developing under win32/cygwin, so I
haven't checked if similar reasoning applies to X11 module or any of the
other video output modules. It seems that at least wingdi output module has
the same problem, but it's code is somewhat different from
DirectX/Direct3D/Win32 OpenGL code, so I'll provide patch for wingdi module
later. In the meantime, I think it is safe to leave that old code as it is.

Two patches are attached to this message: vlc-vout-dx-fullscreen.patch is a
version which fixes fullscreen mode for DirectX module only, it is intended
only to demonstrate what changes are being applied to current version.
Another one - vlc-vout-dx-fullscreen2.patch, does essentially the same, only
it fixes all three modules (directx, direct3d and opengl) and refactors some
common code for toggling fullscreen mode into Win32ToggleFullscreen
function, to remove code duplication between those modules.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070502/592dcd52/attachment.html>
-------------- next part --------------
Index: video_output/directx/directx.c
===================================================================
--- video_output/directx/directx.c	(revision 19952)
+++ video_output/directx/directx.c	(working copy)
@@ -532,6 +532,28 @@
     }
 }
 
+/* Internal wrapper over GetWindowPlacement / SetWindowPlacement */ 
+static void SetWindowState(HWND hwnd, int nShowCmd)
+{
+    WINDOWPLACEMENT window_placement;
+    window_placement.length = sizeof(WINDOWPLACEMENT);
+    GetWindowPlacement( hwnd, &window_placement );
+    window_placement.showCmd = nShowCmd;
+    SetWindowPlacement( hwnd, &window_placement );
+    SetWindowPos( hwnd, 0, 0, 0, 0, 0,
+        SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
+}
+
+/* Internal wrapper to call vout_ControlWindow for hparent */
+static void ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
+{
+    va_list args;
+    va_start( args, i_query );
+    vout_ControlWindow( p_vout,
+        (void *)p_vout->p_sys->hparent, i_query, args );
+    va_end( args );
+}
+ 
 /*****************************************************************************
  * Manage: handle Sys events
  *****************************************************************************
@@ -540,8 +562,6 @@
  *****************************************************************************/
 static int Manage( vout_thread_t *p_vout )
 {
-    WINDOWPLACEMENT window_placement;
-
     /* If we do not control our window, we check for geometry changes
      * ourselves because the parent might not send us its events. */
     vlc_mutex_lock( &p_vout->p_sys->lock );
@@ -637,11 +657,9 @@
 
         p_vout->b_fullscreen = ! p_vout->b_fullscreen;
 
-        /* We need to switch between Maximized and Normal sized window */
-        window_placement.length = sizeof(WINDOWPLACEMENT);
-        GetWindowPlacement( hwnd, &window_placement );
         if( p_vout->b_fullscreen )
         {
+            msg_Dbg( p_vout, "directx.c: 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 );
@@ -657,14 +675,10 @@
                 SetWindowPos( hwnd, 0, point.x, point.y,
                               rect.right, rect.bottom,
                               SWP_NOZORDER|SWP_FRAMECHANGED );
-                GetWindowPlacement( hwnd, &window_placement );
             }
 
             /* Maximize window */
-            window_placement.showCmd = SW_SHOWMAXIMIZED;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
+            SetWindowState( hwnd, SW_SHOWMAXIMIZED );
 
             if( p_vout->p_sys->hparent )
             {
@@ -674,20 +688,21 @@
                 SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
                               rect.right, rect.bottom,
                               SWP_NOZORDER|SWP_FRAMECHANGED );
-            }
 
+                HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
+                ShowWindow( topLevelParent, SW_HIDE );
+             }
+
             SetForegroundWindow( hwnd );
         }
         else
         {
+            msg_Dbg( p_vout, "directx.c: leaving fullscreen mode" );
             /* Change window style, no borders and no title bar */
             SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
 
             /* Normal window */
-            window_placement.showCmd = SW_SHOWNORMAL;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
+            SetWindowState( hwnd, SW_SHOWNORMAL );
 
             if( p_vout->p_sys->hparent )
             {
@@ -698,8 +713,16 @@
                               rect.right, rect.bottom,
                               SWP_NOZORDER|SWP_FRAMECHANGED );
 
+                HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
+                ShowWindow( topLevelParent, SW_SHOW );
+                SetForegroundWindow( p_vout->p_sys->hparent );
                 ShowWindow( hwnd, SW_HIDE );
-                SetForegroundWindow( p_vout->p_sys->hparent );
+
+                /* Update "video-on-top" status for main interface window, it
+                   needs to be updated as we were hiding VOUT_SET_STAY_ON_TOP
+                   queries from it while we were in fullscreen mode */
+                int b_ontop = var_GetBool( p_vout, "video-on-top" );
+                ControlParentWindow( p_vout, VOUT_SET_STAY_ON_TOP, b_ontop );
             }
 
             /* Make sure the mouse cursor is displayed */
Index: video_output/directx/events.c
===================================================================
--- video_output/directx/events.c	(revision 19952)
+++ video_output/directx/events.c	(working copy)
@@ -1050,7 +1050,7 @@
         return vout_vaControlDefault( p_vout, i_query, args );
 
     case VOUT_SET_STAY_ON_TOP:
-        if( p_vout->p_sys->hparent )
+        if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
             return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->hparent, i_query, args );
 
-------------- next part --------------
Index: video_output/directx/direct3d.c
===================================================================
--- video_output/directx/direct3d.c	(revision 19952)
+++ video_output/directx/direct3d.c	(working copy)
@@ -381,8 +381,6 @@
  *****************************************************************************/
 static int Manage( vout_thread_t *p_vout )
 {
-    WINDOWPLACEMENT window_placement;
-
     /* If we do not control our window, we check for geometry changes
      * ourselves because the parent might not send us its events. */
     vlc_mutex_lock( &p_vout->p_sys->lock );
@@ -466,85 +464,8 @@
     if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
         || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
     {
-        vlc_value_t val;
-        HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
-            p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
+        Win32ToggleFullscreen( p_vout );
 
-        p_vout->b_fullscreen = ! p_vout->b_fullscreen;
-
-        /* We need to switch between Maximized and Normal sized window */
-        window_placement.length = sizeof(WINDOWPLACEMENT);
-        GetWindowPlacement( hwnd, &window_placement );
-        if( p_vout->b_fullscreen )
-        {
-            /* Change window style, no borders and no title bar */
-            int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
-            SetWindowLong( hwnd, GWL_STYLE, i_style );
-
-            if( p_vout->p_sys->hparent )
-            {
-                /* Retrieve current window position so fullscreen will happen
-                 * on the right screen */
-                POINT point = {0,0};
-                RECT rect;
-                ClientToScreen( p_vout->p_sys->hwnd, &point );
-                GetClientRect( p_vout->p_sys->hwnd, &rect );
-                SetWindowPos( hwnd, 0, point.x, point.y,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-                GetWindowPlacement( hwnd, &window_placement );
-            }
-
-            /* Maximize window */
-            window_placement.showCmd = SW_SHOWMAXIMIZED;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( hwnd, &rect );
-                SetParent( p_vout->p_sys->hwnd, hwnd );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-            }
-
-            SetForegroundWindow( hwnd );
-        }
-        else
-        {
-            /* Change window style, no borders and no title bar */
-            SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
-
-            /* Normal window */
-            window_placement.showCmd = SW_SHOWNORMAL;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( p_vout->p_sys->hparent, &rect );
-                SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-
-                ShowWindow( hwnd, SW_HIDE );
-                SetForegroundWindow( p_vout->p_sys->hparent );
-            }
-
-            /* Make sure the mouse cursor is displayed */
-            PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
-        }
-
-        /* Update the object variable and trigger callback */
-        val.b_bool = p_vout->b_fullscreen;
-        var_Set( p_vout, "fullscreen", val );
-
         p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
         p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
     }
Index: video_output/directx/directx.c
===================================================================
--- video_output/directx/directx.c	(revision 19952)
+++ video_output/directx/directx.c	(working copy)
@@ -540,8 +540,6 @@
  *****************************************************************************/
 static int Manage( vout_thread_t *p_vout )
 {
-    WINDOWPLACEMENT window_placement;
-
     /* If we do not control our window, we check for geometry changes
      * ourselves because the parent might not send us its events. */
     vlc_mutex_lock( &p_vout->p_sys->lock );
@@ -631,85 +629,8 @@
     if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
         || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
     {
-        vlc_value_t val;
-        HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
-            p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
+        Win32ToggleFullscreen( p_vout );
 
-        p_vout->b_fullscreen = ! p_vout->b_fullscreen;
-
-        /* We need to switch between Maximized and Normal sized window */
-        window_placement.length = sizeof(WINDOWPLACEMENT);
-        GetWindowPlacement( hwnd, &window_placement );
-        if( p_vout->b_fullscreen )
-        {
-            /* Change window style, no borders and no title bar */
-            int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
-            SetWindowLong( hwnd, GWL_STYLE, i_style );
-
-            if( p_vout->p_sys->hparent )
-            {
-                /* Retrieve current window position so fullscreen will happen
-                 * on the right screen */
-                POINT point = {0,0};
-                RECT rect;
-                ClientToScreen( p_vout->p_sys->hwnd, &point );
-                GetClientRect( p_vout->p_sys->hwnd, &rect );
-                SetWindowPos( hwnd, 0, point.x, point.y,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-                GetWindowPlacement( hwnd, &window_placement );
-            }
-
-            /* Maximize window */
-            window_placement.showCmd = SW_SHOWMAXIMIZED;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( hwnd, &rect );
-                SetParent( p_vout->p_sys->hwnd, hwnd );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-            }
-
-            SetForegroundWindow( hwnd );
-        }
-        else
-        {
-            /* Change window style, no borders and no title bar */
-            SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
-
-            /* Normal window */
-            window_placement.showCmd = SW_SHOWNORMAL;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( p_vout->p_sys->hparent, &rect );
-                SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-
-                ShowWindow( hwnd, SW_HIDE );
-                SetForegroundWindow( p_vout->p_sys->hparent );
-            }
-
-            /* Make sure the mouse cursor is displayed */
-            PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
-        }
-
-        /* Update the object variable and trigger callback */
-        val.b_bool = p_vout->b_fullscreen;
-        var_Set( p_vout, "fullscreen", val );
-
         p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
         p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
     }
Index: video_output/directx/events.c
===================================================================
--- video_output/directx/events.c	(revision 19952)
+++ video_output/directx/events.c	(working copy)
@@ -1050,7 +1050,7 @@
         return vout_vaControlDefault( p_vout, i_query, args );
 
     case VOUT_SET_STAY_ON_TOP:
-        if( p_vout->p_sys->hparent )
+        if( p_vout->p_sys->hparent && !var_GetBool( p_vout, "fullscreen" ) )
             return vout_ControlWindow( p_vout,
                     (void *)p_vout->p_sys->hparent, i_query, args );
 
@@ -1061,3 +1061,113 @@
         return vout_vaControlDefault( p_vout, i_query, args );
     }
 }
+
+
+/* Internal wrapper over GetWindowPlacement / SetWindowPlacement */ 
+static void SetWindowState(HWND hwnd, int nShowCmd)
+{
+    WINDOWPLACEMENT window_placement;
+    window_placement.length = sizeof(WINDOWPLACEMENT);
+    GetWindowPlacement( hwnd, &window_placement );
+    window_placement.showCmd = nShowCmd;
+    SetWindowPlacement( hwnd, &window_placement );
+    SetWindowPos( hwnd, 0, 0, 0, 0, 0,
+        SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
+}
+
+/* Internal wrapper to call vout_ControlWindow for hparent */
+static void ControlParentWindow( vout_thread_t *p_vout, int i_query, ... )
+{
+    va_list args;
+    va_start( args, i_query );
+    vout_ControlWindow( p_vout,
+        (void *)p_vout->p_sys->hparent, i_query, args );
+    va_end( args );
+}
+
+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;
+
+    p_vout->b_fullscreen = ! p_vout->b_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 );
+
+        if( p_vout->p_sys->hparent )
+        {
+            /* Retrieve current window position so fullscreen will happen
+            * on the right screen */
+            POINT point = {0,0};
+            RECT rect;
+            ClientToScreen( p_vout->p_sys->hwnd, &point );
+            GetClientRect( p_vout->p_sys->hwnd, &rect );
+            SetWindowPos( hwnd, 0, point.x, point.y,
+                          rect.right, rect.bottom,
+                          SWP_NOZORDER|SWP_FRAMECHANGED );
+        }
+
+        /* Maximize window */
+        SetWindowState( hwnd, SW_SHOWMAXIMIZED );
+
+        if( p_vout->p_sys->hparent )
+        {
+            RECT rect;
+            GetClientRect( hwnd, &rect );
+            SetParent( p_vout->p_sys->hwnd, hwnd );
+            SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
+                          rect.right, rect.bottom,
+                          SWP_NOZORDER|SWP_FRAMECHANGED );
+
+            HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
+            ShowWindow( topLevelParent, SW_HIDE );
+        }
+
+        SetForegroundWindow( hwnd );
+    }
+    else
+    {
+        msg_Dbg( p_vout, "leaving fullscreen mode" );
+        /* Change window style, no borders and no title bar */
+        SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
+
+        /* Normal window */
+        SetWindowState( hwnd, SW_SHOWNORMAL );
+
+        if( p_vout->p_sys->hparent )
+        {
+            RECT rect;
+            GetClientRect( p_vout->p_sys->hparent, &rect );
+            SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
+            SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
+                          rect.right, rect.bottom,
+                          SWP_NOZORDER|SWP_FRAMECHANGED );
+
+            HWND topLevelParent = GetAncestor( p_vout->p_sys->hparent, GA_ROOT );
+            ShowWindow( topLevelParent, SW_SHOW );
+            SetForegroundWindow( p_vout->p_sys->hparent );
+            ShowWindow( hwnd, SW_HIDE );
+
+            /* Update "video-on-top" status for main interface window, it
+            needs to be updated as we were hiding VOUT_SET_STAY_ON_TOP
+            queries from it while we were in fullscreen mode */
+            int b_ontop = var_GetBool( p_vout, "video-on-top" );
+            ControlParentWindow( p_vout, VOUT_SET_STAY_ON_TOP, b_ontop );
+        }
+
+        /* Make sure the mouse cursor is displayed */
+        PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
+    }
+
+    {
+        vlc_value_t val;
+        /* Update the object variable and trigger callback */
+        val.b_bool = p_vout->b_fullscreen;
+        var_Set( p_vout, "fullscreen", val );
+    }
+}
Index: video_output/directx/glwin32.c
===================================================================
--- video_output/directx/glwin32.c	(revision 19952)
+++ video_output/directx/glwin32.c	(working copy)
@@ -256,8 +256,6 @@
  *****************************************************************************/
 static int Manage( vout_thread_t *p_vout )
 {
-    WINDOWPLACEMENT window_placement;
-
     int i_width = p_vout->p_sys->rect_dest.right -
         p_vout->p_sys->rect_dest.left;
     int i_height = p_vout->p_sys->rect_dest.bottom -
@@ -328,85 +326,8 @@
     if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE
         || p_vout->p_sys->i_changes & VOUT_FULLSCREEN_CHANGE )
     {
-        vlc_value_t val;
-        HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
-            p_vout->p_sys->hfswnd : p_vout->p_sys->hwnd;
+        Win32ToggleFullscreen( p_vout );
 
-        p_vout->b_fullscreen = ! p_vout->b_fullscreen;
-
-        /* We need to switch between Maximized and Normal sized window */
-        window_placement.length = sizeof(WINDOWPLACEMENT);
-        GetWindowPlacement( hwnd, &window_placement );
-        if( p_vout->b_fullscreen )
-        {
-            /* Change window style, no borders and no title bar */
-            int i_style = WS_CLIPCHILDREN | WS_VISIBLE;
-            SetWindowLong( hwnd, GWL_STYLE, i_style );
-
-            if( p_vout->p_sys->hparent )
-            {
-                /* Retrieve current window position so fullscreen will happen
-                 * on the right screen */
-                POINT point = {0,0};
-                RECT rect;
-                ClientToScreen( p_vout->p_sys->hwnd, &point );
-                GetClientRect( p_vout->p_sys->hwnd, &rect );
-                SetWindowPos( hwnd, 0, point.x, point.y,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-                GetWindowPlacement( hwnd, &window_placement );
-            }
-
-            /* Maximize window */
-            window_placement.showCmd = SW_SHOWMAXIMIZED;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( hwnd, &rect );
-                SetParent( p_vout->p_sys->hwnd, hwnd );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-            }
-
-            SetForegroundWindow( hwnd );
-        }
-        else
-        {
-            /* Change window style, no borders and no title bar */
-            SetWindowLong( hwnd, GWL_STYLE, p_vout->p_sys->i_window_style );
-
-            /* Normal window */
-            window_placement.showCmd = SW_SHOWNORMAL;
-            SetWindowPlacement( hwnd, &window_placement );
-            SetWindowPos( hwnd, 0, 0, 0, 0, 0,
-                          SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
-
-            if( p_vout->p_sys->hparent )
-            {
-                RECT rect;
-                GetClientRect( p_vout->p_sys->hparent, &rect );
-                SetParent( p_vout->p_sys->hwnd, p_vout->p_sys->hparent );
-                SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
-                              rect.right, rect.bottom,
-                              SWP_NOZORDER|SWP_FRAMECHANGED );
-
-                ShowWindow( hwnd, SW_HIDE );
-                SetForegroundWindow( p_vout->p_sys->hparent );
-            }
-
-            /* Make sure the mouse cursor is displayed */
-            PostMessage( p_vout->p_sys->hwnd, WM_VLC_SHOW_MOUSE, 0, 0 );
-        }
-
-        /* Update the object variable and trigger callback */
-        val.b_bool = p_vout->b_fullscreen;
-        var_Set( p_vout, "fullscreen", val );
-
         p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
         p_vout->p_sys->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
     }
Index: video_output/directx/vout.h
===================================================================
--- video_output/directx/vout.h	(revision 19952)
+++ video_output/directx/vout.h	(working copy)
@@ -147,6 +147,7 @@
  *****************************************************************************/
 void E_(DirectXEventThread) ( event_thread_t *p_event );
 void E_(DirectXUpdateRects) ( vout_thread_t *p_vout, vlc_bool_t b_force );
+void E_(Win32ToggleFullscreen) ( vout_thread_t *p_vout );
 
 /*****************************************************************************
  * Constants


More information about the vlc-devel mailing list