/pidgin/main: 12bd3807140b: Fix some GTK 3.8 deprecation warnings
Tomasz Wasilczyk
twasilczyk at pidgin.im
Wed Feb 12 09:49:37 EST 2014
Changeset: 12bd3807140b9f78d172a4fdbf53fca6fe31524e
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-02-12 15:49 +0100
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/12bd3807140b
Description:
Fix some GTK 3.8 deprecation warnings
diffstat:
pidgin/gtkutils.c | 6 ++-
pidgin/plugins/gestures/stroke-draw.c | 72 ++++++++++++++++++----------------
2 files changed, 44 insertions(+), 34 deletions(-)
diffs (113 lines):
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -3586,14 +3586,18 @@ pidgin_make_scrollable(GtkWidget *child,
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;
}
diff --git a/pidgin/plugins/gestures/stroke-draw.c b/pidgin/plugins/gestures/stroke-draw.c
--- a/pidgin/plugins/gestures/stroke-draw.c
+++ b/pidgin/plugins/gestures/stroke-draw.c
@@ -53,47 +53,53 @@ static guint timer_id;
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;
+ gint x, y;
+ struct gstroke_metrics *metrics;
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkDeviceManager *devmgr;
+ GdkDevice *dev;
+#endif
- g_return_if_fail( widget != NULL );
+ g_return_if_fail(widget != NULL);
- gtk_widget_get_pointer (widget, &x, &y);
+#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
+ gtk_widget_get_pointer(widget, &x, &y);
+#endif
- if (last_mouse_position.invalid)
- last_mouse_position.invalid = FALSE;
- else if (gstroke_draw_strokes())
- {
+ 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); */
+ 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);
+ /* 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 = (struct gstroke_metrics *)g_object_get_data(G_OBJECT(widget),
- GSTROKE_METRICS);
- _gstroke_record (x, y, metrics);
- }
+ 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
More information about the Commits
mailing list