Commit 44fb33ab authored by Cyril Deguet's avatar Cyril Deguet

* configure.ac.in : fixed linking of skins modules

* modules/gui/skins/*:
  - fixed the wxwindows bug, due to a huge bug with broadcast events
  - beginning of fonts in X11 skins
so, you can test the X11 skins module: it should work now !
parent 1a7ed93b
......@@ -1706,6 +1706,8 @@ dnl MP4 module
dnl
AC_CHECK_HEADERS(zlib.h, [
LDFLAGS_mp4="${LDFLAGS_mp4} -lz"
LDFLAGS_skins="${LDFLAGS_skins} -lz"
LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lz"
] )
......
......@@ -2,7 +2,7 @@
* 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 Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -87,6 +87,7 @@ struct intf_sys_t
#ifdef X11_SKINS
Display *display;
Window mainWin; // Window which receives "broadcast" events
#endif
#ifdef WIN32
......
......@@ -2,7 +2,7 @@
* 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 Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -169,7 +169,6 @@ static void Close ( vlc_object_t *p_this )
{
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 );
......
......@@ -2,7 +2,7 @@
* 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 Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -102,10 +102,11 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_OPEN:
// FIXME: just for testing
#ifndef BASIC_SKINS
wxMutexGuiEnter();
OpenFile( true );
wxMutexGuiLeave();
#endif
return true;
case VLC_LOAD_SKIN:
......@@ -137,15 +138,15 @@ bool VlcProc::EventProc( Event *evt )
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() );
......@@ -156,7 +157,6 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_PREFS_SHOW:
// FIXME: just for testing
wxMutexGuiEnter();
p_intf->p_sys->PrefsDlg->Show(
!p_intf->p_sys->PrefsDlg->IsShown() );
......@@ -164,7 +164,6 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_INFO_SHOW:
// FIXME: just for testing
wxMutexGuiEnter();
p_intf->p_sys->InfoDlg->Show(
!p_intf->p_sys->InfoDlg->IsShown() );
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -68,19 +68,13 @@ void OSAPI_PostMessage( SkinWindow *win, unsigned int message, unsigned int para
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 );
}
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -73,7 +73,7 @@ X11Bitmap::X11Bitmap( intf_thread_t *_p_intf, string FileName, int AColor )
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 ) );
......
......@@ -2,10 +2,9 @@
* 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
......@@ -32,12 +31,14 @@
#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
......@@ -46,39 +47,10 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
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()
......@@ -91,48 +63,30 @@ void X11Font::AssignFont( Graphics *dest )
//---------------------------------------------------------------------------
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 transrency 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());
}
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -41,9 +41,8 @@ class Graphics;
class X11Font : SkinFont
{
private:
/* PangoContext *Context;
PangoLayout *Layout;
PangoFontDescription *FontDesc;*/
Display *display;
Font font;
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
......
......@@ -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.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>
......@@ -69,6 +69,9 @@ X11Graphics::X11Graphics( intf_thread_t *p_intf, int w, int h,
}
// Set the background color to black
XGCValues gcVal;
gcVal.foreground = 0;
XChangeGC( display, Gc, GCForeground, &gcVal );
XFillRectangle( display, Image, Gc, 0, 0, w, h );
}
//---------------------------------------------------------------------------
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -209,6 +209,15 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
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
......@@ -280,7 +289,6 @@ void OSRun( intf_thread_t *p_intf )
SkinManage( p_intf ); // Call every 100 ms
}
}
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -53,7 +53,7 @@ void SkinManage( intf_thread_t *p_intf );
X11Theme::X11Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
{
//Initialize values
ParentWindow = 0;
p_intf = _p_intf;
display = p_intf->p_sys->display;
}
......@@ -89,36 +89,10 @@ void X11Theme::OnLoadTheme()
/* // 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 )
......@@ -135,36 +109,13 @@ 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;
......@@ -191,6 +142,9 @@ void X11Theme::AddWindow( string name, int x, int y, bool visible,
PropModeReplace, (unsigned char *)&motifWmHints,
sizeof( motifWmHints ) / sizeof( long ) );
// Change the window title
XStoreName( display, wnd, name.c_str() );
// Display the window
XMapRaised( display, wnd );
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -44,9 +44,9 @@ class FontBank;
class X11Theme : public Theme
{
protected:
intf_thread_t *p_intf;
// Handles
Display *display;
Window ParentWindow;
/*
// System tray icon
NOTIFYICONDATA TrayIcon;
......@@ -62,7 +62,6 @@ class X11Theme : public Theme
// Specific methods
Display * GetDisplay() { return display; }
Window GetParentWindow() { return ParentWindow; }
// !!!
virtual void AddWindow( string name, int x, int y, bool visible,
......
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