[gnome-terminal] Fix the build with gtk3 rendering-cleanup branch



commit cff281c9ed147036938d6bae10a4d63bbef167d3
Author: Christian Persch <chpe gnome org>
Date:   Sat Sep 11 12:51:49 2010 +0200

    Fix the build with gtk3 rendering-cleanup branch

 src/terminal-util.c   |   41 ++++++++++++++++++++++++++++++++++-------
 src/terminal-window.c |   21 ++++++++++++++++++++-
 2 files changed, 54 insertions(+), 8 deletions(-)
---
diff --git a/src/terminal-util.c b/src/terminal-util.c
index e57ee18..a49f1a0 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -1024,13 +1024,19 @@ gboolean
 terminal_util_x11_get_net_wm_desktop (GdkWindow *window,
 				      guint32   *desktop)
 {
-  GdkDisplay *display = gdk_drawable_get_display (window);
+  GdkDisplay *display;
   Atom type;
   int format;
   guchar *data;
   gulong n_items, bytes_after;
   gboolean result = FALSE;
 
+#if GTK_CHECK_VERSION (2, 90, 8)
+  display = gdk_window_get_display (window);
+#else
+  display = gdk_drawable_get_display (window);
+#endif
+
   if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
 			  GDK_DRAWABLE_XID (window),
 			  gdk_x11_get_xatom_by_name_for_display (display,
@@ -1067,13 +1073,21 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
    * http://bugzilla.gnome.org/show_bug.cgi?id=586311 asks for GTK+
    * to just handle everything behind the scenes including the desktop.
    */
-  GdkScreen *screen = gdk_drawable_get_screen (window);
-  GdkDisplay *display = gdk_screen_get_display (screen);
-  Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
+  GdkScreen *screen;
+  GdkDisplay *display;
+  Display *xdisplay;
   char *wm_selection_name;
   Atom wm_selection;
   gboolean have_wm;
 
+#if GTK_CHECK_VERSION (2, 90, 8)
+  screen = gdk_window_get_screen (window);
+#else
+  screen = gdk_drawable_get_screen (window);
+#endif
+  display = gdk_screen_get_display (screen);
+  xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
   wm_selection_name = g_strdup_printf ("WM_S%d", gdk_screen_get_number (screen));
   wm_selection = gdk_x11_get_xatom_by_name_for_display (display, wm_selection_name);
   g_free(wm_selection_name);
@@ -1133,10 +1147,17 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
 void
 terminal_util_x11_clear_demands_attention (GdkWindow *window)
 {
-  GdkScreen *screen = gdk_drawable_get_screen (window);
-  GdkDisplay *display = gdk_screen_get_display (screen);
+  GdkScreen *screen;
+  GdkDisplay *display;
   XClientMessageEvent xclient;
 
+#if GTK_CHECK_VERSION (2, 90, 8)
+  screen = gdk_window_get_screen (window);
+#else
+  screen = gdk_drawable_get_screen (window);
+#endif
+  display = gdk_screen_get_display (screen);
+
   memset (&xclient, 0, sizeof (xclient));
   xclient.type = ClientMessage;
   xclient.serial = 0;
@@ -1170,7 +1191,13 @@ terminal_util_x11_clear_demands_attention (GdkWindow *window)
 gboolean
 terminal_util_x11_window_is_minimized (GdkWindow *window)
 {
-  GdkDisplay *display = gdk_drawable_get_display (window);
+  GdkDisplay *display;
+
+#if GTK_CHECK_VERSION (2, 90, 8)
+  display = gdk_window_get_display (window);
+#else
+  display = gdk_drawable_get_display (window);
+#endif
 
   Atom type;
   gint format;
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 1a9f013..10143ce 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1524,11 +1524,29 @@ terminal_window_realize (GtkWidget *widget)
   TerminalWindowPrivate *priv = window->priv;
 #ifdef GDK_WINDOWING_X11
   GdkScreen *screen;
-  GdkColormap *colormap;
   GtkAllocation widget_allocation;
+#if GTK_CHECK_VERSION (2, 90, 8)
+  GdkVisual *visual;
+#else
+  GdkColormap *colormap;
+#endif
 
   gtk_widget_get_allocation (widget, &widget_allocation);
   screen = gtk_widget_get_screen (GTK_WIDGET (window));
+#if GTK_CHECK_VERSION (2, 90, 8)
+  if (gdk_screen_is_composited (screen) &&
+      (visual = gdk_screen_get_rgba_visual (screen)) != NULL)
+    {
+      /* Set RGBA visual if possible so VTE can use real transparency */
+      gtk_window_set_visual (GTK_WINDOW (widget), visual);
+      priv->have_argb_visual = TRUE;
+    }
+  else
+    {
+      gtk_window_set_visual (GTK_WINDOW (window), gdk_screen_get_system_visual (screen));
+      priv->have_argb_visual = FALSE;
+    }
+#else
   if (gdk_screen_is_composited (screen) &&
       (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
     {
@@ -1542,6 +1560,7 @@ terminal_window_realize (GtkWidget *widget)
       priv->have_argb_visual = FALSE;
     }
 #endif
+#endif
 
   _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
                          "[window %p] realize, size %d : %d at (%d, %d)\n",



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