]> git.sesse.net Git - vlc/commitdiff
* enable basic-skins for GTK2 (not tested yet ;)
authorCyril Deguet <asmax@videolan.org>
Wed, 30 Apr 2003 21:16:24 +0000 (21:16 +0000)
committerCyril Deguet <asmax@videolan.org>
Wed, 30 Apr 2003 21:16:24 +0000 (21:16 +0000)
build-vlc
config.in
modules/gui/skins/gtk2/gtk2_run.cpp
modules/gui/skins/src/window.cpp
modules/gui/skins/x11/x11_bitmap.cpp
modules/gui/skins/x11/x11_graphics.cpp
modules/gui/skins/x11/x11_graphics.h

index dfbd4bba032c34a2a6900b19b26a041272e4e7e5..57ca1186587448e93c713f8c7cc17cb28fb0523f 100755 (executable)
--- a/build-vlc
+++ b/build-vlc
@@ -6,6 +6,7 @@ GNOME2 gnome2
 GTK gtk
 GTK2 gtk2
 SKINS skins
+BASIC_SKINS basic-skins
 FAMILIAR familiar
 WXWINDOWS wxwindows
 QT qt
index dcdf3727505c68f7f262de2f0176ab3b08d54e86..60a5d92318513bc56f0e2d1e95457c555f828804 100644 (file)
--- a/config.in
+++ b/config.in
@@ -16,6 +16,7 @@ dep_bool '   Gnome interface support' CONFIG_GNOME $CONFIG_GTK
 bool 'GTK2 support' CONFIG_GTK2
 dep_bool '   Gnome2 support' CONFIG_GNOME2 $CONFIG_GTK2
 bool 'Skins module' CONFIG_SKINS
+bool 'Basic skins module (without wxWindows)' CONFIG_BASIC_SKINS
 bool 'Familiar GTK+ support' CONFIG_FAMILIAR
 bool 'wxWindows support' CONFIG_WXWINDOWS
 bool 'Qt interface support' CONFIG_QT
index e0f296cb0a635f7daed68b5c442457dde70413d0..fb58dce68045ed395601b1ec15dad7ee6020d565 100644 (file)
@@ -2,7 +2,7 @@
  * gtk2_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: gtk2_run.cpp,v 1.21 2003/04/28 12:00:13 asmax Exp $
+ * $Id: gtk2_run.cpp,v 1.22 2003/04/30 21:16:24 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -30,7 +30,9 @@
 #include <gtk/gtk.h>
 
 //--- WWWINDOWS -------------------------------------------------------------
+#ifndef BASIC_SKINS
 #include <wx/wx.h>
+#endif
 
 //--- VLC -------------------------------------------------------------------
 #include <vlc/intf.h>
@@ -46,7 +48,9 @@
 #include "../os_theme.h"
 #include "../src/skin_common.h"
 #include "../src/vlcproc.h"
+#ifndef BASIC_SKINS
 #include "../src/wxdialogs.h"
+#endif
 
 // include the icon graphic
 #include "share/vlc32x32.xpm"
@@ -69,6 +73,7 @@ int  SkinManage( intf_thread_t *p_intf );
 //---------------------------------------------------------------------------
 // Local classes declarations.
 //---------------------------------------------------------------------------
+#ifndef BASIC_SKINS
 class Instance: public wxApp
 {
 public:
@@ -82,6 +87,7 @@ private:
     intf_thread_t *p_intf;
     CallBackObjects *callbackobj;
 };
+#endif
 
 
 //---------------------------------------------------------------------------
@@ -191,7 +197,9 @@ void GTK2Proc( GdkEvent *event, gpointer data )
     // Check if vlc is closing
     proc->IsClosing();
 
+#ifndef BASIC_SKINS
     gtk_main_do_event( event );
+#endif
 
 }
 //---------------------------------------------------------------------------
