dnl
AC_CHECK_HEADERS(zlib.h, [
LDFLAGS_mp4="${LDFLAGS_mp4} -lz"
+ LDFLAGS_skins="${LDFLAGS_skins} -lz"
+ LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lz"
] )
* skin_common.h: Private Skin interface description
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: skin_common.h,v 1.10 2003/05/26 02:09:27 gbazin Exp $
+ * $Id: skin_common.h,v 1.11 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#ifdef X11_SKINS
Display *display;
+ Window mainWin; // Window which receives "broadcast" events
#endif
#ifdef WIN32
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.28 2003/05/26 19:06:47 gbazin Exp $
+ * $Id: skin_main.cpp,v 1.29 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
-
if( p_intf->p_sys->p_input )
{
vlc_object_release( p_intf->p_sys->p_input );
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.27 2003/05/29 21:40:27 asmax Exp $
+ * $Id: vlcproc.cpp,v 1.28 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
return true;
case VLC_OPEN:
- // FIXME: just for testing
+#ifndef BASIC_SKINS
wxMutexGuiEnter();
OpenFile( true );
wxMutexGuiLeave();
+#endif
return true;
case VLC_LOAD_SKIN:
return true;
case VLC_PLAYLIST_ADD_FILE:
- // FIXME: just for testing
+#ifndef BASIC_SKINS
wxMutexGuiEnter();
OpenFile( false );
wxMutexGuiLeave();
+#endif
return true;
#ifndef BASIC_SKINS
case VLC_LOG_SHOW:
- // FIXME: just for testing
wxMutexGuiEnter();
p_intf->p_sys->MessagesDlg->Show(
!p_intf->p_sys->MessagesDlg->IsShown() );
return true;
case VLC_PREFS_SHOW:
- // FIXME: just for testing
wxMutexGuiEnter();
p_intf->p_sys->PrefsDlg->Show(
!p_intf->p_sys->PrefsDlg->IsShown() );
return true;
case VLC_INFO_SHOW:
- // FIXME: just for testing
wxMutexGuiEnter();
p_intf->p_sys->InfoDlg->Show(
!p_intf->p_sys->InfoDlg->IsShown() );
* x11_api.cpp: Various x11-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_api.cpp,v 1.3 2003/05/28 23:56:51 asmax Exp $
+ * $Id: x11_api.cpp,v 1.4 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
if( win == NULL )
{
// broadcast message
- list<SkinWindow *>::const_iterator w;
- for( w = g_pIntf->p_sys->p_theme->WindowList.begin();
- w != g_pIntf->p_sys->p_theme->WindowList.end(); w++ )
- {
- event.xclient.window = (( X11Window *)*w)->GetHandle();
- XSendEvent( g_pIntf->p_sys->display, event.xclient.window, False, 0, &event );
- }
+ event.xclient.window = g_pIntf->p_sys->mainWin;
}
else
{
event.xclient.window = (( X11Window *)win)->GetHandle();
- XSendEvent( g_pIntf->p_sys->display, event.xclient.window, False, 0, &event );
}
+ XSendEvent( g_pIntf->p_sys->display, event.xclient.window, False, 0, &event );
}
//---------------------------------------------------------------------------
* x11_bitmap.cpp: X11 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_bitmap.cpp,v 1.7 2003/05/29 21:40:27 asmax Exp $
+ * $Id: x11_bitmap.cpp,v 1.8 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
AlphaColor = (AColor & 0xff) << 16 | (AColor & 0xff00) |
(AColor & 0xff0000) >> 16;
-
+
imlib_context_set_display( display );
imlib_context_set_visual( visual );
imlib_context_set_colormap( DefaultColormap( display, screen ) );
* x11_font.cpp: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_font.cpp,v 1.3 2003/05/19 21:39:34 asmax Exp $
+ * $Id: x11_font.cpp,v 1.4 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
- * Emmanuel Puig <karibu@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
+#include "../src/skin_common.h"
#include "../src/graphics.h"
#include "../os_graphics.h"
#include "../src/font.h"
#include "../os_font.h"
-
+// FIXME ...
+extern intf_thread_t *g_pIntf;
//---------------------------------------------------------------------------
// Font object
int color, int weight, bool italic, bool underline )
: SkinFont( _p_intf, fontname, size, color, weight, italic, underline )
{
-/* Context = gdk_pango_context_get();
- Layout = pango_layout_new( Context );
-
- // Text properties setting
- FontDesc = pango_font_description_new();
-
- pango_font_description_set_family( FontDesc, fontname.c_str() );
-
- pango_font_description_set_size( FontDesc, size * PANGO_SCALE );
+ display = g_pIntf->p_sys->display;
- if( italic )
- {
- pango_font_description_set_style( FontDesc, PANGO_STYLE_ITALIC );
- }
- else
- {
- pango_font_description_set_style( FontDesc, PANGO_STYLE_NORMAL );
- }
-
- pango_font_description_set_weight( FontDesc, (PangoWeight)weight );
-
- //pango_context_set_font_description( Context, FontDesc );
- pango_layout_set_font_description( Layout, FontDesc );
-
- // Set attributes
- PangoAttrList *attrs = pango_attr_list_new();
- // FIXME: doesn't work
- if( underline )
- {
- pango_attr_list_insert( attrs,
- pango_attr_underline_new( PANGO_UNDERLINE_SINGLE ) );
- }
- pango_layout_set_attributes( Layout, attrs );*/
+ // FIXME: just a beginning...
+ font = XLoadFont( display, "-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*" );
}
//---------------------------------------------------------------------------
X11Font::~X11Font()
//---------------------------------------------------------------------------
void X11Font::GetSize( string text, int &w, int &h )
{
- w = 42;
- h = 12;
-/* pango_layout_set_text( Layout, text.c_str(), text.length() );
- pango_layout_get_pixel_size( Layout, &w, &h );*/
+ int direction, fontAscent, fontDescent;
+ XCharStruct overall;
+
+ XQueryTextExtents( display, font, text.c_str(), text.size(), &direction,
+ &fontAscent, &fontDescent, &overall );
+
+ w = overall.rbearing - overall.lbearing;
+ h = overall.ascent + overall.descent;
}
//---------------------------------------------------------------------------
void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
int w, int h, int align, int color )
{
-/* // Set text
- pango_layout_set_text( Layout, text.c_str(), -1 );
-
- // Set size
- pango_layout_set_width( Layout, -1 );
- int real_w, real_h;
-
- // Create buffer image
- Graphics* cov = (Graphics *)new OSGraphics( w, h );
- cov->CopyFrom( 0, 0, w, h, dest, x, y, SRC_COPY );
-
// Get handles
- GdkDrawable *drawable = ( (X11Graphics *)cov )->GetImage();
- GdkGC *gc = ( (X11Graphics *)cov )->GetGC();
+ Drawable drawable = ( (X11Graphics *)dest )->GetImage();
+ GC gc = ( (X11Graphics *)dest )->GetGC();
- // Set width of text
- pango_layout_set_width( Layout, w * PANGO_SCALE );
-
- // Set attributes
- pango_layout_set_alignment( Layout, (PangoAlignment)align );
-
- // Avoid transârency for black text
- if( color == 0 ) color = 10;
- gdk_rgb_gc_set_foreground( gc, color );
+ XGCValues gcVal;
+ gcVal.foreground = (color == 0 ? 10 : color);
+ gcVal.font = font;
+ XChangeGC( display, gc, GCForeground|GCFont, &gcVal );
// Render text on buffer
- gdk_draw_layout( drawable, gc, 0, 0, Layout );
-
- // Copy buffer on dest graphics
- dest->CopyFrom( x, y, w, h, cov, 0, 0, SRC_COPY );
-
- // Free memory
- delete (OSGraphics *)cov;*/
+ XDrawString( display, drawable, gc, x, y+h, text.c_str(), text.size());
}
//---------------------------------------------------------------------------
* x11_font.h: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_font.h,v 1.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_font.h,v 1.2 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
class X11Font : SkinFont
{
private:
-/* PangoContext *Context;
- PangoLayout *Layout;
- PangoFontDescription *FontDesc;*/
+ Display *display;
+ Font font;
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
* x11_graphics.cpp: X11 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.cpp,v 1.4 2003/05/26 02:09:27 gbazin Exp $
+ * $Id: x11_graphics.cpp,v 1.5 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
}
// Set the background color to black
+ XGCValues gcVal;
+ gcVal.foreground = 0;
+ XChangeGC( display, Gc, GCForeground, &gcVal );
XFillRectangle( display, Image, Gc, 0, 0, w, h );
}
//---------------------------------------------------------------------------
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.11 2003/05/29 16:48:29 asmax Exp $
+ * $Id: x11_run.cpp,v 1.12 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
return 1; // Exit VLC !
}
}
+ else if( wnd == p_intf->p_sys->mainWin )
+ {
+ // Broadcast event
+ 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
SkinManage( p_intf ); // Call every 100 ms
}
}
-
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
* x11_theme.cpp: X11 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_theme.cpp,v 1.7 2003/05/29 21:40:27 asmax Exp $
+ * $Id: x11_theme.cpp,v 1.8 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
X11Theme::X11Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
{
//Initialize values
- ParentWindow = 0;
+ p_intf = _p_intf;
display = p_intf->p_sys->display;
}
/* // The create menu
CreateSystemMenu();
*/
- // Set the parent window attributes
-/* GdkWindowAttr attr;
- attr.title = "VLC Media Player";
- attr.event_mask = GDK_ALL_EVENTS_MASK;
- attr.x = 0;
- attr.y = 0;
- attr.width = 0;
- attr.height = 0;
- attr.window_type = GDK_WINDOW_TOPLEVEL;
- attr.wclass = GDK_INPUT_ONLY;
- attr.override_redirect = FALSE;
-
- gint mask = GDK_WA_TITLE|GDK_WA_X|GDK_WA_Y|GDK_WA_NOREDIR;
-
- // Create the parent window
- ParentWindow = gdk_window_new( NULL, &attr, mask);
- if( !ParentWindow )
- {
- msg_Err( p_intf, "gdk_window_new failed" );
- return;
- }*/
-
-/* Window root = DefaultRootWindow( display );
- ParentWindow = XCreateSimpleWindow( display, root, 0, 0, 100, 100, 0, 0, 0 );
- XSelectInput( display, ParentWindow, ExposureMask|
- KeyPressMask|KeyReleaseMask|ButtonPressMask|PointerMotionMask|
- PointerMotionHintMask| EnterWindowMask|LeaveWindowMask);
-
- XMapRaised( display, ParentWindow );
- XFlush( display );*/
+ Window root = DefaultRootWindow( display );
+ p_intf->p_sys->mainWin = XCreateSimpleWindow( display, root, 0, 0, 1, 1,
+ 0, 0, 0 );
+ XStoreName( display, p_intf->p_sys->mainWin, "VLC Media Player" );
}
//---------------------------------------------------------------------------
void X11Theme::AddSystemMenu( string name, Event *event )
}
//---------------------------------------------------------------------------
void X11Theme::ChangeClientWindowName( string name )
-{/*
- SetWindowText( ParentWindow, name.c_str() );*/
+{
+ XStoreName( display, p_intf->p_sys->mainWin, name.c_str() );
}
//---------------------------------------------------------------------------
void X11Theme::AddWindow( string name, int x, int y, bool visible,
int fadetime, int alpha, int movealpha, bool dragdrop )
{
-/* GdkWindowAttr attr;
- attr.title = (gchar *)name.c_str();
- attr.event_mask = GDK_ALL_EVENTS_MASK;
- attr.width = 0;
- attr.height = 0;
- attr.window_type = GDK_WINDOW_TOPLEVEL;
- attr.wclass = GDK_INPUT_OUTPUT;
- attr.override_redirect = FALSE;
-
- gint mask = GDK_WA_NOREDIR;
-
- // Create the window
- GdkWindow *gwnd = gdk_window_new( NULL, &attr, mask );
- if( !gwnd )
- {
- msg_Err( p_intf, "gdk_window_new failed" );
- return;
- }
-
- gdk_window_set_decorations( gwnd, (GdkWMDecoration)0 );
-
- gdk_window_show( gwnd );*/
-
// Create the window
Window root = DefaultRootWindow( display );
XSetWindowAttributes attr;
PropModeReplace, (unsigned char *)&motifWmHints,
sizeof( motifWmHints ) / sizeof( long ) );
+ // Change the window title
+ XStoreName( display, wnd, name.c_str() );
+
// Display the window
XMapRaised( display, wnd );
* x11_theme.h: X11 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: x11_theme.h,v 1.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_theme.h,v 1.2 2003/06/01 16:39:49 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
class X11Theme : public Theme
{
protected:
+ intf_thread_t *p_intf;
// Handles
Display *display;
- Window ParentWindow;
/*
// System tray icon
NOTIFYICONDATA TrayIcon;
// Specific methods
Display * GetDisplay() { return display; }
- Window GetParentWindow() { return ParentWindow; }
// !!!
virtual void AddWindow( string name, int x, int y, bool visible,