mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-21 19:03:31 +01:00
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
This commit is contained in:
committed by
Carlos R. Mafra
parent
75a8299d18
commit
1b8eb63376
16
src/icon.c
16
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)
|
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;
|
Window rjunk;
|
||||||
int xjunk, yjunk;
|
int xjunk, yjunk;
|
||||||
unsigned int bjunk;
|
unsigned int bjunk;
|
||||||
@@ -195,6 +205,7 @@ static WIcon *icon_create_core(WScreen *scr, int coord_x, int coord_y)
|
|||||||
/* Icon image */
|
/* Icon image */
|
||||||
icon->file = NULL;
|
icon->file = NULL;
|
||||||
icon->file_image = NULL;
|
icon->file_image = NULL;
|
||||||
|
icon->icon_win = None;
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
@@ -752,7 +763,10 @@ static void set_dockapp_in_icon(WIcon *icon)
|
|||||||
|
|
||||||
/* We need the application size to center it
|
/* We need the application size to center it
|
||||||
* and show in the correct position */
|
* 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 */
|
/* Set the background pixmap */
|
||||||
XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->icon_tile_pixmap);
|
XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->icon_tile_pixmap);
|
||||||
|
|||||||
Reference in New Issue
Block a user