@@ -211,6 +219,7 @@ gboolean RefreshTimer( gpointer data )
 //---------------------------------------------------------------------------
 // Implementation of Instance class
 //---------------------------------------------------------------------------
+#ifndef BASIC_SKINS
 Instance::Instance( )
 {
 }
@@ -241,7 +250,7 @@ bool Instance::OnInit()
 
     return TRUE;
 }
-
+#endif
 
 
 //---------------------------------------------------------------------------
@@ -255,10 +264,15 @@ void OSRun( intf_thread_t *p_intf )
     CallBackObjects *callbackobj = new CallBackObjects();
     callbackobj->Proc = new VlcProc( p_intf );
 
+#ifndef BASIC_SKINS
     wxTheApp = new Instance( p_intf, callbackobj );
-
     wxEntry( 1, p_args );
-    
+#else
+    gdk_event_handler_set( GTK2Proc, (gpointer)callbackobj, NULL );
+    // Add timer
+    g_timeout_add( 200, (GSourceFunc)RefreshTimer, (gpointer)p_intf );
+#endif
+
     delete callbackobj;
 }
 //---------------------------------------------------------------------------
index bd8f75be8396fc8a6b92ccda42b609229930f355..e2001dbb8d4633570bf71360d6fa9346a29270e2 100644 (file)
@@ -2,7 +2,7 @@
  * window.cpp: Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: window.cpp,v 1.21 2003/04/28 12:00:14 asmax Exp $
+ * $Id: window.cpp,v 1.22 2003/04/30 21:16:24 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -290,6 +290,7 @@ void SkinWindow::RefreshImage( int x, int y, int w, int h )
     unsigned int i;
 
     // Create Bitmap Buffer
+//    Graphics *Buffer = (Graphics *)new OSGraphics( p_intf, w, h, this );
     Graphics *Buffer = (Graphics *)new OSGraphics( w, h, this );
 
     // Draw every control
@@ -490,9 +491,9 @@ void SkinWindow::ReSize()
         // Change image buffer
         if( Image != NULL )
             delete (OSGraphics *)Image;
+//        Image = (Graphics *)new OSGraphics( p_intf, w, h, this );
         Image = (Graphics *)new OSGraphics( w, h, this );
 
-
         Size( w, h );
     }
 
index 7246cd046cb701a50f2c4ba132698ca71184260e..3bcd88dd7e326851d47fd589701cc2541e2fd679 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.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_bitmap.cpp,v 1.2 2003/04/30 21:16:24 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -146,11 +146,10 @@ void X11Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
 {
     if( Bmp )
     {
-/*        GdkDrawable *destImg = ( (X11Graphics *)dest )->GetImage();
-        GdkGC *destGC = ( (X11Graphics *)dest )->GetGC();
+        Drawable destImg = ( (X11Graphics *)dest )->GetImage();
+        GdestGC = ( (X11Graphics *)dest )->GetGC();
 
-        gdk_pixbuf_render_to_drawable( Bmp, destImg, destGC, x, y, xRef, yRef, 
-                w, h, GDK_RGB_DITHER_NORMAL, 0, 0);*/
+        XCopyArea( display, Bmp, destImg, destGC, x, y, w, h, xRef, yRef );
     }
 }
 //---------------------------------------------------------------------------
index 7611e56763c80870721a9ac46e65b114c762d2dd..b28e8f8c4d6b05db44429e3d9aabce490f103b6d 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.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_graphics.cpp,v 1.2 2003/04/30 21:16:24 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
 //--- X11 -----------------------------------------------------------------
 #include <X11/Xlib.h>
 
+//--- VLC -----------------------------------------------------------------
+#include <vlc/intf.h>
+
 //--- SKIN ------------------------------------------------------------------
 #include "../src/graphics.h"
 #include "../src/window.h"
 #include "../os_window.h"
 #include "x11_graphics.h"
+#include "../src/skin_common.h"
 
 #include <stdio.h>
 #include <math.h>
 //---------------------------------------------------------------------------
 // X11 GRAPHICS
 //---------------------------------------------------------------------------
