sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-cursorwarp-20210222-61bb8b2.diff (724B)


      1 From 1e4936416fa5517fe447e3388e1d44c913e29f56 Mon Sep 17 00:00:00 2001
      2 From: Markus Dam <markus.dam123@gmail.com>
      3 Date: Mon, 22 Feb 2021 13:40:13 +0100
      4 Subject: [PATCH] Add cursor warping
      5 
      6 ---
      7  dwm.c | 3 +++
      8  1 file changed, 3 insertions(+)
      9 
     10 diff --git a/dwm.c b/dwm.c
     11 index 331a309..c80ef8a 100644
     12 --- a/dwm.c
     13 +++ b/dwm.c
     14 @@ -882,6 +882,8 @@ focusmon(const Arg *arg)
     15  	unfocus(selmon->sel, 0);
     16  	selmon = m;
     17  	focus(NULL);
     18 +	if (selmon->sel)
     19 +		XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
     20  }
     21  
     22  void
     23 @@ -906,6 +908,7 @@ focusstack(const Arg *arg)
     24  	if (c) {
     25  		focus(c);
     26  		restack(selmon);
     27 +		XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
     28  	}
     29  }
     30  
     31 -- 
     32 2.30.1
     33