]> git.mdlowis.com Git - proto/anvil.git/commitdiff
ignore some errors when wm starts up with unsual windows
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 17 Mar 2020 17:01:20 +0000 (13:01 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 17 Mar 2020 17:01:20 +0000 (13:01 -0400)
anvil.c
anvil.h
client.c
error.c
mons.c

diff --git a/anvil.c b/anvil.c
index ce8a47f0b425a0e8c0b80326fe59d00d4262f623..8aed3ee5b49122e3d2ebb32cae7eff966232b412 100644 (file)
--- a/anvil.c
+++ b/anvil.c
@@ -95,6 +95,7 @@ static void xbtnmotion(XEvent* e)
                 {
                     client_resize(c, ev->x_root - X.start_x, ev->y_root - X.start_y);
                 }
+                XSync(X.disp, False);
             }
         }
     }
diff --git a/anvil.h b/anvil.h
index 4082f2c1fced06fce541c30d358202a1595793e9..89a05f237fc2db4c3f5f9f900effef96880cfaaf 100644 (file)
--- a/anvil.h
+++ b/anvil.h
@@ -23,6 +23,12 @@ Management Notes:
     * O columns per workspace
     * Windows can tile in a column or float on workspaces
     * Columns can have different layouts: manual, stacked, monocle
+
+    TODO: window border is wrong width on right and bottom for some reason...
+    TODO: warp mouse pointer to title bars on new windows
+    TODO: account for frame size in client x,y,w,h fields
+    TODO: implement mouse handling for tiling methods
+
 */
 
 enum {
index e302c3328c613370e264d1757d75516c332dfe6c..3f740c71be1ce07ad3e6bd97a2971e39512106e1 100644 (file)
--- a/client.c
+++ b/client.c
@@ -52,6 +52,7 @@ Client* client_add(Window win, XWindowAttributes* attr)
     XAddToSaveSet(X.disp, c->win);
     mons_addclient(c);
     client_show(c, 1);
+    XSync(X.disp, False);
     client_draw(c);
 
     return c;
@@ -61,7 +62,11 @@ void client_draw(Client* c)
 {
     if (c->frame)
     {
-        XSetWindowBackground(X.disp, c->frame, (Focused == c) ? X.black : X.gray);
+        XSetWindowBackground(X.disp, c->frame, (Focused == c) ? X.black : X.white);
+        XSetWindowBorderWidth(X.disp, c->frame, 1);
+        XSetWindowBorder(X.disp, c->frame, (Focused == c) ? X.white : X.black);
+        XSetWindowBorderWidth(X.disp, c->win, 1);
+        XSetWindowBorder(X.disp, c->win, (Focused == c) ? X.white : X.black);
         XClearWindow(X.disp, c->frame);
         XDefineCursor(X.disp, c->frame, X.csr_point);
         if (c->name) {
diff --git a/error.c b/error.c
index 321c4fe5ce0230c9f304446711cb5f023e07038b..2a9b55e6e68f174a918738cfd6a731b881c09d9e 100644 (file)
--- a/error.c
+++ b/error.c
@@ -14,6 +14,8 @@ int error_panic(Display* disp, XErrorEvent* ev)
     int ignore_error = (
            (ev->error_code == BadWindow)
         || (ev->request_code == X_SetInputFocus && ev->error_code == BadMatch)
+        || (ev->request_code == X_ConfigureWindow && ev->error_code == BadMatch)
+        || (ev->request_code == X_ChangeWindowAttributes && ev->error_code == BadMatch)
     );
     if (ignore_error)
     {
diff --git a/mons.c b/mons.c
index b04e6c9fbab9ab990656e47354dc19dedd302f3e..ffc7fa535e0cbd120c8b458622c41b7592a51301 100644 (file)
--- a/mons.c
+++ b/mons.c
@@ -119,8 +119,7 @@ void mons_addclient(Client* c)
         int ch = c->h + 2*BORDER_WIDTH + TITLE_HEIGHT;
         c->x = mon->midx - cw/2;
         c->y = mon->midy - ch/2;
-        client_move(c, 0, 0);
-        client_resize(c, 0, 0);
+        client_adjust(c);
     }
     else
     {
@@ -139,6 +138,7 @@ void mons_addclient(Client* c)
         }
     }
     mons_layer(mon);
+    XSync(X.disp, False);
 }
 
 void mons_delclient(Client* c)