[hackers] [dwm] Don't restrict snap in mousemove || Markus Teich

From: <git_AT_suckless.org>
Date: Tue, 28 Mar 2017 20:23:53 +0200 (CEST)

commit 5b238c8dab945023b6a16a6c9f642b11137f2204
Author: Markus Teich <markus.teich_AT_stusta.mhn.de>
AuthorDate: Sat Jan 7 17:21:30 2017 +0100
Commit: Anselm R Garbe <anselm_AT_garbe.us>
CommitDate: Tue Mar 28 20:23:38 2017 +0200

    Don't restrict snap in mousemove
    
    This also fixes a bug where client windows only switch to floating mode when the
    mouse is dragged in one specific direction.

diff --git a/dwm.c b/dwm.c
index 9c01d1a..7861512 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -1170,20 +1170,17 @@ movemouse(const Arg *arg)
 
                         nx = ocx + (ev.xmotion.x - x);
                         ny = ocy + (ev.xmotion.y - y);
- if (nx >= selmon->wx && nx <= selmon->wx + selmon->ww
- && ny >= selmon->wy && ny <= selmon->wy + selmon->wh) {
- if (abs(selmon->wx - nx) < snap)
- nx = selmon->wx;
- else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
- nx = selmon->wx + selmon->ww - WIDTH(c);
- if (abs(selmon->wy - ny) < snap)
- ny = selmon->wy;
- else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
- ny = selmon->wy + selmon->wh - HEIGHT(c);
- if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
- && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
- togglefloating(NULL);
- }
+ if (abs(selmon->wx - nx) < snap)
+ nx = selmon->wx;
+ else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
+ nx = selmon->wx + selmon->ww - WIDTH(c);
+ if (abs(selmon->wy - ny) < snap)
+ ny = selmon->wy;
+ else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
+ ny = selmon->wy + selmon->wh - HEIGHT(c);
+ if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
+ && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
+ togglefloating(NULL);
                         if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
                                 resize(c, nx, ny, c->w, c->h, 1);
                         break;
Received on Tue Mar 28 2017 - 20:23:53 CEST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 20:24:28 CEST