Skip to content

Commit

Permalink
Fixed Drag window snapping window back into place if previously resiz…
Browse files Browse the repository at this point in the history
…ed using ResizeWindowAlt (#444)
  • Loading branch information
DerjenigeUberMensch authored Oct 9, 2024
1 parent ebed8f2 commit 0a1cee4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
10 changes: 8 additions & 2 deletions include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
15 changes: 15 additions & 0 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0a1cee4

Please sign in to comment.