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.
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
[ --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
* 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>
bool ControlButton::MouseUp( int x, int y, int button )
{
// If hit in the button
-
-
if( Img[1]->Hit( x - Left, y - Top ) )
{
if( !Enabled )
Selected = false;
ClickAction->SendEvent();
ParentWindow->Refresh( Left, Top, Width, Height );
- return true;
}
+ return true;
}
if( button == 1 )
State = 0;
Selected = true;
ParentWindow->Refresh( Left, Top, Width, Height );
- return true;
}
+ return true;
}
return false;
* 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>
SoutDialog *SoutDlg;
PrefsDialog *PrefsDlg;
FileInfo *InfoDlg;
-
- // Wait wxwindows initialization
- vlc_mutex_t init_lock;
- vlc_cond_t init_cond;
#endif
#ifdef X11_SKINS
* 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>
#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 );
// 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 )
* 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>
//---------------------------------------------------------------------------
void SkinWindow::MouseDown( int x, int y, int button )
{
+
// Checking event in controls
for( int i = ControlList.size() - 1; i >= 0 ; i-- )
{
* 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>
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;
}
#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
* 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>
//---------------------------------------------------------------------------
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 )
//---------------------------------------------------------------------------
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;
}
//---------------------------------------------------------------------------
* 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
{
// Specific X11 methods
Region *GetHandle() { return Rgn; };
+
+ vector<CoordsRectangle> RectanglesList;
+ vector<CoordsElipse> ElipsesList;
+
+ CoordsPoint RefPoint;
};
//---------------------------------------------------------------------------
* 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
#include "../os_theme.h"
#include "../src/skin_common.h"
#include "../src/vlcproc.h"
+
#ifndef BASIC_SKINS
#include "../../wxwindows/wxwindows.h"
#endif
int SkinManage( intf_thread_t *p_intf );
+#ifndef BASIC_SKINS
//---------------------------------------------------------------------------
// Local classes declarations.
//---------------------------------------------------------------------------
-#ifndef BASIC_SKINS
class Instance: public wxApp
{
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( )
{
}
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
{
if( !proc->EventProc( evt ) )
{
-// wxExit();
+#ifndef BASIC_SKINS
+ wxExit();
+#endif
return; // Exit VLC !
}
}
evt->DestructParameters();
delete (OSEvent *)evt;
-// Check if vlc is closing
+ // Check if vlc is closing
proc->IsClosing();
}
-
//---------------------------------------------------------------------------
// X11 interface
//---------------------------------------------------------------------------
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();
* 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>
*
ToolTipWindow = gdk_window_new( gwnd, &attr, mask);*/
Open();
- fprintf(stderr, "kludge in x11_window.cpp\n");
+ //fprintf(stderr, "kludge in x11_window.cpp\n");
}
//---------------------------------------------------------------------------
{
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 );
}
}
//---------------------------------------------------------------------------
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,
{
XRaiseWindow( display, ( (X11Window *)(*win) )->GetHandle() );
}
-
+
switch( ( (XButtonEvent *)p2 )->button )
{
case 1: