Wed, 12 Feb 2014 15:49:30 +0100
Fix some GTK 3.8 deprecation warnings
| pidgin/gtkutils.c | file | annotate | diff | comparison | revisions | |
| pidgin/plugins/gestures/stroke-draw.c | file | annotate | diff | comparison | revisions |
--- a/pidgin/gtkutils.c Wed Feb 12 15:19:41 2014 +0100 +++ b/pidgin/gtkutils.c Wed Feb 12 15:49:30 2014 +0100 @@ -3586,14 +3586,18 @@ if (width != -1 || height != -1) gtk_widget_set_size_request(sw, width, height); if (child) { +#if GTK_CHECK_VERSION(3,8,0) + gtk_container_add(GTK_CONTAINER(sw), child); +#else #if GTK_CHECK_VERSION(3,0,0) if (GTK_IS_SCROLLABLE(child)) #else if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal) -#endif +#endif /* GTK_CHECK_VERSION(3,0,0) */ gtk_container_add(GTK_CONTAINER(sw), child); else gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child); +#endif /* GTK_CHECK_VERSION(3,8,0) */ } return sw; }
--- a/pidgin/plugins/gestures/stroke-draw.c Wed Feb 12 15:19:41 2014 +0100 +++ b/pidgin/plugins/gestures/stroke-draw.c Wed Feb 12 15:49:30 2014 +0100 @@ -53,47 +53,53 @@ static void gstroke_execute (GtkWidget *widget, const gchar *name); static void -record_stroke_segment (GtkWidget *widget) +record_stroke_segment(GtkWidget *widget) { - gint x, y; - struct gstroke_metrics *metrics; - - g_return_if_fail( widget != NULL ); - - gtk_widget_get_pointer (widget, &x, &y); + gint x, y; + struct gstroke_metrics *metrics; +#if GTK_CHECK_VERSION(3,0,0) + GdkDeviceManager *devmgr; + GdkDevice *dev; +#endif - if (last_mouse_position.invalid) - last_mouse_position.invalid = FALSE; - else if (gstroke_draw_strokes()) - { -#if 1 - XDrawLine (gstroke_disp, gstroke_window, gstroke_gc, - last_mouse_position.last_point.x, - last_mouse_position.last_point.y, - x, y); - /* XFlush (gstroke_disp); */ + g_return_if_fail(widget != NULL); + +#if GTK_CHECK_VERSION(3,0,0) + devmgr = gdk_display_get_device_manager(gtk_widget_get_display(widget)); + dev = gdk_device_manager_get_client_pointer(devmgr); + gdk_window_get_device_position(gtk_widget_get_window(widget), + dev, &x, &y, NULL); #else - /* 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 (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, - y); + gtk_widget_get_pointer(widget, &x, &y); #endif - } - if (last_mouse_position.last_point.x != x - || last_mouse_position.last_point.y != y) - { - last_mouse_position.last_point.x = x; - last_mouse_position.last_point.y = y; - metrics = (struct gstroke_metrics *)g_object_get_data(G_OBJECT(widget), - GSTROKE_METRICS); - _gstroke_record (x, y, metrics); - } + if (last_mouse_position.invalid) + last_mouse_position.invalid = FALSE; + else if (gstroke_draw_strokes()) { +#if 1 + XDrawLine(gstroke_disp, gstroke_window, gstroke_gc, + last_mouse_position.last_point.x, + last_mouse_position.last_point.y, x, y); + /* XFlush (gstroke_disp); */ +#else + /* 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(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, y); +#endif + } + + if (last_mouse_position.last_point.x != x || + last_mouse_position.last_point.y != y) + { + last_mouse_position.last_point.x = x; + last_mouse_position.last_point.y = y; + metrics = g_object_get_data(G_OBJECT(widget), GSTROKE_METRICS); + _gstroke_record (x, y, metrics); + } } static gint