First patch!



Heya,

First patch is a backport of:
http://bugzilla.gnome.org/show_bug.cgi?id=121492

For gnome-panel 2.8.

Enjoy

-- 
Bastien Nocera <bnocera redhat com>
--- gnome-panel-2.8.1.old/gnome-panel/gnome-panel-screenshot.c	2004-08-08 23:21:58.000000000 +0100
+++ gnome-panel-2.8.1/gnome-panel/gnome-panel-screenshot.c	2006-08-24 14:06:07.000000000 +0100
@@ -807,14 +807,13 @@ find_toplevel_window (int depth, Window 
 static gboolean
 take_window_shot (void)
 {
-	GdkWindow *window, *toplevel_window;
+	GdkWindow *window, *toplevel_window, *root_w;
 	Display *disp;
 	Window w, root, child, toplevel;
 	int unused;
 	guint mask;
 	gint x_real_orig, y_real_orig;
 	gint x_orig, y_orig;
-	gint x = 0, y = 0;
 	gint real_width, real_height;
 	gint width, height;
 	XClassHint class_hint;
@@ -873,6 +872,7 @@ take_window_shot (void)
 		gdk_window_show (toplevel_window);
 	}
 
+	root_w = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
 	gdk_drawable_get_size (window, &real_width, &real_height);
 	gdk_window_get_origin (window, &x_real_orig, &y_real_orig);
 
@@ -882,12 +882,10 @@ take_window_shot (void)
 	height = real_height;
 	
 	if (x_orig < 0) {
-		x = - x_orig;
 		width = width + x_orig;
 		x_orig = 0;
 	}
 	if (y_orig < 0) {
-		y = - y_orig;
 		height = height + y_orig;
 		y_orig = 0;
 	}
@@ -899,8 +897,8 @@ take_window_shot (void)
 
 
 #ifdef HAVE_X11_EXTENSIONS_SHAPE_H
-	tmp = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
-					    x, y, 0, 0,
+	tmp = gdk_pixbuf_get_from_drawable (NULL, root_w, NULL,
+					    x_orig, y_orig, 0, 0,
 					    width, height);
 
 	rectangles = XShapeGetRectangles (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (window),
@@ -915,6 +913,7 @@ take_window_shot (void)
 		for (i = 0; i < rectangle_count; i++) {
 			gint rec_x, rec_y;
 			gint rec_width, rec_height;
+			gint y;
 
 			rec_x = rectangles[i].x;
 			rec_y = rectangles[i].y;
@@ -939,6 +938,7 @@ take_window_shot (void)
 
 			for (y = rec_y; y < rec_y + rec_height; y++) {
 				guchar *src_pixels, *dest_pixels;
+				gint x;
 				
 				src_pixels = gdk_pixbuf_get_pixels (tmp) +
 					y * gdk_pixbuf_get_rowstride(tmp) +
@@ -963,8 +963,8 @@ take_window_shot (void)
 		screenshot = tmp;
 	}
 #else /* HAVE_X11_EXTENSIONS_SHAPE_H */
-	screenshot = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
-						   x, y, 0, 0,
+	screenshot = gdk_pixbuf_get_from_drawable (NULL, root_w, NULL,
+						   x_orig, y_orig, 0, 0,
 						   width, height);
 #endif /* HAVE_X11_EXTENSIONS_SHAPE_H */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]