]> git.sesse.net Git - vlc/commitdiff
* modules/gui/skins: got rid of init_lock and init_cond which aren't needed if you...
authorGildas Bazin <gbazin@videolan.org>
Mon, 26 May 2003 02:09:27 +0000 (02:09 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 26 May 2003 02:09:27 +0000 (02:09 +0000)
   started to implement X11Region and integrated the wxWindows dialogs.
* configure.ac.in: the X11 skins are the default ones when you use --enable-skins. To select the GTK2 version, you also need to use --with-gtk2-skins.

configure.ac.in
modules/gui/skins/controls/button.cpp
modules/gui/skins/src/skin_common.h
modules/gui/skins/src/skin_main.cpp
modules/gui/skins/src/window.cpp
modules/gui/skins/win32/win32_run.cpp
modules/gui/skins/x11/x11_graphics.cpp
modules/gui/skins/x11/x11_graphics.h
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_window.cpp

index 02ed3eb57b93037656f5fd3d6fe24cbe0ed2fbad..994d8f606b78f9f1a157f8efb97ad2e8402aa386 100644 (file)
@@ -2431,10 +2431,22 @@ if test "x${enable_skins}" != "xno"; then
     LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
   else
     if test "x${enable_skins}" = "xyes"; then
-      PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
+
+      AC_ARG_WITH(gtk2-skins,
+      [    --with-gtk2-skins        skins using GTK2 (default disabled)])
+
+      if test "x${with_gtk2_skins}" = "xyes"; then
+        PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
+        CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
+        LDFLAGS_skins="${LDFLAGS_skins} -lstdc++  ${GTK2_LIBS}"
+      else
+        PLUGINS="${PLUGINS} skins"
+        CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} -DX11_SKINS"
+        LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ -L${x_libraries} -lXext -lX11"
+      fi
+
       PLUGINS="${PLUGINS} skins"
-      CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
-      LDFLAGS_skins="${LDFLAGS_skins} -lstdc++  ${GTK2_LIBS}"
+
     fi
   fi
 fi
@@ -2446,15 +2458,26 @@ AC_ARG_ENABLE(basic-skins,
   [  --enable-basic-skins    Skins interface module without wxWindows dialogs (default disabled)])
 if test "x${enable_basic_skins}" = "xyes"; then
   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
-    PLUGINS="${PLUGINS} basic_skins"
+
     CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -U_OFF_T_ -U_off_t -fno-rtti -Imodules/gui/skins"
     LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
+
   else
-    PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
-    PLUGINS="${PLUGINS} basic_skins"
-    CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
-    LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++  ${GTK2_LIBS}"
+    AC_ARG_WITH(gtk2-basic-skins,
+    [    --with-gtk2-basic-skins        skins using GTK2 (default disabled)])
+
+    if test "x${with_gtk2_basic_skins}" = "xyes"; then
+      PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
+      CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
+      LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++  ${GTK2_LIBS}"
+    else
+      CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} -DX11_SKINS"
+      LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++ -L${x_libraries} -lXext -lX11"
+    fi
+
   fi
+
+  PLUGINS="${PLUGINS} basic_skins"
   CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -DBASIC_SKINS"
 fi
 
index 0e006858993727d3fd7c3faff49c7c5b46ff1457..a75fcf3bde6836736fcf054ae5bbb6dc07c2a15e 100644 (file)
@@ -2,7 +2,7 @@
  * button.cpp: Button control
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: button.cpp,v 1.12 2003/05/02 15:53:32 gbazin Exp $
+ * $Id: button.cpp,v 1.13 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -135,8 +135,6 @@ void ControlButton::Draw( int x, int y, int w, int h, Graphics *dest )
 bool ControlButton::MouseUp( int x, int y, int button )
 {
     // If hit in the button
-
-
     if( Img[1]->Hit( x - Left, y - Top ) )
     {
         if( !Enabled )
@@ -148,8 +146,8 @@ bool ControlButton::MouseUp( int x, int y, int button )
             Selected = false;
             ClickAction->SendEvent();
             ParentWindow->Refresh( Left, Top, Width, Height );
-            return true;
         }
+        return true;
     }
 
     if( button == 1 )
