diff pidgin/plugins/gestures/stroke-draw.c @ 30137:4e7a9940627e

Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except for a few things that aren't in GTK+ releases yet.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 13 Apr 2010 23:22:31 +0000
parents 2e711c2d080e
children a8cc50c2279f
line wrap: on
line diff
--- a/pidgin/plugins/gestures/stroke-draw.c	Tue Apr 13 22:29:02 2010 +0000
+++ b/pidgin/plugins/gestures/stroke-draw.c	Tue Apr 13 23:22:31 2010 +0000
@@ -19,6 +19,9 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
+#if !GTK_CHECK_VERSION(2,14,0)
+#define gtk_widget_get_window(x) x->window
+#endif
 
 static void gstroke_invisible_window_init (GtkWidget *widget);
 /*FIXME: Maybe these should be put in a structure, and not static...*/
@@ -75,7 +78,8 @@
       /* FIXME: this does not work. It will only work if we create a
          corresponding GDK window for stroke_window and draw on
          that... */
-      gdk_draw_line (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
+      gdk_draw_line (gtk_widget_get_window(widget),
+                     widget->style->fg_gc[GTK_STATE_NORMAL],
                      last_mouse_position.last_point.x,
                      last_mouse_position.last_point.y,
                      x,
@@ -156,7 +160,7 @@
 	  if (cursor == NULL)
 		  cursor = gdk_cursor_new(GDK_PENCIL);
 
-      gdk_pointer_grab (widget->window, FALSE,
+      gdk_pointer_grab (gtk_widget_get_window(widget), FALSE,
 			GDK_BUTTON_RELEASE_MASK, NULL, cursor,
 			event->button.time);
       timer_id = g_timeout_add (GSTROKE_TIMEOUT_DURATION,
@@ -334,8 +338,8 @@
   unsigned long mask, col_border, col_background;
   unsigned int border_width;
   XSizeHints hints;
-  Display *disp = GDK_WINDOW_XDISPLAY(widget->window);
-  Window wind = GDK_WINDOW_XWINDOW (widget->window);
+  Display *disp = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget));
+  Window wind = GDK_WINDOW_XWINDOW (gtk_widget_get_window(widget));
   int screen = DefaultScreen (disp);
 
 	if (!gstroke_draw_strokes())