summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-05 13:21:23 +0100
committerVictor Kareh <[email protected]>2021-01-05 09:33:23 -0500
commitc4a5e775da5b592e82a79fcb5e09b1f2fe86567a (patch)
tree1185200f3959bafdab8783cd1c07ee61cd454277
parent755d6e73771bddfd192e47ef593460e8540591ca (diff)
downloadmate-panel-c4a5e775da5b592e82a79fcb5e09b1f2fe86567a.tar.bz2
mate-panel-c4a5e775da5b592e82a79fcb5e09b1f2fe86567a.tar.xz
wncklet: search the window before creating a new one
-rw-r--r--applets/wncklet/window-list.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 4851a823..8ec3f396 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -252,15 +252,18 @@ preview_window_thumbnail (WnckWindow *wnck_window,
int *thumbnail_scale)
{
GdkWindow *window;
+ Window win;
cairo_surface_t *thumbnail;
cairo_t *cr;
double ratio;
int width, height, scale;
- window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), wnck_window_get_xid (wnck_window));
-
- if (window == NULL)
- return NULL;
+ 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;
+ }
*thumbnail_scale = scale = gdk_window_get_scale_factor (window);
width = gdk_window_get_width (window) * scale;