]> git.sesse.net Git - vlc/commitdiff
* configure.ac.in : fixed linking of skins modules
authorCyril Deguet <asmax@videolan.org>
Sun, 1 Jun 2003 16:39:49 +0000 (16:39 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 1 Jun 2003 16:39:49 +0000 (16:39 +0000)
* 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 !

12 files changed:
configure.ac.in
modules/gui/skins/src/skin_common.h
modules/gui/skins/src/skin_main.cpp
modules/gui/skins/src/vlcproc.cpp
modules/gui/skins/x11/x11_api.cpp
modules/gui/skins/x11/x11_bitmap.cpp
modules/gui/skins/x11/x11_font.cpp
modules/gui/skins/x11/x11_font.h
modules/gui/skins/x11/x11_graphics.cpp
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_theme.cpp
modules/gui/skins/x11/x11_theme.h

index 5d6389804b99e997e784e81a79ad7e95f6bdad28..2ab1e8d06e8656374a6438f8ab989ff38d7f6afc 100644 (file)
@@ -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"
 ] )
 
 
index 9bf7d093c62598e28bb34d08413288c34f3c8b8e..49a4c18c8e6b30f759201b0708f1a89a6ef716a1 100644 (file)
@@ -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 Teulière <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
index 71f4c60129a97d4b129171ecd367e2b93beddda5..a27cd9e6b9ce4ce1a4c0310d30439bb5e04566a0 100644 (file)
@@ -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 Teulière <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 );
index 265762d95a35d65450e4c078f670da15a9fe98f4..bf26dca93ab370ebf8518fe056786c92795fb7bc 100644 (file)
@@ -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 Teulière <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() );
index 32094240cdd05d6397e329ae1ab084885af07d50..248e874ef7c592d380470aba88a747035f5496d3 100644 (file)
@@ -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 );
 }
 //---------------------------------------------------------------------------
 
index 52479c0495ae3e78cac750be088ea055032eafe6..c9442b5bbeb97d11347fce81e08ac672da70c544 100644 (file)
@@ -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 ) );
index 4cd206629ffb7f46c24bb0a2f5a763b958cd88f9..cbd4848169d2c49042433e555301b54671ab103d 100644 (file)
@@ -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
 #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 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());
 }
 
 //---------------------------------------------------------------------------
index 5d4e3baa46c7f4794325c0fd8b4c4641b7c5dec1..b37e349360defef97221c59fe936b179b9a618ab 100644 (file)
@@ -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 );
index 17f1e63c4c84cc79f1e3a2f004c83ee7c48c4ac9..ae3fdecaf624bdaee7f40e6c3179bd45e658b4f3 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.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 );    
 }
 //---------------------------------------------------------------------------
index 9670691f25fd205208353b5438c6043f44746dae..f80dc8bc12b889a0c4dfd6be64fbe2e40b19ecb8 100644 (file)
@@ -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 )
index deef1c140940fb637465b7b9be623c0a8be0cbbb..94e702d9372e0d922e463d6171fd3ba4e285104c 100644 (file)
@@ -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 );
 
index 68e8caa43fee233442fe7f54cf41d7b9a1572927..173ac6673e4d2a7ed1eab1ff0b8ad5013011592a 100644 (file)
@@ -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,