]> git.mdlowis.com Git - proto/anvil.git/commitdiff
handle new windows
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 11 Mar 2020 16:27:55 +0000 (12:27 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 11 Mar 2020 16:27:55 +0000 (12:27 -0400)
anvil.c

diff --git a/anvil.c b/anvil.c
index 1bc075ea7c38c39010971e732149ae550dc560ab..b32b1a0c1fa3f93e3b91a0afd0f98e354a62374e 100644 (file)
--- 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);
     }
 }