@@ -170,8 +168,8 @@ bool ControlButton::MouseDown( int x, int y, int button )
             State = 0;
             Selected = true;
             ParentWindow->Refresh( Left, Top, Width, Height );
-            return true;
         }
+        return true;
     }
 
     return false;
index 53e2e6c9eb5d758f671ca20e4ba8f97aa4ac477c..9bf7d093c62598e28bb34d08413288c34f3c8b8e 100644 (file)
@@ -2,7 +2,7 @@
  * skin_common.h: Private Skin interface description
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_common.h,v 1.9 2003/04/30 19:22:27 ipkiss Exp $
+ * $Id: skin_common.h,v 1.10 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -83,10 +83,6 @@ struct intf_sys_t
     SoutDialog  *SoutDlg;
     PrefsDialog *PrefsDlg;
     FileInfo    *InfoDlg;
-
-    // Wait wxwindows initialization
-    vlc_mutex_t init_lock;
-    vlc_cond_t  init_cond;
 #endif
 
 #ifdef X11_SKINS
index 26f50b2dba5c0cbc0feb507f9aa0a546e2b1ee58..1423bc795a4ca97dd637948470b36004660e2188 100644 (file)
@@ -2,7 +2,7 @@
  * skin-main.cpp: skins plugin for VLC
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.26 2003/05/12 17:33:19 gbazin Exp $
+ * $Id: skin_main.cpp,v 1.27 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -157,12 +157,6 @@ static int Open ( vlc_object_t *p_this )
 
 #endif
 
-#ifndef BASIC_SKINS
-    // Initialize conditions and mutexes
-    vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock );
-    vlc_cond_init( p_intf, &p_intf->p_sys->init_cond );
-#endif
-
     p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
 
     return( 0 );
@@ -192,12 +186,6 @@ static void Close ( vlc_object_t *p_this )
     // Unsuscribe to messages bank
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
 
-#ifndef BASIC_SKINS
-    // Destroy conditions and mutexes
-    vlc_cond_destroy( &p_intf->p_sys->init_cond );
-    vlc_mutex_destroy( &p_intf->p_sys->init_lock );
-#endif
-
 #ifdef WIN32
     // Unload msimg32.dll and user32.dll
     if( p_intf->p_sys->h_msimg32_dll )
index 85456631699f415297657c40aa89b9831dc56cba..e2595a30eeb67e56491eee8a39b408a6799da1e8 100644 (file)
@@ -2,7 +2,7 @@
  * window.cpp: Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.23 2003/05/13 19:25:59 asmax Exp $
+ * $Id: window.cpp,v 1.24 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -327,6 +327,7 @@ void SkinWindow::RefreshAll()
 //---------------------------------------------------------------------------
 void SkinWindow::MouseDown( int x, int y, int button )
 {
+
     // Checking event in controls
     for( int i = ControlList.size() - 1; i >= 0 ; i-- )
     {
index 5e30a0b4221142143fb9f19a727c5afdd6d59134..492c48610c69fb2892e863f146b6482edc399576 100644 (file)
@@ -2,7 +2,7 @@
  * win32_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: win32_run.cpp,v 1.16 2003/05/12 17:33:19 gbazin Exp $
+ * $Id: win32_run.cpp,v 1.17 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -128,9 +128,7 @@ bool Instance::OnInit()
     p_intf->p_sys->p_kludgy_timer->Start( 100 );
 
     // OK, initialization is over, now the other thread can go on working...
-    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 );
+    vlc_thread_ready( p_intf );
 
     return TRUE;
 }
@@ -231,15 +229,12 @@ void OSRun( intf_thread_t *p_intf )
 #ifndef BASIC_SKINS
     // Create a new thread for wxWindows
     if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
-                           0, 0 ) )
+                           0, VLC_TRUE ) )
     {
         msg_Err( p_intf, "cannot create SkinsDialogsThread" );
         // Don't even enter the main loop
         return;
     }
-    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 );
 #endif
 
      // Create refresh timer
