summaryrefslogtreecommitdiff
path: root/mate-screenshot/src/screenshot-dialog.c
diff options
context:
space:
mode:
authorOz N Tiram <[email protected]>2016-06-18 16:23:32 +0200
committerraveit65 <[email protected]>2016-06-20 10:24:10 +0200
commit30c99286eda160f95fd7f17ba4e82e2e368fc6eb (patch)
treec8866f08567baa661114617a3b7a9c1e65b23023 /mate-screenshot/src/screenshot-dialog.c
parent26a3d2bc96278d43fdb913c1b3430cd9be4c4663 (diff)
downloadmate-utils-30c99286eda160f95fd7f17ba4e82e2e368fc6eb.tar.bz2
mate-utils-30c99286eda160f95fd7f17ba4e82e2e368fc6eb.tar.xz
Some more fixes for gtk+3
* remove deprecated calls to: - gdk_keyboard_grab - gdk_pointer_grab - gdk_keyboard_ungrab - gdk_pointer_ungrab GTK+3 Replace on_preview_expose_event This method used many deprecated calles. This method was replaced with on_preview_draw, code taken directly from current gnome-screenshot
Diffstat (limited to 'mate-screenshot/src/screenshot-dialog.c')
-rw-r--r--mate-screenshot/src/screenshot-dialog.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c
index 5f5fd098..6e71ebf8 100644
--- a/mate-screenshot/src/screenshot-dialog.c
+++ b/mate-screenshot/src/screenshot-dialog.c
@@ -64,20 +64,32 @@ on_toplevel_key_press_event (GtkWidget *widget,
return FALSE;
}
-static void
#if GTK_CHECK_VERSION (3, 0, 0)
-on_preview_draw (GtkWidget *drawing_area, cairo_t *cr, gpointer data)
+static void
+on_preview_draw (GtkWidget *drawing_area,
+ cairo_t *cr,
+ gpointer data)
+{
+ ScreenshotDialog *dialog = data;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (drawing_area);
+ gtk_style_context_save (context);
+
+ gtk_style_context_set_state (context, gtk_widget_get_state_flags (drawing_area));
+ gtk_render_icon (context, cr, dialog->preview_image, 0, 0);
+
+ gtk_style_context_restore (context);
+}
+
#else
+static void
on_preview_expose_event (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
-#endif
{
ScreenshotDialog *dialog = data;
GdkPixbuf *pixbuf = NULL;
gboolean free_pixbuf = FALSE;
-#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr;
-#endif
-
/* Stolen from GtkImage. I really should just make the drawing area an
* image some day */
if (gtk_widget_get_state (drawing_area) != GTK_STATE_NORMAL)
@@ -101,24 +113,19 @@ on_preview_expose_event (GtkWidget *drawing_area, GdkEventExpose *event, gpointe
}
else
{
- pixbuf = g_object_ref (dialog->preview_image);
+ pixbuf = g_object_ref (dialog->preview_image);
}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
+
cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
-#endif
-
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr);
-#endif
g_object_unref (pixbuf);
}
+#endif
static gboolean
on_preview_button_press_event (GtkWidget *drawing_area,