commit ce9c5c2adf67b8ed7eb190530c7a056865b361f5
parent 8c5e6b9eb9b84182f4a939c2d4671b4de84db6b4
Author: Kris Maglione <kris@suckless.org>
Date: Thu, 27 May 2010 17:37:09 -0400
[witray] Resize tray window after desktop change.
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/cmd/tray/tray.c b/cmd/tray/tray.c
@@ -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,
+};
+