index 2ba7f9939d0dbd882ed04fb92258abcca308f77d..17f1e63c4c84cc79f1e3a2f004c83ee7c48c4ac9 100644 (file)
@@ -2,7 +2,7 @@
  * x11_graphics.cpp: X11 implementation of the Graphics and Region classes
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.cpp,v 1.3 2003/05/18 17:48:05 asmax Exp $
+ * $Id: x11_graphics.cpp,v 1.4 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -115,22 +115,17 @@ void X11Graphics::ResetClipRegion()
 //---------------------------------------------------------------------------
 X11Region::X11Region()
 {
-/*    Rgn = gdk_region_new();*/
+    RefPoint.x = RefPoint.y = 0;
 }
 //---------------------------------------------------------------------------
 X11Region::X11Region( int x, int y, int w, int h )
 {
-/*    GdkRectangle rect;
-    rect.x = x;
-    rect.y = y;
-    rect.width = w;
-    rect.height = h;
-    Rgn = gdk_region_rectangle( &rect );*/
+    RefPoint.x = RefPoint.y = 0;
+    AddRectangle( x, y, w, h );
 }
 //---------------------------------------------------------------------------
 X11Region::~X11Region()
 {
-/*    gdk_region_destroy( Rgn );*/
 }
 //---------------------------------------------------------------------------
 void X11Region::AddPoint( int x, int y )
@@ -140,57 +135,59 @@ void X11Region::AddPoint( int x, int y )
 //---------------------------------------------------------------------------
 void X11Region::AddRectangle( int x, int y, int w, int h )
 {
-/*    GdkRectangle rect;
-    rect.x = x;
-    rect.y = y;
-    rect.width = w;
-    rect.height = h;
-    GdkRegion *Buffer = gdk_region_rectangle( &rect );
-    gdk_region_union( Rgn, Buffer );*/
+    CoordsRectangle coords;
+    coords.x = x - RefPoint.x; coords.y = y - RefPoint.y;
+    coords.w = w; coords.h = h;
+    RectanglesList.push_back( coords );
 }
 //---------------------------------------------------------------------------
 void X11Region::AddElipse( int x, int y, int w, int h )
 {
-/*    GdkRegion *Buffer;
-    GdkRectangle rect;
-    rect.height = 1;
-
-    double ex, ey;
-    double a = w / 2;
-    double b = h / 2;
-
-    if( !a || !b )
-        return;
-
-    for( ey = 0; ey < h; ey++ )
-    {
-        // Calculate coords
-        ex = a * sqrt( 1 - ey * ey / ( b * b ) );
-
-        // Upper line
-        rect.x     = (gint)( x + a - ex );
-        rect.y     = (gint)( y + b - ey );
-        rect.width = (gint)( 2 * ex );
-        Buffer = gdk_region_rectangle( &rect );
-        gdk_region_union( Rgn, Buffer );
-        gdk_region_destroy( Buffer );
-
-        // Lower line
-        rect.y = (gint)( y + b + ey );
-        Buffer = gdk_region_rectangle( &rect );
-        gdk_region_union( Rgn, Buffer );
-        gdk_region_destroy( Buffer );
-    }*/
+    CoordsElipse coords;
+    coords.x = x - RefPoint.x; coords.y = y - RefPoint.y;
+    coords.w = w; coords.h = h;
+    ElipsesList.push_back( coords );
 }
 //---------------------------------------------------------------------------
 void X11Region::Move( int x, int y )
 {
-/*    gdk_region_offset( Rgn, x, y );*/
+    RefPoint.x += x;
+    RefPoint.y += y;
 }
 //---------------------------------------------------------------------------
 bool X11Region::Hit( int x, int y )
 {
-/*    return gdk_region_point_in( Rgn, x, y );*/
+    int i;
+
+    x -= RefPoint.x;
+    y -= RefPoint.y;
+
+    // Check our rectangles list first
+    for( i = 0; i < RectanglesList.size(); i++ )
+    {
+        if( x >= RectanglesList[i].x &&
+            x <= RectanglesList[i].x + RectanglesList[i].w &&
+            y >= RectanglesList[i].y &&
+            y <= RectanglesList[i].y + RectanglesList[i].h )
+        {
+            return true;
+        }
+    }
+
+    // Check our elipses list
+    for( i = 0; i < ElipsesList.size(); i++ )
+    {
+        // FIXME!!
+        if( x >= ElipsesList[i].x &&
+            x <= ElipsesList[i].x + ElipsesList[i].w &&
+            y >= ElipsesList[i].y &&
+            y <= ElipsesList[i].y + ElipsesList[i].h )
+        {
+            return true;
+        }
+    }
+
+    return false;
 }
 //---------------------------------------------------------------------------
 
