From 1b8eb63376da4cc0f9c97021816e9f58a981b34d Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Sat, 21 Feb 2026 14:17:53 -0500 Subject: [PATCH] wmaker: add check in getSize function to prevent X error This patch is checking if the passed Drawable exists before calling XGetGeometry on it, as seen when using Steam and trying to change the attributes of the 'Friends & Chat' popup window, wmaker is generating such error in the logs: warning: internal X error: BadDrawable (invalid Pixmap or Window parameter) Request code: 14 X_GetGeometry Request minor code: 0 Resource ID: 0x0 Error serial: 32091 --- src/icon.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/icon.c b/src/icon.c index 14278d2c..790bfd29 100644 --- a/src/icon.c +++ b/src/icon.c @@ -105,6 +105,16 @@ static void tileObserver(void *self, WMNotification *notif) static int getSize(Drawable d, unsigned int *w, unsigned int *h, unsigned int *dep) { + if (d == None) { + if (w) + *w = 0; + if (h) + *h = 0; + if (dep) + *dep = 0; + return 0; + } + Window rjunk; int xjunk, yjunk; unsigned int bjunk; @@ -195,6 +205,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y) /* Icon image */ icon->file = NULL; icon->file_image = NULL; + icon->icon_win = None; return icon; } @@ -752,7 +763,10 @@ static void set_dockapp_in_icon(WIcon *icon) /* We need the application size to center it * and show in the correct position */ - getSize(icon->icon_win, &w, &h, &d); + if (!getSize(icon->icon_win, &w, &h, &d)) { + wwarning("Drawable invalid, skip reparenting dock app to icon."); + return; + } /* Set the background pixmap */ XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->icon_tile_pixmap);