summaryrefslogtreecommitdiff
path: root/applets/wncklet/window-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/wncklet/window-list.c')
-rw-r--r--applets/wncklet/window-list.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 8ec3f396..5b0248c7 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -252,6 +252,7 @@ preview_window_thumbnail (WnckWindow *wnck_window,
int *thumbnail_scale)
{
GdkWindow *window;
+ GdkWindow *window_wrapper = NULL;
Window win;
cairo_surface_t *thumbnail;
cairo_t *cr;
@@ -259,10 +260,21 @@ preview_window_thumbnail (WnckWindow *wnck_window,
int width, height, scale;
win = wnck_window_get_xid (wnck_window);
+
if ((window = gdk_x11_window_lookup_for_display (gdk_display_get_default (), win)) == NULL)
{
if ((window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), win)) == NULL)
+ {
return NULL;
+ }
+ else
+ {
+ window_wrapper = window;
+ }
+ }
+ else
+ {
+ g_object_ref (window);
}
*thumbnail_scale = scale = gdk_window_get_scale_factor (window);
@@ -294,6 +306,9 @@ preview_window_thumbnail (WnckWindow *wnck_window,
gdk_cairo_set_source_window (cr, window, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
+
+ if (window_wrapper)
+ g_object_unref (window_wrapper);
g_object_unref (window);
return thumbnail;