dwm-resizehere-20230824-e81f17d.diff - sites - public wiki contents of suckless… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-resizehere-20230824-e81f17d.diff (2010B) | |
--- | |
1 From d2824944615917697c18555a397bf84f2249a722 Mon Sep 17 00:00:00 2001 | |
2 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= <[email protected]> | |
3 Date: Thu, 24 Aug 2023 15:06:56 +0200 | |
4 Subject: [PATCH] Resize clients without wrapping the pointer | |
5 | |
6 --- | |
7 dwm.c | 14 +++++++------- | |
8 1 file changed, 7 insertions(+), 7 deletions(-) | |
9 | |
10 diff --git a/dwm.c b/dwm.c | |
11 index f1d86b2..8c661a2 100644 | |
12 --- a/dwm.c | |
13 +++ b/dwm.c | |
14 @@ -1300,7 +1300,7 @@ resizeclient(Client *c, int x, int y, int w, int h) | |
15 void | |
16 resizemouse(const Arg *arg) | |
17 { | |
18 - int ocx, ocy, nw, nh; | |
19 + int x, y, ocw, och, nw, nh; | |
20 Client *c; | |
21 Monitor *m; | |
22 XEvent ev; | |
23 @@ -1311,12 +1311,13 @@ resizemouse(const Arg *arg) | |
24 if (c->isfullscreen) /* no support resizing fullscreen windows … | |
25 return; | |
26 restack(selmon); | |
27 - ocx = c->x; | |
28 - ocy = c->y; | |
29 + ocw = c->w; | |
30 + och = c->h; | |
31 if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, Gr… | |
32 None, cursor[CurResize]->cursor, CurrentTime) != GrabSu… | |
33 return; | |
34 - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c… | |
35 + if(!getrootptr(&x, &y)) | |
36 + return; | |
37 do { | |
38 XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedi… | |
39 switch(ev.type) { | |
40 @@ -1330,8 +1331,8 @@ resizemouse(const Arg *arg) | |
41 continue; | |
42 lasttime = ev.xmotion.time; | |
43 | |
44 - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); | |
45 - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); | |
46 + nw = MAX(ocw + (ev.xmotion.x - x), 1); | |
47 + nh = MAX(och + (ev.xmotion.y - y), 1); | |
48 if (c->mon->wx + nw >= selmon->wx && c->mon->wx… | |
49 && c->mon->wy + nh >= selmon->wy && c->mon->wy … | |
50 { | |
51 @@ -1344,7 +1345,6 @@ resizemouse(const Arg *arg) | |
52 break; | |
53 } | |
54 } while (ev.type != ButtonRelease); | |
55 - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c… | |
56 XUngrabPointer(dpy, CurrentTime); | |
57 while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | |
58 if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { | |
59 -- | |
60 2.41.0 | |
61 |