Commit e950e338 authored by Cyril Deguet's avatar Cyril Deguet

* x11/x11_theme.cpp: better timing for SkinManage

* src/vlcproc.cpp: hack to make OpenDialog work, but it MUST be
  changed !
parent 63fa336d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class * vlcproc.cpp: VlcProc class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -394,7 +394,13 @@ void VlcProc::LoadSkin() ...@@ -394,7 +394,13 @@ void VlcProc::LoadSkin()
void VlcProc::OpenFile( bool play ) void VlcProc::OpenFile( bool play )
{ {
#ifndef BASIC_SKINS #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; return;
} }
...@@ -408,6 +414,7 @@ void VlcProc::OpenFile( bool play ) ...@@ -408,6 +414,7 @@ void VlcProc::OpenFile( bool play )
if( play ) if( play )
{ {
wxMutexGuiEnter();
// Append and play // Append and play
for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ ) for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
{ {
...@@ -415,11 +422,13 @@ void VlcProc::OpenFile( bool play ) ...@@ -415,11 +422,13 @@ void VlcProc::OpenFile( bool play )
(const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(), (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
} }
wxMutexGuiLeave();
p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent(); p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
} }
else else
{ {
wxMutexGuiEnter();
// Append only // Append only
for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ ) for( size_t i = 0; i < p_intf->p_sys->OpenDlg->mrl.GetCount(); i++ )
{ {
...@@ -427,6 +436,7 @@ void VlcProc::OpenFile( bool play ) ...@@ -427,6 +436,7 @@ void VlcProc::OpenFile( bool play )
(const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(), (const char *)p_intf->p_sys->OpenDlg->mrl[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_APPEND, PLAYLIST_END );
} }
wxMutexGuiLeave();
} }
// Refresh interface ! // Refresh interface !
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_run.cpp: * x11_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -56,9 +56,6 @@ ...@@ -56,9 +56,6 @@
// include the icon graphic // include the icon graphic
#include "share/vlc32x32.xpm" #include "share/vlc32x32.xpm"
#include <unistd.h>
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Specific method // Specific method
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -150,7 +147,7 @@ void SkinsDialogsThread( intf_thread_t *p_intf ) ...@@ -150,7 +147,7 @@ void SkinsDialogsThread( intf_thread_t *p_intf )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// X11 event processing // 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 // Variables
list<SkinWindow *>::const_iterator win; list<SkinWindow *>::const_iterator win;
...@@ -209,7 +206,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -209,7 +206,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
wxExit(); wxExit();
#endif #endif
return; // Exit VLC ! return 1; // Exit VLC !
} }
} }
else else
...@@ -225,7 +222,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -225,7 +222,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
if( (*win)->ProcessEvent( evt ) ) if( (*win)->ProcessEvent( evt ) )
{ {
delete (OSEvent *)evt; delete (OSEvent *)evt;
return; return 0;
} }
else else
{ {
...@@ -241,6 +238,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -241,6 +238,7 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
// Check if vlc is closing // Check if vlc is closing
proc->IsClosing(); proc->IsClosing();
return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -248,10 +246,10 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -248,10 +246,10 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void OSRun( intf_thread_t *p_intf ) void OSRun( intf_thread_t *p_intf )
{ {
static char *p_args[] = { "" };
VlcProc *proc = new VlcProc( p_intf ); VlcProc *proc = new VlcProc( p_intf );
Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
// Create a new thread for wxWindows // Create a new thread for wxWindows
if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread, if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
...@@ -263,19 +261,19 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -263,19 +261,19 @@ void OSRun( intf_thread_t *p_intf )
} }
#endif #endif
Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
// Main event loop // Main event loop
int close = 0;
int count = 0; int count = 0;
while( 1 ) while( !close )
{ {
XEvent event; XEvent event;
while( XPending( display ) > 0 ) while( !close && XPending( display ) > 0 )
{ {
XNextEvent( display, &event ); XNextEvent( display, &event );
ProcessEvent( p_intf, proc, &event ); close = ProcessEvent( p_intf, proc, &event );
} }
usleep( 1000 );
msleep( 1000 );
if( ++count == 100 ) if( ++count == 100 )
{ {
count = 0; count = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_theme.cpp: X11 implementation of the Theme class * x11_theme.cpp: X11 implementation of the Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -168,9 +168,8 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -168,9 +168,8 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
// Create the window // Create the window
Window root = DefaultRootWindow( display ); Window root = DefaultRootWindow( display );
XSetWindowAttributes attr; XSetWindowAttributes attr;
attr.override_redirect = True;
Window wnd = XCreateWindow( display, root, 0, 0, 1, 1, 0, 0, InputOutput, Window wnd = XCreateWindow( display, root, 0, 0, 1, 1, 0, 0, InputOutput,
CopyFromParent, CWOverrideRedirect, &attr ); CopyFromParent, 0, &attr );
XSelectInput( display, wnd, ExposureMask|StructureNotifyMask| XSelectInput( display, wnd, ExposureMask|StructureNotifyMask|
KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask| KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|
PointerMotionMask|EnterWindowMask|LeaveWindowMask); PointerMotionMask|EnterWindowMask|LeaveWindowMask);
...@@ -202,8 +201,6 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible, ...@@ -202,8 +201,6 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
XNextEvent( display, &evt ); XNextEvent( display, &evt );
} while( evt.type != MapNotify ); } while( evt.type != MapNotify );
fprintf(stderr, "\nDONE\n");
WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y, WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y,
visible, fadetime, alpha, movealpha, dragdrop, name ) ) ; visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment