[vlc-devel] commit: Simplify DX_DESKTOP_CHANGE case. (Laurent Aimar )

git version control git at videolan.org
Mon Sep 14 20:20:04 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Sep  9 22:21:22 2009 +0200| [b3f43c1d7ffc0229a634034264cd4c90650fb917] | committer: Laurent Aimar 

Simplify DX_DESKTOP_CHANGE case.

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

 modules/video_output/msw/direct3d.c |   23 ++++-------------------
 modules/video_output/msw/events.c   |    8 ++++----
 modules/video_output/msw/vout.h     |    2 --
 3 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index ed95fd2..50a8df6 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -359,22 +359,14 @@ static int Manage( vout_thread_t *p_vout )
     }
 
     /*
-            * Desktop mode change
-            */
+     * Desktop mode change
+     */
     if( p_vout->p_sys->i_changes & DX_DESKTOP_CHANGE )
     {
         /* Close the direct3d instance attached to the current output window. */
         End( p_vout );
         StopEventThread( p_vout );
-        /* Set the switching mode flag */
-        p_vout->p_sys->i_changes |= SWITCHING_MODE_FLAG;
-        /* Reset the flag */
-        p_vout->p_sys->i_changes &= ~DX_DESKTOP_CHANGE;
-    }
 
-    if( p_vout->p_sys->i_changes & EVENT_THREAD_ENDED
-        && p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG )
-    {
         /* Open the direct3d output and attaches it to the new window */
         p_vout->p_sys->b_desktop = !p_vout->p_sys->b_desktop;
         p_vout->pf_display = FirstDisplay;
@@ -383,9 +375,8 @@ static int Manage( vout_thread_t *p_vout )
         CreateEventThread( p_vout );
         Init( p_vout );
 
-        /* Reset the flags */
-        p_vout->p_sys->i_changes &= ~EVENT_THREAD_ENDED;
-        p_vout->p_sys->i_changes &= ~SWITCHING_MODE_FLAG;
+        /* Reset the flag */
+        p_vout->p_sys->i_changes &= ~DX_DESKTOP_CHANGE;
     }
 
     /* autoscale toggle */
@@ -514,9 +505,6 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
 
     LPDIRECT3DDEVICE9       p_d3ddev = p_vout->p_sys->p_d3ddev;
 
-    if( p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG )
-        return;
-
     // Present the back buffer contents to the display
     // stretching and filtering happens here
     HRESULT hr = IDirect3DDevice9_Present(p_d3ddev,
@@ -1290,9 +1278,6 @@ static void Direct3DVoutRenderScene( vout_thread_t *p_vout, picture_t *p_pic )
     HRESULT hr;
     float f_width, f_height;
 
-    if( p_vout->p_sys->i_changes & SWITCHING_MODE_FLAG )
-        return;
-
     // check if device is still available
     hr = IDirect3DDevice9_TestCooperativeLevel(p_d3ddev);
     if( FAILED(hr) )
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 493e246..af2dc9b 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -396,10 +396,7 @@ static void *EventThread( void *p_this )
     msg_Dbg( p_vout, "DirectXEventThread terminating" );
 
     DirectXCloseWindow( p_event->p_vout );
-    vlc_restorecancel (canc);
-
-    /* clear the changes formerly signaled */
-    p_event->p_vout->p_sys->i_changes = EVENT_THREAD_ENDED;
+    vlc_restorecancel(canc);
     return NULL;
 }
 
@@ -971,6 +968,9 @@ static void EventThreadStop( event_thread_t *p_event )
 
     vlc_join( p_event->thread, NULL );
     p_event->b_ready = false;
+
+    /* clear the changes formerly signaled */
+    p_event->p_vout->p_sys->i_changes = 0;
 }
 
 /* */
diff --git a/modules/video_output/msw/vout.h b/modules/video_output/msw/vout.h
index 87ef62f..2ed551b 100644
--- a/modules/video_output/msw/vout.h
+++ b/modules/video_output/msw/vout.h
@@ -289,8 +289,6 @@ void RestoreScreensaver ( vout_thread_t *p_vout );
 #define DX_POSITION_CHANGE 0x1000
 #define DX_WALLPAPER_CHANGE 0x2000
 #define DX_DESKTOP_CHANGE 0x4000
-#define EVENT_THREAD_ENDED 0x6000
-#define SWITCHING_MODE_FLAG 0x8000
 
 /*****************************************************************************
  * WinCE helpers




More information about the vlc-devel mailing list