/dev/twasilczyk/screenshot: e140cb62e5f2: scrncap: fix gtk3 build

Tomasz Wasilczyk twasilczyk at pidgin.im
Wed Apr 30 07:14:33 EDT 2014


Changeset: e140cb62e5f2501a441a5c31fbe8eab08b1aa58a
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-30 13:14 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/twasilczyk/screenshot/rev/e140cb62e5f2

Description:

scrncap: fix gtk3 build

diffstat:

 pidgin/gtk3compat.h        |   8 ++++++++
 pidgin/plugins/screencap.c |  14 +++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diffs (63 lines):

diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -156,6 +156,14 @@ gdk_pixbuf_get_from_surface(cairo_surfac
 	return pixbuf;
 }
 
+static inline GdkPixbuf *
+gdk_pixbuf_get_from_window(GdkWindow *window, gint src_x, gint src_y,
+	gint width, gint height)
+{
+	return gdk_pixbuf_get_from_drawable(NULL, window, NULL,
+		src_x, src_y, 0, 0, width, height);
+}
+
 static inline GtkWidget *
 gtk_box_new(GtkOrientation orientation, gint spacing)
 {
diff --git a/pidgin/plugins/screencap.c b/pidgin/plugins/screencap.c
--- a/pidgin/plugins/screencap.c
+++ b/pidgin/plugins/screencap.c
@@ -82,16 +82,13 @@ static GdkPixbuf *
 scrncap_perform_screenshot(void)
 {
 	GdkWindow *root;
-	gint orig_x, orig_y, width, height;
+	gint orig_x, orig_y;
 
 	root = gdk_get_default_root_window();
 	gdk_window_get_origin(root, &orig_x, &orig_y);
-	gdk_drawable_get_size(root, &width, &height);
 
-	/* for gtk3 should be gdk_pixbuf_get_from_window */
-	return gdk_pixbuf_get_from_drawable(
-		NULL, root, NULL,
-		orig_x, orig_y, 0, 0, width, height);
+	return gdk_pixbuf_get_from_window(root, 0, 0,
+		gdk_window_get_width(root), gdk_window_get_height(root));
 }
 
 static void
@@ -454,11 +451,11 @@ scrncap_crop_window_keypress(GtkWidget *
 	PidginWebView *webview = PIDGIN_WEBVIEW(_webview);
 	guint key = event->keyval;
 
-	if (key == GDK_Escape) {
+	if (key == GDK_KEY_Escape) {
 		gtk_widget_destroy(crop_window);
 		return TRUE;
 	}
-	if (key == GDK_Return) {
+	if (key == GDK_KEY_Return) {
 		GdkPixbuf *screenshot, *subscreen, *result;
 
 		screenshot = g_object_get_data(G_OBJECT(crop_window),
@@ -617,7 +614,6 @@ scrncap_do_screenshot_cb(gpointer _webvi
 	current_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	crop_window = GTK_WINDOW(current_window);
 	gtk_window_set_decorated(crop_window, FALSE);
-	gtk_window_set_policy(crop_window, FALSE, FALSE, TRUE);
 	gtk_window_set_resizable(crop_window, FALSE);
 	gtk_widget_set_size_request(GTK_WIDGET(crop_window), width, height);
 	gtk_window_fullscreen(crop_window);



More information about the Commits mailing list