From cea167ea601febec25dd87dbdee2523b96697100 Mon Sep 17 00:00:00 2001 From: pi66 Date: Mon, 27 Apr 2026 21:53:56 +0100 Subject: [PATCH] fix: enable focus-follow-mouse for tablet pen input --- patches/tablet-input/tablet-input-0.8.patch | 20 ++++---- .../tablet-input-main-a2d03cf.patch | 48 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/patches/tablet-input/tablet-input-0.8.patch b/patches/tablet-input/tablet-input-0.8.patch index 595ad81..a9a5463 100644 --- a/patches/tablet-input/tablet-input-0.8.patch +++ b/patches/tablet-input/tablet-input-0.8.patch @@ -1,7 +1,7 @@ -From a14dff19f38fffa498f3de4679952b39b4323502 Mon Sep 17 00:00:00 2001 +From 3a142ab58c5a66d2d71a8184b7e318d0f9d048c6 Mon Sep 17 00:00:00 2001 From: pi66 -Date: Wed, 8 Apr 2026 21:47:41 +0100 -Subject: [PATCH] feat: add pad/tool bindings and pen region +Date: Mon, 27 Apr 2026 21:13:38 +0100 +Subject: [PATCH] fix: enable focus-follow-mouse for tablet pen input --- Makefile | 6 +- @@ -34,7 +34,7 @@ index 578194f..e0d1835 100644 config.h: cp config.def.h $@ diff --git a/config.def.h b/config.def.h -index 8a6eda0..288494e 100644 +index 8a6eda0..9c678d4 100644 --- a/config.def.h +++ b/config.def.h @@ -4,6 +4,7 @@ @@ -75,7 +75,7 @@ index 8a6eda0..288494e 100644 + { 0, 0, NULL, {0} } +}; diff --git a/dwl.c b/dwl.c -index 44f3ad9..7572756 100644 +index 44f3ad9..a5ae8e7 100644 --- a/dwl.c +++ b/dwl.c @@ -51,6 +51,9 @@ @@ -132,7 +132,7 @@ index 44f3ad9..7572756 100644 static void startdrag(struct wl_listener *listener, void *data); static void tag(const Arg *arg); static void tagmon(const Arg *arg); -+static void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, double x, double y, double dx, double dy); ++static void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, double x, double y, double dx, double dy, uint32_t time); +static void tablettoolproximity(struct wl_listener *listener, void *data); +static void tabletpadbutton(struct wl_listener *listener, void *data); +static void tablettoolaxis(struct wl_listener *listener, void *data); @@ -326,7 +326,7 @@ index 44f3ad9..7572756 100644 + +void +tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, -+ double x, double y, double dx, double dy) ++ double x, double y, double dx, double dy, uint32_t time) +{ + struct wlr_surface *surface = NULL; + double sx, sy; @@ -351,7 +351,7 @@ index 44f3ad9..7572756 100644 + break; + } + -+ motionnotify(0, NULL, 0, 0, 0, 0); ++ motionnotify(time, NULL, 0, 0, 0, 0); + + xytonode(cursor->x, cursor->y, &surface, NULL, NULL, &sx, &sy); + if (surface && !wlr_surface_accepts_tablet_v2(surface, tablet)) @@ -398,7 +398,7 @@ index 44f3ad9..7572756 100644 + destroytabletsurfacenotify(NULL, NULL); + break; + case WLR_TABLET_TOOL_PROXIMITY_IN: -+ tablettoolmotion(tablet_tool, true, true, event->x, event->y, 0, 0); ++ tablettoolmotion(tablet_tool, true, true, event->x, event->y, 0, 0, event->time_msec); + break; + } +} @@ -414,7 +414,7 @@ index 44f3ad9..7572756 100644 + tablettoolmotion(tablet_tool, + event->updated_axes & WLR_TABLET_TOOL_AXIS_X, + event->updated_axes & WLR_TABLET_TOOL_AXIS_Y, -+ event->x, event->y, event->dx, event->dy); ++ event->x, event->y, event->dx, event->dy, event->time_msec); + + if (event->updated_axes & WLR_TABLET_TOOL_AXIS_PRESSURE) + wlr_tablet_v2_tablet_tool_notify_pressure(tablet_tool, event->pressure); diff --git a/patches/tablet-input/tablet-input-main-a2d03cf.patch b/patches/tablet-input/tablet-input-main-a2d03cf.patch index 595ad81..33a2c6e 100644 --- a/patches/tablet-input/tablet-input-main-a2d03cf.patch +++ b/patches/tablet-input/tablet-input-main-a2d03cf.patch @@ -1,7 +1,7 @@ -From a14dff19f38fffa498f3de4679952b39b4323502 Mon Sep 17 00:00:00 2001 +From 63b62ff508ecd2e74d95ba0550b3ec856b478bbb Mon Sep 17 00:00:00 2001 From: pi66 -Date: Wed, 8 Apr 2026 21:47:41 +0100 -Subject: [PATCH] feat: add pad/tool bindings and pen region +Date: Mon, 27 Apr 2026 21:21:52 +0100 +Subject: [PATCH] fix: enable focus-follow-mouse for tablet pen input --- Makefile | 6 +- @@ -34,7 +34,7 @@ index 578194f..e0d1835 100644 config.h: cp config.def.h $@ diff --git a/config.def.h b/config.def.h -index 8a6eda0..288494e 100644 +index 8a6eda0..9c678d4 100644 --- a/config.def.h +++ b/config.def.h @@ -4,6 +4,7 @@ @@ -75,10 +75,10 @@ index 8a6eda0..288494e 100644 + { 0, 0, NULL, {0} } +}; diff --git a/dwl.c b/dwl.c -index 44f3ad9..7572756 100644 +index 101a45f..f09b662 100644 --- a/dwl.c +++ b/dwl.c -@@ -51,6 +51,9 @@ +@@ -52,6 +52,9 @@ #include #include #include @@ -88,7 +88,7 @@ index 44f3ad9..7572756 100644 #include #include #include -@@ -239,6 +242,20 @@ typedef struct { +@@ -240,6 +243,20 @@ typedef struct { struct wl_listener destroy; } SessionLock; @@ -109,7 +109,7 @@ index 44f3ad9..7572756 100644 /* function declarations */ static void applybounds(Client *c, struct wlr_box *bbox); static void applyrules(Client *c); -@@ -268,6 +285,7 @@ static void createnotify(struct wl_listener *listener, void *data); +@@ -269,6 +286,7 @@ static void createnotify(struct wl_listener *listener, void *data); static void createpointer(struct wlr_pointer *pointer); static void createpointerconstraint(struct wl_listener *listener, void *data); static void createpopup(struct wl_listener *listener, void *data); @@ -117,7 +117,7 @@ index 44f3ad9..7572756 100644 static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); static void cursorframe(struct wl_listener *listener, void *data); static void cursorwarptohint(void); -@@ -281,6 +299,10 @@ static void destroynotify(struct wl_listener *listener, void *data); +@@ -282,6 +300,10 @@ static void destroynotify(struct wl_listener *listener, void *data); static void destroypointerconstraint(struct wl_listener *listener, void *data); static void destroysessionlock(struct wl_listener *listener, void *data); static void destroykeyboardgroup(struct wl_listener *listener, void *data); @@ -128,11 +128,11 @@ index 44f3ad9..7572756 100644 static Monitor *dirtomon(enum wlr_direction dir); static void focusclient(Client *c, int lift); static void focusmon(const Arg *arg); -@@ -333,6 +355,12 @@ static void spawn(const Arg *arg); +@@ -334,6 +356,12 @@ static void spawn(const Arg *arg); static void startdrag(struct wl_listener *listener, void *data); static void tag(const Arg *arg); static void tagmon(const Arg *arg); -+static void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, double x, double y, double dx, double dy); ++static void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, double x, double y, double dx, double dy, uint32_t time); +static void tablettoolproximity(struct wl_listener *listener, void *data); +static void tabletpadbutton(struct wl_listener *listener, void *data); +static void tablettoolaxis(struct wl_listener *listener, void *data); @@ -141,7 +141,7 @@ index 44f3ad9..7572756 100644 static void tile(Monitor *m); static void togglefloating(const Arg *arg); static void togglefullscreen(const Arg *arg); -@@ -390,6 +418,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint; +@@ -391,6 +419,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint; static struct wlr_cursor *cursor; static struct wlr_xcursor_manager *cursor_mgr; @@ -155,7 +155,7 @@ index 44f3ad9..7572756 100644 static struct wlr_scene_rect *root_bg; static struct wlr_session_lock_manager_v1 *session_lock_mgr; static struct wlr_scene_rect *locked_bg; -@@ -412,6 +447,14 @@ static struct wl_listener cursor_button = {.notify = buttonpress}; +@@ -413,6 +448,14 @@ static struct wl_listener cursor_button = {.notify = buttonpress}; static struct wl_listener cursor_frame = {.notify = cursorframe}; static struct wl_listener cursor_motion = {.notify = motionrelative}; static struct wl_listener cursor_motion_absolute = {.notify = motionabsolute}; @@ -170,7 +170,7 @@ index 44f3ad9..7572756 100644 static struct wl_listener gpu_reset = {.notify = gpureset}; static struct wl_listener layout_change = {.notify = updatemons}; static struct wl_listener new_idle_inhibitor = {.notify = createidleinhibitor}; -@@ -1199,6 +1242,27 @@ createpopup(struct wl_listener *listener, void *data) +@@ -1200,6 +1243,27 @@ createpopup(struct wl_listener *listener, void *data) LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup); } @@ -198,7 +198,7 @@ index 44f3ad9..7572756 100644 void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint) { -@@ -1383,6 +1447,37 @@ destroykeyboardgroup(struct wl_listener *listener, void *data) +@@ -1384,6 +1448,37 @@ destroykeyboardgroup(struct wl_listener *listener, void *data) free(group); } @@ -236,7 +236,7 @@ index 44f3ad9..7572756 100644 Monitor * dirtomon(enum wlr_direction dir) { -@@ -1581,6 +1676,7 @@ inputdevice(struct wl_listener *listener, void *data) +@@ -1582,6 +1677,7 @@ inputdevice(struct wl_listener *listener, void *data) /* This event is raised by the backend when a new input device becomes * available. */ struct wlr_input_device *device = data; @@ -244,7 +244,7 @@ index 44f3ad9..7572756 100644 uint32_t caps; switch (device->type) { -@@ -1590,6 +1686,15 @@ inputdevice(struct wl_listener *listener, void *data) +@@ -1591,6 +1687,15 @@ inputdevice(struct wl_listener *listener, void *data) case WLR_INPUT_DEVICE_POINTER: createpointer(wlr_pointer_from_input_device(device)); break; @@ -260,7 +260,7 @@ index 44f3ad9..7572756 100644 default: /* TODO handle other input device types */ break; -@@ -2585,6 +2690,8 @@ setup(void) +@@ -2587,6 +2692,8 @@ setup(void) relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy); @@ -269,7 +269,7 @@ index 44f3ad9..7572756 100644 /* * Creates a cursor, which is a wlroots utility for tracking the cursor * image shown on screen. -@@ -2614,6 +2721,11 @@ setup(void) +@@ -2616,6 +2723,11 @@ setup(void) wl_signal_add(&cursor->events.button, &cursor_button); wl_signal_add(&cursor->events.axis, &cursor_axis); wl_signal_add(&cursor->events.frame, &cursor_frame); @@ -281,7 +281,7 @@ index 44f3ad9..7572756 100644 cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1); wl_signal_add(&cursor_shape_mgr->events.request_set_shape, &request_set_cursor_shape); -@@ -2709,6 +2821,197 @@ tagmon(const Arg *arg) +@@ -2711,6 +2823,197 @@ tagmon(const Arg *arg) setmon(sel, dirtomon(arg->i), 0); } @@ -326,7 +326,7 @@ index 44f3ad9..7572756 100644 + +void +tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x, bool change_y, -+ double x, double y, double dx, double dy) ++ double x, double y, double dx, double dy, uint32_t time) +{ + struct wlr_surface *surface = NULL; + double sx, sy; @@ -351,7 +351,7 @@ index 44f3ad9..7572756 100644 + break; + } + -+ motionnotify(0, NULL, 0, 0, 0, 0); ++ motionnotify(time, NULL, 0, 0, 0, 0); + + xytonode(cursor->x, cursor->y, &surface, NULL, NULL, &sx, &sy); + if (surface && !wlr_surface_accepts_tablet_v2(surface, tablet)) @@ -398,7 +398,7 @@ index 44f3ad9..7572756 100644 + destroytabletsurfacenotify(NULL, NULL); + break; + case WLR_TABLET_TOOL_PROXIMITY_IN: -+ tablettoolmotion(tablet_tool, true, true, event->x, event->y, 0, 0); ++ tablettoolmotion(tablet_tool, true, true, event->x, event->y, 0, 0, event->time_msec); + break; + } +} @@ -414,7 +414,7 @@ index 44f3ad9..7572756 100644 + tablettoolmotion(tablet_tool, + event->updated_axes & WLR_TABLET_TOOL_AXIS_X, + event->updated_axes & WLR_TABLET_TOOL_AXIS_Y, -+ event->x, event->y, event->dx, event->dy); ++ event->x, event->y, event->dx, event->dy, event->time_msec); + + if (event->updated_axes & WLR_TABLET_TOOL_AXIS_PRESSURE) + wlr_tablet_v2_tablet_tool_notify_pressure(tablet_tool, event->pressure);