[PATCH] wmaker: add check in getSize function to prevent X error

1 view
Skip to first unread message

david.m...@gmail.com

unread,
Feb 21, 2026, 2:57:42 PM (3 days ago) Feb 21
to Window Maker Development
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);
--
2.43.0
0001-wmaker-add-check-in-getSize-function-to-prevent-X-er.patch
Reply all
Reply to author
Forward
0 new messages