-X11Graphics::X11Graphics( int w, int h, SkinWindow *from ) : Graphics( w, h )
+X11Graphics::X11Graphics( intf_thread_t *p_intf, int w, int h,
+                          SkinWindow *from ) : Graphics( w, h )
 {
-/*    if( from != NULL )
+    display = p_intf->p_sys->display;
+    int screen = DefaultScreen( display );
+
+    if( from != NULL )
     {
-        GdkWindow *fromWnd = ( (X11Window *)from )->GetHandle();
-        Image = (GdkDrawable*) gdk_pixmap_new( fromWnd, w, h, -1 );
-        Gc = gdk_gc_new( ( GdkDrawable* )fromWnd );
+        Window fromWnd = ( (X11Window *)from )->GetHandle();
+
+        XWindowAttributes attr;
+        XGetWindowAttributes( display, fromWnd, &attr);
+
+        Image = XCreatePixmap( display, fromWnd, w, h, attr.depth );
+        Gc = DefaultGC( display, screen );
     }
     else
     {
-        // FIXME: 8 -> screen depth
-        Image = (GdkDrawable*) gdk_pixmap_new( NULL, w, h, 16 );
-        gdk_drawable_set_colormap( Image, gdk_colormap_get_system() );
-        Gc = gdk_gc_new( Image );
-    }
+        Window root = DefaultRootWindow( display );
+        Image = XCreatePixmap( display, root, w, h,
+                               DefaultDepth( display, screen ) );
+        Gc = DefaultGC( display, screen );
+   }
 
     // Set the background color to black
-    gdk_draw_rectangle( Image, Gc, TRUE, 0, 0, w, h );*/
+ //   gdk_draw_rectangle( Image, Gc, TRUE, 0, 0, w, h );
 }
 //---------------------------------------------------------------------------
 X11Graphics::~X11Graphics()
@@ -69,8 +81,8 @@ X11Graphics::~X11Graphics()
 void X11Graphics::CopyFrom( int dx, int dy, int dw, int dh, Graphics *Src,
                               int sx, int sy, int Flag )
 {
-/*    gdk_draw_drawable( Image, Gc, (( X11Graphics* )Src )->GetImage(),
-            sx, sy, dx, dy, dw, dh );*/
+    XCopyArea( display, (( X11Graphics* )Src )->GetImage(), Image, Gc, 
+            sx, sy, dw, dh, dx, dy );
 }
 //---------------------------------------------------------------------------
 void X11Graphics::DrawRect( int x, int y, int w, int h, int color )
index 69eae801e5693d601fa242b38d7a269d4a246e19..4cb537b7695937db6d91111b51c385e9703f1bd1 100644 (file)
@@ -2,7 +2,7 @@
  * x11_graphics.h: X11 implementation of the Graphics and Region classes
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_graphics.h,v 1.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_graphics.h,v 1.2 2003/04/30 21:16:24 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -40,12 +40,13 @@ class SkinWindow;
 class X11Graphics : public Graphics
 {
     protected:
-       /* Drawable *Image;
-        GdkGC *Gc;*/
+        Display *display;
+        Drawable Image;
+        GC Gc;
 
     public:
         // Constructor
-        X11Graphics( int w, int h, SkinWindow *from = NULL );
+        X11Graphics( intf_thread_t *p_intf, int w, int h, SkinWindow *from = NULL );
         // Destructor
         virtual ~X11Graphics();
         // Drawing methods
@@ -60,8 +61,8 @@ class X11Graphics : public Graphics
         virtual void ResetClipRegion();
 
         // Specific X11 methods
-/*        GdkDrawable *GetImage() { return Image; };
-        GdkGC *GetGC()    { return Gc; };*/
+        Drawable GetImage() { return Image; };
+        GC GetGC()    { return Gc; };
 };
 //---------------------------------------------------------------------------
 class X11Region : public SkinRegion