]> git.sesse.net Git - vlc/commitdiff
* x11/x11_theme.cpp: better timing for SkinManage
authorCyril Deguet <asmax@videolan.org>
Thu, 29 May 2003 16:48:29 +0000 (16:48 +0000)
committerCyril Deguet <asmax@videolan.org>
Thu, 29 May 2003 16:48:29 +0000 (16:48 +0000)
* src/vlcproc.cpp: hack to make OpenDialog work, but it MUST be
  changed !

modules/gui/skins/src/vlcproc.cpp
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_theme.cpp

index b941aaa2e6bf109915add8e57deff16be117bda3..c5a84ca9dc1b7f161ddb49fa25083d5c27ed6931 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.cpp: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.25 2003/05/24 17:52:48 gbazin Exp $
+ * $Id: vlcproc.cpp,v 1.26 2003/05/29 16:48:29 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -394,7 +394,13 @@ void VlcProc::LoadSkin()
 void VlcProc::OpenFile( bool play )
 {
 #ifndef BASIC_SKINS
-    if( p_intf->p_sys->OpenDlg->ShowModal() != wxID_OK )
+    int iRc;
+    
+    // FIXME: just for testing
+    wxMutexGuiEnter();
+    iRc = p_intf->p_sys->OpenDlg->ShowModal();
+    wxMutexGuiLeave();
+    if( iRc != wxID_OK )
     {
         return;
     }
@@ -408,6 +414,7 @@ void VlcProc::OpenFile( bool play )
 
     if( play )
     {
+    wxMutexGuiEnter();
         // Append and play
         for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
         {
@@ -415,11 +422,13 @@ void VlcProc::OpenFile( bool play )
                 (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
                 PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
         }
+    wxMutexGuiLeave();
 
         p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
     }
     else
     {
+    wxMutexGuiEnter();
         // Append only
         for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
         {
@@ -427,6 +436,7 @@ void VlcProc::OpenFile( bool play )
                 (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
                 PLAYLIST_APPEND, PLAYLIST_END );
         }
+    wxMutexGuiLeave();
     }
 
     // Refresh interface !
index b68f944623426fc13db544fdc1765630c44b569a..9670691f25fd205208353b5438c6043f44746dae 100644 (file)
@@ -2,7 +2,7 @@
  * x11_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.10 2003/05/28 23:56:51 asmax Exp $
+ * $Id: x11_run.cpp,v 1.11 2003/05/29 16:48:29 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -56,9 +56,6 @@
 // include the icon graphic
 #include "share/vlc32x32.xpm"
 
-#include <unistd.h>
-
-
 //---------------------------------------------------------------------------
 // Specific method
 //---------------------------------------------------------------------------
@@ -150,7 +147,7 @@ void SkinsDialogsThread( intf_thread_t *p_intf )
 //---------------------------------------------------------------------------
 // X11 event processing
 //---------------------------------------------------------------------------
-void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
+int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
 {
     // Variables
     list<SkinWindow *>::const_iterator win;
@@ -209,7 +206,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
 #ifndef BASIC_SKINS
             wxExit();
 #endif
-            return;      // Exit VLC !
+            return 1;      // Exit VLC !
         }
     }
     else
@@ -225,7 +222,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
                 if( (*win)->ProcessEvent( evt ) )
                 {
                     delete (OSEvent *)evt;
-                    return;
+                    return 0;
                 }
                 else
                 {
@@ -240,7 +237,8 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
 
     // Check if vlc is closing
     proc->IsClosing();
-
+    
+    return 0;
 }
 
 //---------------------------------------------------------------------------
@@ -248,10 +246,10 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
 //---------------------------------------------------------------------------
 void OSRun( intf_thread_t *p_intf )
 {
-    static char  *p_args[] = { "" };
-
     VlcProc *proc = new VlcProc( p_intf );
 
+    Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
+
 #ifndef BASIC_SKINS
     // Create a new thread for wxWindows
     if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
@@ -262,20 +260,20 @@ void OSRun( intf_thread_t *p_intf )
         return;
     }
 #endif
-
-    Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
     
     // Main event loop
+    int close = 0;
     int count = 0;
-    while( 1 )
+    while( !close )
     {
         XEvent event;
-        while( XPending( display ) > 0 )
+        while( !close && XPending( display ) > 0 )
         {
             XNextEvent( display, &event );
-            ProcessEvent( p_intf, proc, &event );
+            close = ProcessEvent( p_intf, proc, &event );
         }
-        usleep( 1000 );
+        
+        msleep( 1000 );
         if( ++count == 100 )
         {
             count = 0;
index 03342fda1f4e3cbc483e531c4599cf1873120cf2..53784588cd29392f2606e7f04bb18a738b3b227c 100644 (file)
@@ -2,7 +2,7 @@
  * x11_theme.cpp: X11 implementation of the Theme class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_theme.cpp,v 1.5 2003/05/28 23:56:51 asmax Exp $
+ * $Id: x11_theme.cpp,v 1.6 2003/05/29 16:48:29 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -168,9 +168,8 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
     // Create the window
     Window root = DefaultRootWindow( display );
     XSetWindowAttributes attr;
-    attr.override_redirect = True;
     Window wnd = XCreateWindow( display, root, 0, 0, 1, 1, 0, 0, InputOutput,
-                                CopyFromParent, CWOverrideRedirect, &attr );
+                                CopyFromParent, 0, &attr );
     XSelectInput( display, wnd, ExposureMask|StructureNotifyMask|
             KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|
             PointerMotionMask|EnterWindowMask|LeaveWindowMask);
@@ -202,8 +201,6 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
         XNextEvent( display, &evt );
     } while( evt.type != MapNotify );
 
-    fprintf(stderr, "\nDONE\n");
-
     WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y, 
         visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
 }