From: Michael D. Lowis Date: Wed, 11 Mar 2020 16:27:55 +0000 (-0400) Subject: handle new windows X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=3c544eafea9bb1e223a44f75d668071218bba22f;p=proto%2Fanvil.git handle new windows --- diff --git a/anvil.c b/anvil.c index 1bc075e..b32b1a0 100644 --- a/anvil.c +++ b/anvil.c @@ -53,15 +53,31 @@ static void xbtnmotion(XEvent* e) X.start_y = ev->y_root; } - static void xconfigrequest(XEvent* e) { - (void)e; + XConfigureRequestEvent* ev = &(e->xconfigurerequest); + XWindowChanges wc; + wc.x = ev->x; + wc.y = ev->y; + wc.width = ev->width; + wc.height = ev->height; + wc.border_width = ev->border_width; + wc.sibling = ev->above; + wc.stack_mode = ev->detail; + XConfigureWindow(X.disp, ev->window, ev->value_mask, &wc); } static void xmaprequest(XEvent* e) { - (void)e; + XMapRequestEvent* ev = &(e->xmaprequest); + XWindowAttributes attr; + if (!client_get(ev->window)) + { + if (XGetWindowAttributes(X.disp, ev->window, &attr) && !attr.override_redirect) + { + (void)client_add(ev->window, &attr); + } + } } static void xunmapnotify(XEvent* e) @@ -100,8 +116,6 @@ static void xenternotify(XEvent* e) if (c) { client_focus(c); -// XSetInputFocus(X.disp, c->win, RevertToPointerRoot, CurrentTime); -// client_draw(c, 0); } }