]> git.sesse.net Git - vlc/commitdiff
* fixed a timing issue under windows ?
authorCyril Deguet <asmax@videolan.org>
Mon, 21 Apr 2003 02:50:49 +0000 (02:50 +0000)
committerCyril Deguet <asmax@videolan.org>
Mon, 21 Apr 2003 02:50:49 +0000 (02:50 +0000)
modules/gui/skins/gtk2/gtk2_run.cpp
modules/gui/skins/src/skin_common.h
modules/gui/skins/src/skin_main.cpp
modules/gui/skins/win32/win32_run.cpp

index dda5dde94289041f880dff87818952a6ffabcd26..797ea62c1c7a3e0472e5ad26ddcccb162c0447c8 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.16 2003/04/21 01:47:42 asmax Exp $
+ * $Id: gtk2_run.cpp,v 1.17 2003/04/21 02:50:49 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -192,38 +192,6 @@ void GTK2Proc( GdkEvent *event, gpointer data )
     // Check if vlc is closing
     proc->IsClosing();
 
-#if 0
-    // If Window is parent window
-    if( hwnd == ( (GTK2Theme *)p_intf->p_sys->p_theme )->GetParentWindow() )
-    {
-        if( uMsg == WM_SYSCOMMAND )
-        {
-            if( (Event *)wParam != NULL )
-                ( (Event *)wParam )->SendEvent();
-            return 0;
-        }
-        else if( uMsg == WM_RBUTTONDOWN && wParam == 42 &&
-                 lParam == WM_RBUTTONDOWN )
-        {
-            int x, y;
-            OSAPI_GetMousePos( x, y );
-            TrackPopupMenu(
-                ( (GTK2Theme *)p_intf->p_sys->p_theme )->GetSysMenu(),
-                0, x, y, 0, hwnd, NULL );
-        }
-    }
-
-
-    // If closing parent window
-    if( uMsg == WM_CLOSE )
-    {
-        OSAPI_PostMessage( NULL, VLC_HIDE, VLC_QUIT, 0 );
-        return 0;
-    }
-
-    // If hwnd does not match any window or message not processed
-    return DefWindowProc( hwnd, uMsg, wParam, lParam );
-#endif
     gtk_main_do_event( event );
 
 }
@@ -257,6 +225,11 @@ bool Instance::OnInit()
     p_intf->p_sys->SoutDlg = new SoutDialog( p_intf, NULL );
     p_intf->p_sys->PrefsDlg = new PrefsDialog( p_intf, NULL );
     p_intf->p_sys->InfoDlg = new FileInfo( p_intf, NULL );
+    
+    vlc_mutex_lock( &p_intf->p_sys->init_lock );
+    vlc_cond_signal( &p_intf->p_sys->init_cond );
+    vlc_mutex_unlock( &p_intf->p_sys->init_lock );
+    
     return TRUE;
 }
 
@@ -287,6 +260,10 @@ void OSRun( intf_thread_t *p_intf )
 
     wxTheApp = new Instance( p_intf, callbackobj );
 
+    vlc_mutex_lock( &p_intf->p_sys->init_lock );
+    vlc_cond_wait( &p_intf->p_sys->init_cond, &p_intf->p_sys->init_lock );
+    vlc_mutex_unlock( &p_intf->p_sys->init_lock );
     // Add timer
     g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf );
     
index 180d0156fa00378488df936eb56be1668645e768..3cdd7b6131f114107b548de873873b3eebdbccf5 100644 (file)
@@ -2,7 +2,7 @@
  * skin_common.h: Private Skin interface description
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_common.h,v 1.3 2003/04/21 00:54:26 ipkiss Exp $
+ * $Id: skin_common.h,v 1.4 2003/04/21 02:50:49 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -73,6 +73,10 @@ struct intf_sys_t
     SoutDialog  *SoutDlg;
     PrefsDialog *PrefsDlg;
     FileInfo    *InfoDlg;
+
+    // Wait wxwindows initialization
+    vlc_mutex_t init_lock;
+    vlc_cond_t  init_cond;
 };
 
 #endif
index 1b8a5acebcb92286d7ec3d9c39e1f29a5eb6a3d5..8e4ad1ec6db5699ba49d482e5cae17c055ba6a52 100644 (file)
@@ -2,7 +2,7 @@
  * skin-main.cpp: skins plugin for VLC
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.14 2003/04/21 02:12:06 ipkiss Exp $
+ * $Id: skin_main.cpp,v 1.15 2003/04/21 02:50:49 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -105,6 +105,10 @@ static int Open ( vlc_object_t *p_this )
     p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
 
+    // Initialize conditions
+    vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock);
+    vlc_cond_init( p_intf, &p_intf->p_sys->init_cond);
+    
     p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
 
     return( 0 );
@@ -134,6 +138,10 @@ static void Close ( vlc_object_t *p_this )
     // Unsuscribe to messages bank
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
 
+    // Destroy conditions
+    vlc_cond_destroy( &p_intf->p_sys->init_cond);
+    vlc_mutex_destroy( &p_intf->p_sys->init_lock);
+    
     // Destroy structure
     free( p_intf->p_sys );
 }
@@ -144,6 +152,7 @@ static void Close ( vlc_object_t *p_this )
 //---------------------------------------------------------------------------
 static void Run( intf_thread_t *p_intf )
 {
+
 #if !defined WIN32
 /* FIXME: should be elsewhere ? */
     // Initialize GDK
index 413b866fd592d7de667c1a890668afd2b4f36831..03e1826c9677b42aceb03059fccc15d60408c3ba 100644 (file)
@@ -2,7 +2,7 @@
  * win32_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: win32_run.cpp,v 1.7 2003/04/21 00:54:26 ipkiss Exp $
+ * $Id: win32_run.cpp,v 1.8 2003/04/21 02:50:49 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -95,6 +95,11 @@ bool Instance::OnInit()
     p_intf->p_sys->SoutDlg = new SoutDialog( p_intf, NULL );
     p_intf->p_sys->PrefsDlg = new PrefsDialog( p_intf, NULL );
     p_intf->p_sys->InfoDlg = new FileInfo( p_intf, NULL );
+
+    vlc_mutex_lock( &p_intf->p_sys->init_lock );
+    vlc_cond_signal( &p_intf->p_sys->init_cond );
+    vlc_mutex_unlock( &p_intf->p_sys->init_lock );
+    
     return TRUE;
 }
 
@@ -165,7 +170,11 @@ void OSRun( intf_thread_t *p_intf )
     HANDLE hThread;
     hThread = CreateThread( NULL, 0, ThreadFunc, (LPVOID) p_intf, 0, 0 );
 
-    // Create refresh timer
+    vlc_mutex_lock( &p_intf->p_sys->init_lock );
+    vlc_cond_wait( &p_intf->p_sys->init_cond, &p_intf->p_sys->init_lock );
+    vlc_mutex_unlock( &p_intf->p_sys->init_lock );
+     // Create refresh timer
     SetTimer( ((OSTheme *)p_intf->p_sys->p_theme)->GetParentWindow(), 42, 200,
               (TIMERPROC)RefreshTimer );