From: Michael D. Lowis Date: Tue, 17 Mar 2020 17:01:20 +0000 (-0400) Subject: ignore some errors when wm starts up with unsual windows X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e36efb3fbf0e17b56168ac435433e40214b57262;p=proto%2Fanvil.git ignore some errors when wm starts up with unsual windows --- diff --git a/anvil.c b/anvil.c index ce8a47f..8aed3ee 100644 --- 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 4082f2c..89a05f2 100644 --- 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 { diff --git a/client.c b/client.c index e302c33..3f740c7 100644 --- 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 321c4fe..2a9b55e 100644 --- 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 b04e6c9..ffc7fa5 100644 --- 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)