diff options
| author | Daniel Guihot | 2026-09-16 05:22:34 +1000 |
|---|---|---|
| committer | Daniel Guihot | 2026-09-16 05:22:34 +1000 |
| commit | 270323604a64f4c9aed829f32dbc12f3d0969a26 (patch) | |
| tree | 6f353082d8fc4c46312f1dae14cfc92170d0e88e | |
| download | dwm-pointerlock-270323604a64f4c9aed829f32dbc12f3d0969a26.tar.gz dwm-pointerlock-270323604a64f4c9aed829f32dbc12f3d0969a26.zip | |
dwm 6.8 pointerlock patch
| -rw-r--r-- | README.md | 31 | ||||
| -rw-r--r-- | dwm-pointerlock-6.8.diff | 38 |
2 files changed, 69 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f32fd8 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# pointerlock + +## Description + +This patch keeps focus on a fullscreen client when the mouse pointer crosses +a monitor edge. It applies to dwm 6.8. + +By default, `enternotify()` and `motionnotify()` change the selected monitor +and focus whenever the pointer moves onto another monitor, so a fullscreen +game loses focus from mouse movement alone. With this patch both handlers +return early while a fullscreen client is selected. Keyboard focus changes, +tag switching and `focusmon` still work. + +## Configuration + +The patch uses the existing `lockfullscreen` option in `config.h`. Set it to +0 to disable the behaviour. No new options are added. + +## Testing + +Applies and builds against dwm 6.8. Runtime testing of the monitor crossing is +pending; Xvfb would not provide two distinct Xinerama head positions on the +development machine. + +## Download + +* [dwm-pointerlock-6.8.diff](dwm-pointerlock-6.8.diff) + +## Author + +* Daniel Guihot - [daniel@guihot.net](mailto:daniel@guihot.net) diff --git a/dwm-pointerlock-6.8.diff b/dwm-pointerlock-6.8.diff new file mode 100644 index 0000000..bb38f0a --- /dev/null +++ b/dwm-pointerlock-6.8.diff @@ -0,0 +1,38 @@ +From 15cb084b099abe22b2d25a860b8739a81614cc48 Mon Sep 17 00:00:00 2001 +From: Daniel Guihot <daniel@guihot.net> +Date: Wed, 16 Sep 2026 05:06:40 +1000 +Subject: [PATCH] pointerlock: ignore pointer focus changes while fullscreen + +enternotify() and motionnotify() change the selected monitor and focus +when the pointer crosses a monitor edge. A fullscreen client can lose +focus from mouse movement alone. Keep the focus on it while +lockfullscreen is set, the same policy focusstack() already follows. +--- + dwm.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dwm.c b/dwm.c +index 53b393e..4872c7b 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -763,6 +763,8 @@ enternotify(XEvent *e) + Monitor *m; + XCrossingEvent *ev = &e->xcrossing; + ++ if (lockfullscreen && selmon->sel && selmon->sel->isfullscreen) ++ return; + if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) + return; + c = wintoclient(ev->window); +@@ -1132,6 +1134,8 @@ motionnotify(XEvent *e) + Monitor *m; + XMotionEvent *ev = &e->xmotion; + ++ if (lockfullscreen && selmon->sel && selmon->sel->isfullscreen) ++ return; + if (ev->window != root) + return; + if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { +-- +2.55.0 + |
