[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

View File

@ -6,6 +6,7 @@
#include "fns.h" #include "fns.h"
static Handlers handlers; static Handlers handlers;
static Handlers root_handlers;
void void
restrut(Window *w, int orientation) { restrut(Window *w, int orientation) {
@ -83,7 +84,10 @@ tray_init(void) {
| CWEventMask); | CWEventMask);
XFreeColormap(display, wa.colormap); XFreeColormap(display, wa.colormap);
} }
sethandler(tray.win, &handlers); 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); changeprop_string(tray.win, "_WMII_TAGS", tray.tags);
@ -150,9 +154,9 @@ tray_resize(Rectangle r) {
freeimage(oldimage); freeimage(oldimage);
} }
tray.r = r;
reshapewin(tray.win, r); reshapewin(tray.win, r);
restrut(tray.win, tray.orientation); restrut(tray.win, tray.orientation);
} }
void void
@ -255,3 +259,15 @@ static Handlers handlers = {
.expose = expose_event, .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,
};