Skip to content

Instantly share code, notes, and snippets.

@ortango
Last active September 20, 2023 00:44
Show Gist options
  • Save ortango/a8003756e31d10bb8eae121a70ba11c4 to your computer and use it in GitHub Desktop.
Save ortango/a8003756e31d10bb8eae121a70ba11c4 to your computer and use it in GitHub Desktop.
diff --git a/src/window.c b/src/window.c
index cd2340d..3e5f633 100644
--- a/src/window.c
+++ b/src/window.c
@@ -592,8 +592,16 @@ bool resize_client(coordinates_t *loc, resize_handle_t rh, int dx, int dy, bool
} else {
int w = width, h = height;
if (relative) {
- w += dx * (rh & HANDLE_LEFT ? -1 : (rh & HANDLE_RIGHT ? 1 : 0));
- h += dy * (rh & HANDLE_TOP ? -1 : (rh & HANDLE_BOTTOM ? 1 : 0));
+ dx *= rh & HANDLE_LEFT ? -1 : (rh & HANDLE_RIGHT ? 1 : 0);
+ dy *= rh & HANDLE_TOP ? -1 : (rh & HANDLE_BOTTOM ? 1 : 0);
+ w += dx;
+ h += dy;
+ /*the conditional below should only be hit when the window is floating or pseudo_tiled with
+ honor_size_hints. the idea is to just add a little extra that will be trimmed off later.*/
+ if (honor_size_hints && n->client->size_hints.flags & (XCB_ICCCM_SIZE_HINT_P_RESIZE_INC | XCB_ICCCM_SIZE_HINT_BASE_SIZE)) {
+ w += (dx > 0 && n->client->size_hints.width_inc > 0) ? (n->client->size_hints.width_inc - 1) : 0;
+ h += (dy > 0 && n->client->size_hints.height_inc > 0) ? (n->client->size_hints.height_inc - 1) : 0;
+ }
} else {
if (rh & HANDLE_LEFT) {
w = x + width - dx;
@ortango
Copy link
Author

ortango commented Apr 2, 2022

i dont know why the newline isn't copying correctly after } else {.

formatted correctly at this diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment