Commit 9de7a7eb authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/skins: got rid of init_lock and init_cond which aren't needed if you use vlc_thread_ready().
   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.
parent 8556d7ee
...@@ -2431,10 +2431,22 @@ if test "x${enable_skins}" != "xno"; then ...@@ -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" LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
else else
if test "x${enable_skins}" = "xyes"; then if test "x${enable_skins}" = "xyes"; then
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]) PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
PLUGINS="${PLUGINS} skins"
CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS" CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins ${GTK2_CFLAGS} -DGTK2_SKINS"
LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ ${GTK2_LIBS}" 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"
fi fi
fi fi
fi fi
...@@ -2446,15 +2458,26 @@ AC_ARG_ENABLE(basic-skins, ...@@ -2446,15 +2458,26 @@ AC_ARG_ENABLE(basic-skins,
[ --enable-basic-skins Skins interface module without wxWindows dialogs (default disabled)]) [ --enable-basic-skins Skins interface module without wxWindows dialogs (default disabled)])
if test "x${enable_basic_skins}" = "xyes"; then if test "x${enable_basic_skins}" = "xyes"; then
if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; 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" 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" LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
else else
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]) 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" 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}" 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
fi
PLUGINS="${PLUGINS} basic_skins"
CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -DBASIC_SKINS" CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -DBASIC_SKINS"
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* button.cpp: Button control * button.cpp: Button control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@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 ) ...@@ -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 ) bool ControlButton::MouseUp( int x, int y, int button )
{ {
// If hit in the button // If hit in the button
if( Img[1]->Hit( x - Left, y - Top ) ) if( Img[1]->Hit( x - Left, y - Top ) )
{ {
if( !Enabled ) if( !Enabled )
...@@ -148,8 +146,8 @@ bool ControlButton::MouseUp( int x, int y, int button ) ...@@ -148,8 +146,8 @@ bool ControlButton::MouseUp( int x, int y, int button )
Selected = false; Selected = false;
ClickAction->SendEvent(); ClickAction->SendEvent();
ParentWindow->Refresh( Left, Top, Width, Height ); ParentWindow->Refresh( Left, Top, Width, Height );
return true;
} }
return true;
} }
if( button == 1 ) if( button == 1 )
...@@ -170,8 +168,8 @@ bool ControlButton::MouseDown( int x, int y, int button ) ...@@ -170,8 +168,8 @@ bool ControlButton::MouseDown( int x, int y, int button )
State = 0; State = 0;
Selected = true; Selected = true;
ParentWindow->Refresh( Left, Top, Width, Height ); ParentWindow->Refresh( Left, Top, Width, Height );
return true;
} }
return true;
} }
return false; return false;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description * skin_common.h: Private Skin interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -83,10 +83,6 @@ struct intf_sys_t ...@@ -83,10 +83,6 @@ struct intf_sys_t
SoutDialog *SoutDlg; SoutDialog *SoutDlg;
PrefsDialog *PrefsDlg; PrefsDialog *PrefsDlg;
FileInfo *InfoDlg; FileInfo *InfoDlg;
// Wait wxwindows initialization
vlc_mutex_t init_lock;
vlc_cond_t init_cond;
#endif #endif
#ifdef X11_SKINS #ifdef X11_SKINS
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -157,12 +157,6 @@ static int Open ( vlc_object_t *p_this ) ...@@ -157,12 +157,6 @@ static int Open ( vlc_object_t *p_this )
#endif #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 ); p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
return( 0 ); return( 0 );
...@@ -192,12 +186,6 @@ static void Close ( vlc_object_t *p_this ) ...@@ -192,12 +186,6 @@ static void Close ( vlc_object_t *p_this )
// Unsuscribe to messages bank // Unsuscribe to messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub ); 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 #ifdef WIN32
// Unload msimg32.dll and user32.dll // Unload msimg32.dll and user32.dll
if( p_intf->p_sys->h_msimg32_dll ) if( p_intf->p_sys->h_msimg32_dll )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -327,6 +327,7 @@ void SkinWindow::RefreshAll() ...@@ -327,6 +327,7 @@ void SkinWindow::RefreshAll()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void SkinWindow::MouseDown( int x, int y, int button ) void SkinWindow::MouseDown( int x, int y, int button )
{ {
// Checking event in controls // Checking event in controls
for( int i = ControlList.size() - 1; i >= 0 ; i-- ) for( int i = ControlList.size() - 1; i >= 0 ; i-- )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* win32_run.cpp: * win32_run.cpp:
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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 Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -128,9 +128,7 @@ bool Instance::OnInit() ...@@ -128,9 +128,7 @@ bool Instance::OnInit()
p_intf->p_sys->p_kludgy_timer->Start( 100 ); p_intf->p_sys->p_kludgy_timer->Start( 100 );
// OK, initialization is over, now the other thread can go on working... // OK, initialization is over, now the other thread can go on working...
vlc_mutex_lock( &p_intf->p_sys->init_lock ); vlc_thread_ready( p_intf );
vlc_cond_signal( &p_intf->p_sys->init_cond );
vlc_mutex_unlock( &p_intf->p_sys->init_lock );
return TRUE; return TRUE;
} }
...@@ -231,15 +229,12 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -231,15 +229,12 @@ void OSRun( intf_thread_t *p_intf )
#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,
0, 0 ) ) 0, VLC_TRUE ) )
{ {
msg_Err( p_intf, "cannot create SkinsDialogsThread" ); msg_Err( p_intf, "cannot create SkinsDialogsThread" );
// Don't even enter the main loop // Don't even enter the main loop
return; 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 #endif
// Create refresh timer // Create refresh timer
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_graphics.cpp: X11 implementation of the Graphics and Region classes * x11_graphics.cpp: X11 implementation of the Graphics and Region classes
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -115,22 +115,17 @@ void X11Graphics::ResetClipRegion() ...@@ -115,22 +115,17 @@ void X11Graphics::ResetClipRegion()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
X11Region::X11Region() X11Region::X11Region()
{ {
/* Rgn = gdk_region_new();*/ RefPoint.x = RefPoint.y = 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
X11Region::X11Region( int x, int y, int w, int h ) X11Region::X11Region( int x, int y, int w, int h )
{ {
/* GdkRectangle rect; RefPoint.x = RefPoint.y = 0;
rect.x = x; AddRectangle( x, y, w, h );
rect.y = y;
rect.width = w;
rect.height = h;
Rgn = gdk_region_rectangle( &rect );*/
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
X11Region::~X11Region() X11Region::~X11Region()
{ {
/* gdk_region_destroy( Rgn );*/
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void X11Region::AddPoint( int x, int y ) void X11Region::AddPoint( int x, int y )
...@@ -140,57 +135,59 @@ 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 ) void X11Region::AddRectangle( int x, int y, int w, int h )
{ {
/* GdkRectangle rect; CoordsRectangle coords;
rect.x = x; coords.x = x - RefPoint.x; coords.y = y - RefPoint.y;
rect.y = y; coords.w = w; coords.h = h;
rect.width = w; RectanglesList.push_back( coords );
rect.height = h;
GdkRegion *Buffer = gdk_region_rectangle( &rect );
gdk_region_union( Rgn, Buffer );*/
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void X11Region::AddElipse( int x, int y, int w, int h ) void X11Region::AddElipse( int x, int y, int w, int h )
{ {
/* GdkRegion *Buffer; CoordsElipse coords;
GdkRectangle rect; coords.x = x - RefPoint.x; coords.y = y - RefPoint.y;
rect.height = 1; coords.w = w; coords.h = h;
ElipsesList.push_back( coords );
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 );
}*/
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void X11Region::Move( int x, int y ) 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 ) 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;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_graphics.h: X11 implementation of the Graphics and Region classes * x11_graphics.h: X11 implementation of the Graphics and Region classes
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr> * Olivier Teulire <ipkiss@via.ecp.fr>
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#ifndef VLC_SKIN_X11_GRAPHICS #ifndef VLC_SKIN_X11_GRAPHICS
#define VLC_SKIN_X11_GRAPHICS #define VLC_SKIN_X11_GRAPHICS
//--- GENERAL ---------------------------------------------------------------
#include <vector>
using namespace std;
//--- X11 ------------------------------------------------------------------- //--- X11 -------------------------------------------------------------------
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
...@@ -36,6 +40,10 @@ ...@@ -36,6 +40,10 @@
class SkinRegion; class SkinRegion;
class SkinWindow; 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 class X11Graphics : public Graphics
{ {
...@@ -85,6 +93,11 @@ class X11Region : public SkinRegion ...@@ -85,6 +93,11 @@ class X11Region : public SkinRegion
// Specific X11 methods // Specific X11 methods
Region *GetHandle() { return Rgn; }; Region *GetHandle() { return Rgn; };
vector<CoordsRectangle> RectanglesList;
vector<CoordsElipse> ElipsesList;
CoordsPoint RefPoint;
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -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.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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
//--- X11 ------------------------------------------------------------------- //--- X11 -------------------------------------------------------------------
#include <X11/Xlib.h> #include <X11/Xlib.h>
//--- WWWINDOWS ------------------------------------------------------------- //--- WXWINDOWS -------------------------------------------------------------
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wx.h> #include <wx/wx.h>
#endif #endif
...@@ -46,6 +48,7 @@ ...@@ -46,6 +48,7 @@
#include "../os_theme.h" #include "../os_theme.h"
#include "../src/skin_common.h" #include "../src/skin_common.h"
#include "../src/vlcproc.h" #include "../src/vlcproc.h"
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
#include "../../wxwindows/wxwindows.h" #include "../../wxwindows/wxwindows.h"
#endif #endif
...@@ -63,10 +66,10 @@ bool IsVLCEvent( unsigned int msg ); ...@@ -63,10 +66,10 @@ bool IsVLCEvent( unsigned int msg );
int SkinManage( intf_thread_t *p_intf ); int SkinManage( intf_thread_t *p_intf );
#ifndef BASIC_SKINS
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Local classes declarations. // Local classes declarations.
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#ifndef BASIC_SKINS
class Instance: public wxApp class Instance: public wxApp
{ {
public: public:
...@@ -74,130 +77,16 @@ public: ...@@ -74,130 +77,16 @@ public:
Instance( intf_thread_t *_p_intf ); Instance( intf_thread_t *_p_intf );
bool OnInit(); bool OnInit();
int OnExit();
OpenDialog *open; OpenDialog *open;
private: private:
intf_thread_t *p_intf; 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 // Implementation of Instance class
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#ifndef BASIC_SKINS
Instance::Instance( ) Instance::Instance( )
{ {
} }
...@@ -212,23 +101,51 @@ IMPLEMENT_APP_NO_MAIN(Instance) ...@@ -212,23 +101,51 @@ IMPLEMENT_APP_NO_MAIN(Instance)
bool Instance::OnInit() 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 ); 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->OpenDlg = new OpenDialog( p_intf, NULL, FILE_ACCESS );
p_intf->p_sys->MessagesDlg = new Messages( p_intf, NULL ); p_intf->p_sys->MessagesDlg = new Messages( p_intf, NULL );
p_intf->p_sys->SoutDlg = new SoutDialog( 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->PrefsDlg = new PrefsDialog( p_intf, NULL );
p_intf->p_sys->InfoDlg = new FileInfo( p_intf, NULL ); p_intf->p_sys->InfoDlg = new FileInfo( p_intf, NULL );
// Add timer // OK, initialization is over, now the other thread can go on working...
// g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf ); vlc_thread_ready( p_intf );
return TRUE; 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 // X11 event processing
...@@ -290,7 +207,9 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -290,7 +207,9 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
{ {
if( !proc->EventProc( evt ) ) if( !proc->EventProc( evt ) )
{ {
// wxExit(); #ifndef BASIC_SKINS
wxExit();
#endif
return; // Exit VLC ! return; // Exit VLC !
} }
} }
...@@ -328,12 +247,11 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event ) ...@@ -328,12 +247,11 @@ void ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
evt->DestructParameters(); evt->DestructParameters();
delete (OSEvent *)evt; delete (OSEvent *)evt;
// Check if vlc is closing // Check if vlc is closing
proc->IsClosing(); proc->IsClosing();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// X11 interface // X11 interface
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -344,8 +262,14 @@ void OSRun( intf_thread_t *p_intf ) ...@@ -344,8 +262,14 @@ void OSRun( intf_thread_t *p_intf )
VlcProc *proc = new VlcProc( p_intf ); VlcProc *proc = new VlcProc( p_intf );
#ifndef BASIC_SKINS #ifndef BASIC_SKINS
wxTheApp = new Instance( p_intf ); // Create a new thread for wxWindows
wxEntry( 1, p_args ); 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 #endif
Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay(); Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class * x11_window.cpp: X11 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -114,7 +114,7 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y, ...@@ -114,7 +114,7 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
ToolTipWindow = gdk_window_new( gwnd, &attr, mask);*/ ToolTipWindow = gdk_window_new( gwnd, &attr, mask);*/
Open(); 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 ) ...@@ -149,13 +149,13 @@ void X11Window::OSShow( bool show )
{ {
if( show ) if( show )
{ {
/* gdk_window_show( gWnd ); XMapWindow( display, Wnd );
gdk_window_move( gWnd, Left, Top );*/
XMoveWindow( display, Wnd, Left, Top ); XMoveWindow( display, Wnd, Left, Top );
} }
else else
{ {
/* gdk_window_hide( gWnd );*/ //XWithdrawWindow( display, Wnd, 0 );
XUnmapWindow( display, Wnd );
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
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