diff --git a/src/util/window.c b/src/util/window.c index b7cb64f..caf3aeb 100644 --- a/src/util/window.c +++ b/src/util/window.c @@ -387,6 +387,9 @@ cairo_surface_t *screenshot(Window win, size_t size) if (!XGetWindowAttributes(server.display, win, &wa) || wa.width <= 0 || wa.height <= 0) goto err0; + if (window_is_iconified(win)) + goto err0; + size_t w, h; w = (size_t)wa.width; h = (size_t)wa.height; @@ -437,6 +440,9 @@ cairo_surface_t *screenshot(Window win, size_t size) goto err4; } + if (window_is_iconified(win)) + goto err4; + result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, (int)tw, (int)th); u_int32_t *data = (u_int32_t *)cairo_image_surface_get_data(result); memset(data, 0, tw * th); @@ -504,6 +510,8 @@ cairo_surface_t *get_window_thumbnail_cairo(Window win, int size) XWindowAttributes wa; if (!XGetWindowAttributes(server.display, win, &wa)) return NULL; + if (window_is_iconified(win)) + return NULL; int w, h; w = wa.width; h = wa.height;