From 3c544eafea9bb1e223a44f75d668071218bba22f Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 11 Mar 2020 12:27:55 -0400 Subject: [PATCH] handle new windows --- anvil.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) 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); } } -- 2.52.0