Moving XSetWMProtocols to setupmenu()

This commit is contained in:
phillbush 2020-06-29 12:25:59 -03:00
parent 8902c43b92
commit a3a7383740

10
xmenu.c
View File

@ -300,7 +300,7 @@ allocitem(const char *label, const char *output, char *file)
return item; return item;
} }
/* allocate a menu */ /* allocate a menu and create its window */
static struct Menu * static struct Menu *
allocmenu(struct Menu *parent, struct Item *list, unsigned level) allocmenu(struct Menu *parent, struct Item *list, unsigned level)
{ {
@ -333,8 +333,6 @@ allocmenu(struct Menu *parent, struct Item *list, unsigned level)
CWBorderPixel | CWEventMask | CWSaveUnder, CWBorderPixel | CWEventMask | CWSaveUnder,
&swa); &swa);
XSetWMProtocols(dpy, menu->win, &wmdelete, 1);
return menu; return menu;
} }
@ -568,10 +566,10 @@ setupmenu(struct Menu *menu, XClassHint *classh)
DefaultDepth(dpy, screen)); DefaultDepth(dpy, screen));
menu->draw = XftDrawCreate(dpy, menu->pixmap, visual, colormap); menu->draw = XftDrawCreate(dpy, menu->pixmap, visual, colormap);
/* set ewmh window properties */ /* set WM protocols and ewmh window properties */
XSetWMProtocols(dpy, menu->win, &wmdelete, 1);
XChangeProperty(dpy, menu->win, netatom[NetWMName], utf8string, 8, XChangeProperty(dpy, menu->win, netatom[NetWMName], utf8string, 8,
PropModeReplace, PropModeReplace, (unsigned char *)title, strlen(title));
(unsigned char *)title, strlen(title));
XChangeProperty(dpy, menu->win, netatom[NetWMWindowType], XA_ATOM, 32, XChangeProperty(dpy, menu->win, netatom[NetWMWindowType], XA_ATOM, 32,
PropModeReplace, PropModeReplace,
(unsigned char *)&netatom[NetWMWindowTypePopupMenu], 1); (unsigned char *)&netatom[NetWMWindowTypePopupMenu], 1);