index 4cb537b7695937db6d91111b51c385e9703f1bd1..398c7c8ab24df0f801c3a955f3b9d77260fde493 100644 (file)
@@ -2,7 +2,7 @@
  * x11_graphics.h: X11 implementation of the Graphics and Region classes
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.h,v 1.2 2003/04/30 21:16:24 asmax Exp $
+ * $Id: x11_graphics.h,v 1.3 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
 #ifndef VLC_SKIN_X11_GRAPHICS
 #define VLC_SKIN_X11_GRAPHICS
 
+//--- GENERAL ---------------------------------------------------------------
+#include <vector>
+using namespace std;
+
 //--- X11 -------------------------------------------------------------------
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 class SkinRegion;
 class SkinWindow;
 
+struct CoordsPoint{ int x, y; };
+struct CoordsRectangle{ int x, y, w, h; };
+struct CoordsElipse{ int x, y, w, h; };
+
 //---------------------------------------------------------------------------
 class X11Graphics : public Graphics
 {
@@ -85,6 +93,11 @@ class X11Region : public SkinRegion
 
         // Specific X11 methods
         Region *GetHandle() { return Rgn; };
+
+        vector<CoordsRectangle> RectanglesList;
+        vector<CoordsElipse> ElipsesList;
+
+        CoordsPoint RefPoint;
 };
 //---------------------------------------------------------------------------
 
index b6cd1429164aa694ffad16ff6701a245fa3bc723..0ec7cf2952ab68a056f19a520f518b97829a0526 100644 (file)
@@ -2,7 +2,7 @@
  * x11_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.8 2003/05/24 21:28:29 asmax Exp $
+ * $Id: x11_run.cpp,v 1.9 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
 //--- X11 -------------------------------------------------------------------
 #include <X11/Xlib.h>
 
-//--- WWWINDOWS -------------------------------------------------------------
+//--- WXWINDOWS -------------------------------------------------------------
 #ifndef BASIC_SKINS
+/* Let vlc take care of the i18n stuff */
+#define WXINTL_NO_GETTEXT_MACRO
 #include <wx/wx.h>
 #endif
 
@@ -46,6 +48,7 @@
 #include "../os_theme.h"
 #include "../src/skin_common.h"
 #include "../src/vlcproc.h"
+
 #ifndef BASIC_SKINS
 #include "../../wxwindows/wxwindows.h"
 #endif
@@ -63,10 +66,10 @@ bool IsVLCEvent( unsigned int msg );
 int  SkinManage( intf_thread_t *p_intf );
 
 
+#ifndef BASIC_SKINS
 //---------------------------------------------------------------------------
 // Local classes declarations.
 //---------------------------------------------------------------------------
-#ifndef BASIC_SKINS
 class Instance: public wxApp
 {
 public:
@@ -74,130 +77,16 @@ public:
     Instance( intf_thread_t *_p_intf );
 
     bool OnInit();
+    int  OnExit();
     OpenDialog *open;
 
 private:
     intf_thread_t *p_intf;
 };
