diff options
Diffstat (limited to 'cmd/tray/tray.c')
-rw-r--r-- | cmd/tray/tray.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cmd/tray/tray.c b/cmd/tray/tray.c index dece602..1257996 100644 --- a/cmd/tray/tray.c +++ b/cmd/tray/tray.c @@ -55,6 +55,9 @@ restrut(Window *w, int orientation) { ewmh_setstrut(w, strut); } +static bool +root_config_event(Window *w, void *aux, XConfigureEvent *ev); + void tray_init(void) { WinAttr wa; @@ -77,7 +80,7 @@ tray_init(void) { sethandler(tray.win, &handlers); pushhandler(&scr.root, &root_handlers, nil); - selectinput(&scr.root, scr.root.eventmask | PropertyChangeMask); + selectinput(&scr.root, scr.root.eventmask | PropertyChangeMask | StructureNotifyMask); changeprop_string(tray.win, "_WMII_TAGS", tray.tags); @@ -99,6 +102,7 @@ tray_init(void) { hints.flags = InputHint; hints.input = false; XSetWMHints(display, tray.win->xid, &hints); + root_config_event(nil, nil, nil); tray_resize(tray.win->r); } @@ -409,6 +413,20 @@ static Handlers handlers = { }; static bool +root_config_event(Window *w, void *aux, XConfigureEvent *ev) { + + USED(aux); + int i, n; + Rectangle *rects; + + rects = xinerama_screens(&n); + + scr.rect = rects[0]; + tray_update(); + return false; +} + +static bool property_event(Window *w, void *aux, XPropertyEvent *ev) { if(ev->atom == NET("CURRENT_DESKTOP")) tray_resize(tray.r); @@ -418,6 +436,7 @@ property_event(Window *w, void *aux, XPropertyEvent *ev) { } static Handlers root_handlers = { + .config = root_config_event, .property = property_event, }; |