From bb66c2a6c1bec4bada52a5f4972d60b3148b6800 Mon Sep 17 00:00:00 2001 From: ProsperousPotato Date: Fri, 15 Aug 2025 19:23:44 +0100 Subject: implement function to toggle mouse on & off --- dwm.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index c0efdfa..bb5d242 100644 --- a/dwm.c +++ b/dwm.c @@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void togglemouse(const Arg *arg); static pid_t getparentprocess(pid_t p); static int isdescprocess(pid_t p, pid_t c); @@ -1553,6 +1554,12 @@ setup(void) scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 4); + + /* init mouse */ + if (mouse_default == 0) { + togglemouse(0); + } + /* supporting window for NetWMCheck */ wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0); XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32, @@ -2210,6 +2217,8 @@ zoom(const Arg *arg) if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next))) return; pop(c); + + XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); } int -- cgit v1.2.3