From 08db3668272b434b69da476f501b3b2b5964e74a Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 11 Mar 2020 16:48:45 -0400 Subject: [PATCH] improved performance of move and resize by syncing on resize and discarding all but latest motion event for window being processed --- anvil.c | 12 ++++++++++++ client.c | 1 + 2 files changed, 13 insertions(+) diff --git a/anvil.c b/anvil.c index e74254b..5a7000d 100644 --- a/anvil.c +++ b/anvil.c @@ -53,6 +53,11 @@ static inline int PRESSED(int mods, int btn) static void xbtnmotion(XEvent* e) { XMotionEvent *ev = &e->xmotion; + while (XCheckTypedWindowEvent(X.disp, ev->window, ev->type, e)) + { + /* Keep grabbing them till we have no more to grab */ + } + Client* c = client_get(ev->window); if (c && (ev->window == c->frame)) { @@ -85,6 +90,13 @@ static void xconfigrequest(XEvent* e) wc.sibling = ev->above; wc.stack_mode = ev->detail; XConfigureWindow(X.disp, ev->window, ev->value_mask, &wc); + Client* c = client_get(ev->window); + if (c && c->win == ev->window) + { + c->w = wc.width; + c->h = wc.height; + client_resize(c, 0, 0); + } } static void xmaprequest(XEvent* e) diff --git a/client.c b/client.c index 88a3afe..5fcd42b 100644 --- a/client.c +++ b/client.c @@ -129,6 +129,7 @@ void client_resize(Client* c, int xdiff, int ydiff) XResizeWindow(X.disp, c->frame, c->w + 2*BORDER_WIDTH, c->h + 2*BORDER_WIDTH + TITLE_HEIGHT); + XSync(X.disp, False); } void client_close(Client* c) -- 2.52.0