-#endif
-
-
-//---------------------------------------------------------------------------
-// GTK2 interface
-//---------------------------------------------------------------------------
-/*void GTK2Proc( GdkEvent *event, gpointer data )
-{
-    // Get objects from data
-    CallBackObjects *obj = (CallBackObjects *)data;
-    VlcProc *proc        = obj->Proc;
-
-    // Get pointer to thread info
-    intf_thread_t *p_intf = proc->GetpIntf();
-
-    // Variables
-    unsigned int msg;
-    Event *evt;
-    list<SkinWindow *>::const_iterator win;
-    GdkWindow *gwnd = ((GdkEventAny *)event)->window;
-
-    // Create event to dispatch in windows
-    // Skin event
-    if( event->type == GDK_CLIENT_EVENT )
-    {
-        msg = ( (GdkEventClient *)event )->data.l[0];
-        evt = (Event *)new OSEvent( p_intf, 
-            ((GdkEventAny *)event)->window,
-            msg,
-            ( (GdkEventClient *)event )->data.l[1],
-            ( (GdkEventClient *)event )->data.l[2] );
-    }
-    // System event
-    else
-    {
-        msg = event->type;
-        evt = (Event *)new OSEvent( p_intf,
-            ((GdkEventAny *)event)->window, msg, 0, (long)event );
-    }
-
-    // Process keyboard shortcuts
-    if( msg == GDK_KEY_PRESS )
-    {
-        int KeyModifier = 0;
-        // If key is ALT
-        if( ((GdkEventKey *)event)->state & GDK_MOD1_MASK )
-        {
-            KeyModifier = 1;
-        }
-        // If key is CTRL
-        else if( ((GdkEventKey *)event)->state & GDK_CONTROL_MASK )
-        {
-            KeyModifier = 2;
-        }
-        int key = ((GdkEventKey *)event)->keyval;
-        // Translate into lower case
-        if( key >= 'a' && key <= 'z' )
-        {
-            key -= ('a' - 'A');
-        }
-        if( KeyModifier > 0 )
-            p_intf->p_sys->p_theme->EvtBank->TestShortcut( key , KeyModifier );
-    }
-
-    // Send event
-    else if( IsVLCEvent( msg ) )
-    {
-        if( !proc->EventProc( evt ) )
-        {
-            wxExit();
-            return;      // Exit VLC !
-        }
-    }
-    else if( gwnd == NULL )
-    {
-        for( win = p_intf->p_sys->p_theme->WindowList.begin();
-             win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
-        {
-            (*win)->ProcessEvent( evt );
-        }
-    }
-    else
-    {
-        // Find window matching with gwnd
-        for( win = p_intf->p_sys->p_theme->WindowList.begin();
-             win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
-        {
-            // If it is the correct window
-            if( gwnd == ( (GTK2Window *)(*win) )->GetHandle() )
-            {
-                // Send event and check if processed
-                if( (*win)->ProcessEvent( evt ) )
-                {
-                    delete (OSEvent *)evt;
-                    return;
-                }
-                else
-                {
-                    break;
-                }
-            }
-        }
-    }
-
-    evt->DestructParameters();
-    delete (OSEvent *)evt;
-
-    // Check if vlc is closing
-    proc->IsClosing();
-
-    gtk_main_do_event( event )
-}*/
-//---------------------------------------------------------------------------
-
 
 //---------------------------------------------------------------------------
 // Implementation of Instance class
 //---------------------------------------------------------------------------
-#ifndef BASIC_SKINS
 Instance::Instance( )
 {
 }
@@ -212,23 +101,51 @@ IMPLEMENT_APP_NO_MAIN(Instance)
 
 bool Instance::OnInit()
 {
-    // Set event callback. Yes, it's a big hack ;)
-//    gdk_event_handler_set( GTK2Proc, (gpointer)callbackobj, NULL );
-
     p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
+
+    // Create all the dialog boxes
     p_intf->p_sys->OpenDlg = new OpenDialog( p_intf, NULL, FILE_ACCESS );
     p_intf->p_sys->MessagesDlg = new Messages( p_intf, NULL );
     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 );
-    
-    // Add timer
-//    g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf );
+
+    // OK, initialization is over, now the other thread can go on working...
+    vlc_thread_ready( p_intf );
 
     return TRUE;
 }
-#endif
 
