diff --git a/patches/tablet-input/README.md b/patches/tablet-input/README.md index 4cbcd94..3b3be09 100644 --- a/patches/tablet-input/README.md +++ b/patches/tablet-input/README.md @@ -16,7 +16,7 @@ There was discussion of this matter in [Issue #141](https://codeberg.org/dwl/dwl ### Download - [git branch](https://codeberg.org/fauxmight/dwl/src/branch/tablet-input) -- [main 2025-01-01](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/tablet-input/tablet-input.patch) +- [main 2025-05-18](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/tablet-input/tablet-input.patch) - [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/tablet-input/tablet-input-0.7.patch) ### Authors diff --git a/patches/tablet-input/tablet-input.patch b/patches/tablet-input/tablet-input.patch index 960eab0..7be98eb 100644 --- a/patches/tablet-input/tablet-input.patch +++ b/patches/tablet-input/tablet-input.patch @@ -1,16 +1,16 @@ -From e504dc0fccfc3994962f03dc824d8907c6afc64f Mon Sep 17 00:00:00 2001 -From: choc -Date: Sat, 4 May 2024 01:16:12 +0800 -Subject: [PATCH] implement wlr-tablet-v2 +From 0659663b7eb9cafbd4f86779084765aa838e29cd Mon Sep 17 00:00:00 2001 +From: A Frederick Christensen +Date: Sat, 17 May 2025 23:26:15 -0500 +Subject: [PATCH] Add tablet input --- Makefile | 6 +- config.def.h | 1 + - dwl.c | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 230 insertions(+), 1 deletion(-) + dwl.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 237 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile -index f955e7b..ce1b556 100644 +index 578194f..e0d1835 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ dwl: dwl.o util.o @@ -46,10 +46,10 @@ index 22d2171..3ad98ef 100644 static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ diff --git a/dwl.c b/dwl.c -index ac9c36b..b8d129f 100644 +index 4816159..e8d36ac 100644 --- a/dwl.c +++ b/dwl.c -@@ -50,6 +50,9 @@ +@@ -51,6 +51,9 @@ #include #include #include @@ -59,7 +59,7 @@ index ac9c36b..b8d129f 100644 #include #include #include -@@ -270,6 +273,7 @@ static void createnotify(struct wl_listener *listener, void *data); +@@ -268,6 +271,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); @@ -67,9 +67,9 @@ index ac9c36b..b8d129f 100644 static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); static void cursorframe(struct wl_listener *listener, void *data); static void cursorwarptohint(void); -@@ -284,6 +288,9 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data); +@@ -281,6 +285,9 @@ 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 destroysessionmgr(struct wl_listener *listener, void *data); static void destroykeyboardgroup(struct wl_listener *listener, void *data); +static void destroytablet(struct wl_listener *listener, void *data); +static void destroytabletsurfacenotify(struct wl_listener *listener, void *data); @@ -77,7 +77,7 @@ index ac9c36b..b8d129f 100644 static Monitor *dirtomon(enum wlr_direction dir); static void focusclient(Client *c, int lift); static void focusmon(const Arg *arg); -@@ -337,6 +344,11 @@ static void spawn(const Arg *arg); +@@ -333,6 +340,11 @@ 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); @@ -89,7 +89,7 @@ index ac9c36b..b8d129f 100644 static void tile(Monitor *m); static void togglefloating(const Arg *arg); static void togglefullscreen(const Arg *arg); -@@ -396,6 +408,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint; +@@ -390,6 +402,13 @@ static struct wlr_pointer_constraint_v1 *active_constraint; static struct wlr_cursor *cursor; static struct wlr_xcursor_manager *cursor_mgr; @@ -103,7 +103,20 @@ index ac9c36b..b8d129f 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; -@@ -1133,6 +1152,28 @@ createpopup(struct wl_listener *listener, void *data) +@@ -412,6 +431,12 @@ 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}; ++static struct wl_listener tablet_device_destroy = {.notify = destroytablet}; ++static struct wl_listener tablet_tool_axis = {.notify = tablettoolaxis}; ++static struct wl_listener tablet_tool_button = {.notify = tablettoolbutton}; ++static struct wl_listener tablet_tool_destroy = {.notify = destroytablettool}; ++static struct wl_listener tablet_tool_proximity = {.notify = tablettoolproximity}; ++static struct wl_listener tablet_tool_tip = {.notify = tablettooltip}; + 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}; +@@ -1196,6 +1221,28 @@ createpopup(struct wl_listener *listener, void *data) LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup); } @@ -117,7 +130,7 @@ index ac9c36b..b8d129f 100644 + return; + + tablet = wlr_tablet_create(tablet_mgr, seat, device); -+ LISTEN_STATIC(&tablet->wlr_device->events.destroy, destroytablet); ++ wl_signal_add(&tablet->wlr_device->events.destroy, &tablet_device_destroy); + if (libinput_device_config_send_events_get_modes(device_handle)) { + libinput_device_config_send_events_set_mode(device_handle, send_events_mode); + wlr_cursor_attach_input_device(cursor, device); @@ -132,7 +145,7 @@ index ac9c36b..b8d129f 100644 void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint) { -@@ -1321,6 +1362,27 @@ destroykeyboardgroup(struct wl_listener *listener, void *data) +@@ -1380,6 +1427,27 @@ destroykeyboardgroup(struct wl_listener *listener, void *data) free(group); } @@ -160,7 +173,7 @@ index ac9c36b..b8d129f 100644 Monitor * dirtomon(enum wlr_direction dir) { -@@ -1540,6 +1602,12 @@ inputdevice(struct wl_listener *listener, void *data) +@@ -1587,6 +1655,12 @@ inputdevice(struct wl_listener *listener, void *data) case WLR_INPUT_DEVICE_POINTER: createpointer(wlr_pointer_from_input_device(device)); break; @@ -173,7 +186,7 @@ index ac9c36b..b8d129f 100644 default: /* TODO handle other input device types */ break; -@@ -2567,6 +2635,8 @@ setup(void) +@@ -2580,6 +2654,8 @@ setup(void) relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy); @@ -182,18 +195,19 @@ index ac9c36b..b8d129f 100644 /* * Creates a cursor, which is a wlroots utility for tracking the cursor * image shown on screen. -@@ -2596,6 +2666,10 @@ setup(void) - LISTEN_STATIC(&cursor->events.button, buttonpress); - LISTEN_STATIC(&cursor->events.axis, axisnotify); - LISTEN_STATIC(&cursor->events.frame, cursorframe); -+ LISTEN_STATIC(&cursor->events.tablet_tool_proximity, tablettoolproximity); -+ LISTEN_STATIC(&cursor->events.tablet_tool_axis, tablettoolaxis); -+ LISTEN_STATIC(&cursor->events.tablet_tool_button, tablettoolbutton); -+ LISTEN_STATIC(&cursor->events.tablet_tool_tip, tablettooltip); +@@ -2609,6 +2685,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); ++ wl_signal_add(&cursor->events.tablet_tool_proximity, &tablet_tool_proximity); ++ wl_signal_add(&cursor->events.tablet_tool_axis, &tablet_tool_axis); ++ wl_signal_add(&cursor->events.tablet_tool_button, &tablet_tool_button); ++ wl_signal_add(&cursor->events.tablet_tool_tip, &tablet_tool_tip); ++ cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1); - LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape); -@@ -2689,6 +2763,156 @@ tagmon(const Arg *arg) + wl_signal_add(&cursor_shape_mgr->events.request_set_shape, &request_set_cursor_shape); +@@ -2704,6 +2785,156 @@ tagmon(const Arg *arg) setmon(sel, dirtomon(arg->i), 0); } @@ -276,8 +290,8 @@ index ac9c36b..b8d129f 100644 + + if (!tablet_tool) { + tablet_tool = wlr_tablet_tool_create(tablet_mgr, seat, tool); -+ LISTEN_STATIC(&tablet_tool->wlr_tool->events.destroy, destroytablettool); -+ LISTEN_STATIC(&tablet_tool->events.set_cursor, setcursor); ++ wl_signal_add(&tablet_tool->wlr_tool->events.destroy, &tablet_tool_destroy); ++ wl_signal_add(&tablet_tool->events.set_cursor, &request_cursor); + } + + switch (event->state) { @@ -351,5 +365,5 @@ index ac9c36b..b8d129f 100644 tile(Monitor *m) { -- -2.43.0 +2.49.0