From e42fe5966a8ca3bbad23726710db11383945384e Mon Sep 17 00:00:00 2001 From: Joseph <119084558+DerjenigeUberMensch@users.noreply.github.com> Date: Thu, 10 Oct 2024 07:04:11 +0800 Subject: [PATCH] Fixed Drag window snapping window back into place if previously resized using ResizeWindowAlt --- include/client.h | 10 ++++++++-- src/client.c | 15 +++++++++++++++ src/toggle.c | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/client.h b/include/client.h index 59fbdf9..569e42f 100644 --- a/include/client.h +++ b/include/client.h @@ -348,11 +348,17 @@ Client *prevvisible(Client *c); * {1, 0} * 1 -> dont confide resize to monitor dimentions * 0 -> confide resize within monitor dimentions - * */ + */ void resize(Client *c, int32_t x, int32_t y, int32_t width, int32_t height, uint8_t interact); /* resize a client given parametors without sizehints */ void resizeclient(Client *c, int16_t x, int16_t y, uint16_t width, uint16_t height); - +/* moves a client only if specified x/y is different + * interact + * {1, 0} + * 1 -> dont confide resize to monitor dimentions + * 0 -> confide resize within monitor dimentions + */ +void resizemove(Client *c, int16_t x, int16_t y, uint8_t interact); /* Sends a Protocol Event to specified client */ void sendprotocolevent(Client *c, XCBAtom proto); /* Sets the flag "alwaysontop" to the provided Client */ diff --git a/src/client.c b/src/client.c index c84c37c..445ffa4 100644 --- a/src/client.c +++ b/src/client.c @@ -1716,6 +1716,21 @@ resizeclient(Client *c, int16_t x, int16_t y, uint16_t width, uint16_t height) } } +void +resizemove(Client *c, int16_t x, int16_t y, uint8_t interact) +{ + i32 _x = x; + i32 _y = y; + i32 width = c->w; + i32 height = c->h; + if(applysizehints(c, &_x, &_y, &width, &height, interact)) + { + (void)width; + (void)height; + resizeclient(c, _x, _y, c->w, c->h); + } +} + void sendprotocolevent(Client *c, XCBAtom proto) { diff --git a/src/toggle.c b/src/toggle.c index c67237c..2bf7058 100644 --- a/src/toggle.c +++ b/src/toggle.c @@ -318,7 +318,7 @@ DragWindow( ny = _wm.selmon->wy + _wm.selmon->wh - oldh; if(c) - { resize(c, nx, ny, c->w, c->h, 1); + { resizemove(c, nx, ny, 1); } else { XCBMoveWindow(_wm.dpy, win, nx, ny);