[witray] Resize tray window after desktop change.

This commit is contained in:
Kris Maglione 2010-05-27 17:37:09 -04:00
parent 8c5e6b9eb9
commit ce9c5c2adf
1 changed files with 17 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include "fns.h"
static Handlers handlers;
static Handlers root_handlers;
void
restrut(Window *w, int orientation) {
@ -83,7 +84,10 @@ tray_init(void) {
| CWEventMask);
XFreeColormap(display, wa.colormap);
}
sethandler(tray.win, &handlers);
pushhandler(&scr.root, &root_handlers, nil);
selectinput(&scr.root, scr.root.eventmask | PropertyChangeMask);
changeprop_string(tray.win, "_WMII_TAGS", tray.tags);
@ -150,9 +154,9 @@ tray_resize(Rectangle r) {
freeimage(oldimage);
}
tray.r = r;
reshapewin(tray.win, r);
restrut(tray.win, tray.orientation);
}
void
@ -255,3 +259,15 @@ static Handlers handlers = {
.expose = expose_event,
};
static void
property_event(Window *w, void *aux, XPropertyEvent *ev) {
if(ev->atom == NET("CURRENT_DESKTOP"))
tray_resize(tray.r);
Debug if(ev->atom == NET("CURRENT_DESKTOP"))
print("property_event(_NET_CURRENT_DESKTOP)\n");
}
static Handlers root_handlers = {
.property = property_event,
};