p_sys->i_window_width = p_vout->i_window_width;
p_sys->i_window_height = p_vout->i_window_height;
- if( !CreateEventThread( p_vout ) )
+ p_sys->p_event = EventThreadCreate( p_vout );
+ if( !p_sys->p_event )
+ return VLC_EGENERIC;
+ if( EventThreadStart( p_sys->p_event ) )
return VLC_EGENERIC;
/* Variable to indicate if the window should be on top of others */
/* */
void CommonClean( vout_thread_t *p_vout )
{
- StopEventThread( p_vout );
- vlc_mutex_destroy( &p_vout->p_sys->lock );
+ vout_sys_t *p_sys = p_vout->p_sys;
+
+ ExitFullscreen( p_vout );
+ if( p_sys->p_event )
+ {
+ EventThreadStop( p_sys->p_event );
+ EventThreadDestroy( p_sys->p_event );
+ }
+
+ vlc_mutex_destroy( &p_sys->lock );
#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
RestoreScreensaver( p_vout );
}
#endif
+void ExitFullscreen( vout_thread_t *p_vout )
+{
+ if( p_vout->b_fullscreen )
+ {
+ msg_Dbg( p_vout, "Quitting fullscreen" );
+ Win32ToggleFullscreen( p_vout );
+ /* Force fullscreen in the core for the next video */
+ var_SetBool( p_vout, "fullscreen", true );
+ }
+}
+
void Win32ToggleFullscreen( vout_thread_t *p_vout )
{
HWND hwnd = (p_vout->p_sys->hparent && p_vout->p_sys->hfswnd) ?
{
/* Close the direct3d instance attached to the current output window. */
End( p_vout );
- StopEventThread( p_vout );
+
+ ExitFullscreen( p_vout );
+
+ EventThreadStop( p_vout->p_sys->p_event );
/* 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;
- vlc_mutex_init( &p_vout->p_sys->lock );
- CreateEventThread( p_vout );
+ EventThreadStart( p_vout->p_sys->p_event );
+
Init( p_vout );
/* Reset the flag */
return 0;
}
-static event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
+event_thread_t *EventThreadCreate( vout_thread_t *p_vout )
{
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
return p_event;
}
-static void EventThreadDestroy( event_thread_t *p_event )
+void EventThreadDestroy( event_thread_t *p_event )
{
vlc_cond_destroy( &p_event->wait );
vlc_mutex_destroy( &p_event->lock );
free( p_event );
}
-static int EventThreadStart( event_thread_t *p_event )
+int EventThreadStart( event_thread_t *p_event )
{
p_event->b_ready = false;
p_event->b_done = false;
return VLC_SUCCESS;
}
-static void EventThreadStop( event_thread_t *p_event )
+void EventThreadStop( event_thread_t *p_event )
{
if( !p_event->b_ready )
return;
p_event->p_vout->p_sys->i_changes = 0;
}
-/* */
-int CreateEventThread( vout_thread_t *p_vout )
-{
- event_thread_t *p_event =
- p_vout->p_sys->p_event = EventThreadCreate( p_vout );
- if( !p_event )
- return 0;
-
- if( EventThreadStart( p_event ) )
- return 0;
- return 1;
-}
-
-void StopEventThread( vout_thread_t *p_vout )
-{
- if( p_vout->b_fullscreen )
- {
- msg_Dbg( p_vout, "Quitting fullscreen" );
- Win32ToggleFullscreen( p_vout );
- /* Force fullscreen in the core for the next video */
- var_SetBool( p_vout, "fullscreen", true );
- }
-
- event_thread_t *p_event = p_vout->p_sys->p_event;
- if( p_event )
- {
- EventThreadStop( p_event );
- EventThreadDestroy( p_event );
- p_vout->p_sys->p_event = NULL;
- }
-}
-
/*****************************************************************************
* Prototypes from events.c
*****************************************************************************/
-int CreateEventThread( vout_thread_t *p_vout );
-void StopEventThread ( vout_thread_t *p_vout );
+event_thread_t *EventThreadCreate( vout_thread_t * );
+void EventThreadDestroy( event_thread_t * );
+int EventThreadStart( event_thread_t * );
+void EventThreadStop( event_thread_t * );
/*****************************************************************************
* Prototypes from common.c
void UpdateRects ( vout_thread_t *p_vout, bool b_force );
void Win32ToggleFullscreen ( vout_thread_t *p_vout );
+void ExitFullscreen( vout_thread_t *p_vout );
#ifndef UNDER_CE
void DisableScreensaver ( vout_thread_t *p_vout );
void RestoreScreensaver ( vout_thread_t *p_vout );