[ekiga/ds-gtk3-new: 1/7] X: remove the graphic context handling



commit 42a86772d99b7a49134981250c0b417b3e896b5c
Author: Damien Sandras <dsandras beip be>
Date:   Sun Mar 10 17:12:20 2013 +0100

    X: remove the graphic context handling
    
    The main reason behind to keep depending on GTK+-2.0 is because the
    rendering subsystem demanded the graphic context of the widget. But this is not
    mandatory. You can create a graphic context and use it in your widget.
    
    This patch removes the graphic context from the XWindow and XVWindow
    constructors and creates a new one in their initializations. Now Ekiga
    is not tied to GTK+-2.0, at least because of this.
    
    This behavior is similar what GStreamer's xvimagesink does.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=685404
    
    Thanks to Víctor Manuel Jáquez Leal for this patch!

 .../x-videooutput/videooutput-manager-x.cpp        |    2 +-
 lib/engine/gui/gtk-frontend/call-window.cpp        |    3 +--
 lib/gui/xvwindow.cpp                               |    4 +++-
 lib/gui/xvwindow.h                                 |    1 -
 lib/gui/xwindow.cpp                                |    4 +++-
 lib/gui/xwindow.h                                  |    1 -
 6 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/lib/engine/components/x-videooutput/videooutput-manager-x.cpp 
b/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
index c00faff..5491f4c 100644
--- a/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
+++ b/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
@@ -148,7 +148,7 @@ GMVideoOutputManager_x::create_window (Ekiga::DisplayInfo &info,
       cont = contX;
     }
 
-    if (win->Init (cont.display, cont.window, cont.gc,
+    if (win->Init (cont.display, cont.window,
                    cont.x, cont.y,
                    cont.wWidth, cont.wHeight,
                    cont.iWidth, cont.iHeight)) {
diff --git a/lib/engine/gui/gtk-frontend/call-window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
index 22ff019..5e5cdc6 100644
--- a/lib/engine/gui/gtk-frontend/call-window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -2580,8 +2580,7 @@ ekiga_call_window_expose_event (GtkWidget *widget,
     g_return_val_if_fail (cw->priv->video_widget_gc != NULL, handled);
   }
 
-  display_info.gc = GDK_GC_XGC (cw->priv->video_widget_gc);
-  display_info.window = GDK_WINDOW_XWINDOW (video_widget->window);
+  display_info.window = GDK_WINDOW_XID (gtk_widget_get_window (video_widget));
 
   g_return_val_if_fail (display_info.window != 0, handled);
 
diff --git a/lib/gui/xvwindow.cpp b/lib/gui/xvwindow.cpp
index 093af26..fc46d7b 100644
--- a/lib/gui/xvwindow.cpp
+++ b/lib/gui/xvwindow.cpp
@@ -114,7 +114,6 @@ XVWindow::~XVWindow()
 int 
 XVWindow::Init (Display* dp, 
                 Window rootWindow, 
-                GC gc, 
                 int x, 
                 int y,
                 int windowWidth, 
@@ -166,6 +165,9 @@ XVWindow::Init (Display* dp,
   } 
   PTRACE(4, "XVideo\tUsing XVideo port: " << _XVPort);
 
+  XGCValues values;
+  GC gc = XCreateGC (dp, rootWindow, 0, &values);
+
   if (!CreateAtomsAndWindow(gc, x, y, windowWidth, windowHeight)) {
     XUnlockDisplay(_display);
     return 0;
diff --git a/lib/gui/xvwindow.h b/lib/gui/xvwindow.h
index fa55375..3e6e988 100644
--- a/lib/gui/xvwindow.h
+++ b/lib/gui/xvwindow.h
@@ -82,7 +82,6 @@ public:
   
   virtual int Init (Display *dp, 
             Window xvWindow, 
-            GC gc, 
             int x, 
             int y, 
             int windowWidth, 
diff --git a/lib/gui/xwindow.cpp b/lib/gui/xwindow.cpp
index 98100ad..e673150 100644
--- a/lib/gui/xwindow.cpp
+++ b/lib/gui/xwindow.cpp
@@ -181,7 +181,6 @@ XWindow::~XWindow()
 int 
 XWindow::Init (Display* dp, 
                 Window rootWindow, 
-                GC gc, 
                 int x, 
                 int y,
                 int windowWidth, 
@@ -201,6 +200,9 @@ XWindow::Init (Display* dp,
   DumpVisuals();
 #endif
 
+  XGCValues values;
+  GC gc = XCreateGC (dp, rootWindow, 0, &values);
+
   if (!CreateAtomsAndWindow(gc, x, y, windowWidth, windowHeight)) {
     XUnlockDisplay(_display);
     return 0;
diff --git a/lib/gui/xwindow.h b/lib/gui/xwindow.h
index b5cdec9..ab02016 100644
--- a/lib/gui/xwindow.h
+++ b/lib/gui/xwindow.h
@@ -79,7 +79,6 @@ public:
   
   virtual int Init (Display *dp, 
             Window xvWindow, 
-            GC gc, 
             int x, 
             int y, 
             int windowWidth, 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]