+int Instance::OnExit()
+{
+    // Delete evertything
+    delete p_intf->p_sys->InfoDlg;
+    delete p_intf->p_sys->PrefsDlg;
+    delete p_intf->p_sys->SoutDlg;
+    delete p_intf->p_sys->MessagesDlg;
+    delete p_intf->p_sys->OpenDlg;
+    delete p_intf->p_sys->p_icon;
+
+    return 0;
+}
+
+//---------------------------------------------------------------------------
+// Thread callback
+// We create all wxWindows dialogs in a separate thread because we don't want
+// any interaction with our own message loop
+//---------------------------------------------------------------------------
+void SkinsDialogsThread( intf_thread_t *p_intf )
+{
+    /* Hack to pass the p_intf pointer to the new wxWindow Instance object */
+    wxTheApp = new Instance( p_intf );
+
+    static char  *p_args[] = { "" };
+    wxEntry( 1, p_args );
+
+    return;
+}
+
+#endif // WX_SKINS
 
 //---------------------------------------------------------------------------
 // X11 event processing
@@ -290,7 +207,9 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
     {
         if( !proc->EventProc( evt ) )
         {
-//            wxExit();
+#ifndef BASIC_SKINS
+            wxExit();
+#endif
             return;      // Exit VLC !
         }
     }
@@ -328,12 +247,11 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
     evt->DestructParameters();
     delete (OSEvent *)evt;
 
-// Check if vlc is closing
+    // Check if vlc is closing
     proc->IsClosing();
 
 }
 
-
 //---------------------------------------------------------------------------
 // X11 interface
 //---------------------------------------------------------------------------
@@ -342,10 +260,16 @@ void OSRun( intf_thread_t *p_intf )
     static char  *p_args[] = { "" };
 
     VlcProc *proc = new VlcProc( p_intf );
-    
+
 #ifndef BASIC_SKINS
-    wxTheApp = new Instance( p_intf );
-    wxEntry( 1, p_args );
+    // Create a new thread for wxWindows
+    if( vlc_thread_create( p_intf, "Skins Dialogs Thread", SkinsDialogsThread,
+                           0, VLC_TRUE ) )
+    {
+        msg_Err( p_intf, "cannot create SkinsDialogsThread" );
+        // Don't even enter the main loop
+        return;
+    }
 #endif
 
     Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
index 23041b5fbdac1984abafa8bef0ad97a3a4413ec1..891f70fb31368f787bd9f547b3c990cd8bb8fc28 100644 (file)
@@ -2,7 +2,7 @@
  * x11_window.cpp: X11 implementation of the Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.6 2003/05/24 21:28:29 asmax Exp $
+ * $Id: x11_window.cpp,v 1.7 2003/05/26 02:09:27 gbazin Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -114,7 +114,7 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
     ToolTipWindow = gdk_window_new( gwnd, &attr, mask);*/
 
     Open();
-    fprintf(stderr, "kludge in x11_window.cpp\n");
+    //fprintf(stderr, "kludge in x11_window.cpp\n");
 
 }
 //---------------------------------------------------------------------------
@@ -149,13 +149,13 @@ void X11Window::OSShow( bool show )
 {
     if( show )
     {
-/*        gdk_window_show( gWnd );
-        gdk_window_move( gWnd, Left, Top );*/
+        XMapWindow( display, Wnd );
         XMoveWindow( display, Wnd, Left, Top );
     }
     else
     {
-/*        gdk_window_hide( gWnd );*/
+        //XWithdrawWindow( display, Wnd, 0 );
+        XUnmapWindow( display, Wnd );
     }
 }
 //---------------------------------------------------------------------------
@@ -164,13 +164,13 @@ bool X11Window::ProcessOSEvent( Event *evt )
     unsigned int msg = evt->GetMessage();
     unsigned int p1  = evt->GetParam1();
     int          p2  = evt->GetParam2();
+
     switch( msg )
     {
         case Expose:
             RefreshFromImage( 0, 0, Width, Height );
             return true;
+
         case MotionNotify:
             if( LButtonDown )
                 MouseMove( (int)( (XMotionEvent *)p2 )->x,
@@ -192,7 +192,7 @@ bool X11Window::ProcessOSEvent( Event *evt )
             {
                 XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() );
             }
-          
+
             switch( ( (XButtonEvent *)p2 )->button )
             {
                 case 1: