Update simple-touch-input.patch since pointer constraints merge

This commit is contained in:
A Frederick Christensen 2024-03-12 23:07:44 -05:00
parent cab910fd1a
commit 2723afe575
No known key found for this signature in database
GPG Key ID: 6183FA655784FC36

View File

@ -1,4 +1,4 @@
From 9d50f0acc00cf608a6841b02821796b300126624 Mon Sep 17 00:00:00 2001 From ec17952284ad1bc6e328df16024f3d39ca63ebec Mon Sep 17 00:00:00 2001
From: A Frederick Christensen <dwl@ivories.org> From: A Frederick Christensen <dwl@ivories.org>
Date: Sun, 14 Jan 2024 08:30:31 -0600 Date: Sun, 14 Jan 2024 08:30:31 -0600
Subject: [PATCH] Add SIMPLE touchscreen handling Subject: [PATCH] Add SIMPLE touchscreen handling
@ -7,24 +7,16 @@ This is based in part on original work by Bastien Brouant, "Unprex" at
https://github.com/Unprex/dwl https://github.com/Unprex/dwl
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!
This patch may be used with or without the pointer-constraints branch
from anon_cvptw's repository
https://codeberg.org/anon_cvptw/dwl/src/branch/main
In maintaining this patch, be sure to watch for changes to the In maintaining this patch, be sure to watch for changes to the
`motionabsolute` function in anon_cvptw's `main` branch: `motionabsolute` function:
The `touchdown` function here incorporates the contents of the The `touchdown` function here incorporates the contents of the
`motionabsolute` function, adds in the `wlr_cursor_warp_closest` call `motionabsolute` function, adds in the `wlr_cursor_warp_closest` call
and then the button press and then the button press.
If `motionabsolute` is modified, `touchdown` should [likely] mirror If `motionabsolute` is modified, `touchdown` should (likely) mirror
any of its modifications. any of its modifications.
!!!!!!!!!!!!!!!
If/when anon_cvptw's pointer-constraints pull request is merged into
the upstream https://codeberg.org/dwl/dwl codebase, this remark will
be removed from the simple-touch-input patch branch commit, and things
will be significantly simplified.
KNOWN BUGS: KNOWN BUGS:
@ -34,16 +26,15 @@ means that if you touch to click button 'Q' on the screen (for
instance), nothing happens; then you touch elsewhere on the screen and instance), nothing happens; then you touch elsewhere on the screen and
THEN button 'Q' registers a click. This is annoying, doesn't always THEN button 'Q' registers a click. This is annoying, doesn't always
happen, and I don't yet know how to fix it. happen, and I don't yet know how to fix it.
!!!!!!!!!!!!!!!
--- ---
dwl.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dwl.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+) 1 file changed, 83 insertions(+)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 76ed8aa..26dff23 100644 index d508d79..0773473 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -45,6 +45,7 @@ @@ -47,6 +47,7 @@
#include <wlr/types/wlr_session_lock_v1.h> #include <wlr/types/wlr_session_lock_v1.h>
#include <wlr/types/wlr_single_pixel_buffer_v1.h> #include <wlr/types/wlr_single_pixel_buffer_v1.h>
#include <wlr/types/wlr_subcompositor.h> #include <wlr/types/wlr_subcompositor.h>
@ -51,15 +42,15 @@ index 76ed8aa..26dff23 100644
#include <wlr/types/wlr_viewporter.h> #include <wlr/types/wlr_viewporter.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h>
@@ -255,6 +256,7 @@ static void createlocksurface(struct wl_listener *listener, void *data); @@ -264,6 +265,7 @@ static void createmon(struct wl_listener *listener, void *data);
static void createmon(struct wl_listener *listener, void *data);
static void createnotify(struct wl_listener *listener, void *data); static void createnotify(struct wl_listener *listener, void *data);
static void createpointer(struct wlr_pointer *pointer); static void createpointer(struct wlr_pointer *pointer);
static void createpointerconstraint(struct wl_listener *listener, void *data);
+static void createtouch(struct wlr_touch *touch); +static void createtouch(struct wlr_touch *touch);
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data); static void cursorframe(struct wl_listener *listener, void *data);
static void destroydecoration(struct wl_listener *listener, void *data); static void cursorwarptohint(void);
static void destroydragicon(struct wl_listener *listener, void *data); @@ -334,6 +336,8 @@ static void togglefloating(const Arg *arg);
@@ -321,6 +323,8 @@ static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
@ -68,8 +59,8 @@ index 76ed8aa..26dff23 100644
static void unlocksession(struct wl_listener *listener, void *data); static void unlocksession(struct wl_listener *listener, void *data);
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data); static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
static void unmapnotify(struct wl_listener *listener, void *data); static void unmapnotify(struct wl_listener *listener, void *data);
@@ -1015,6 +1019,50 @@ createpointer(struct wlr_pointer *pointer) @@ -1041,6 +1045,50 @@ createpointerconstraint(struct wl_listener *listener, void *data)
wlr_cursor_attach_input_device(cursor, &pointer->base); &pointer_constraint->destroy, destroypointerconstraint);
} }
+void +void
@ -117,9 +108,9 @@ index 76ed8aa..26dff23 100644
+} +}
+ +
void void
cursorframe(struct wl_listener *listener, void *data) cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
{ {
@@ -1344,6 +1392,9 @@ inputdevice(struct wl_listener *listener, void *data) @@ -1412,6 +1460,9 @@ inputdevice(struct wl_listener *listener, void *data)
case WLR_INPUT_DEVICE_POINTER: case WLR_INPUT_DEVICE_POINTER:
createpointer(wlr_pointer_from_input_device(device)); createpointer(wlr_pointer_from_input_device(device));
break; break;
@ -129,7 +120,7 @@ index 76ed8aa..26dff23 100644
default: default:
/* TODO handle other input device types */ /* TODO handle other input device types */
break; break;
@@ -2320,6 +2371,10 @@ setup(void) @@ -2427,6 +2478,10 @@ setup(void)
LISTEN_STATIC(&cursor->events.button, buttonpress); LISTEN_STATIC(&cursor->events.button, buttonpress);
LISTEN_STATIC(&cursor->events.axis, axisnotify); LISTEN_STATIC(&cursor->events.axis, axisnotify);
LISTEN_STATIC(&cursor->events.frame, cursorframe); LISTEN_STATIC(&cursor->events.frame, cursorframe);
@ -140,7 +131,7 @@ index 76ed8aa..26dff23 100644
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1); cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape); LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
@@ -2537,6 +2592,38 @@ toggleview(const Arg *arg) @@ -2644,6 +2699,34 @@ toggleview(const Arg *arg)
printstatus(); printstatus();
} }
@ -149,7 +140,6 @@ index 76ed8aa..26dff23 100644
+{ +{
+ struct wlr_pointer_button_event *button_event = data; + struct wlr_pointer_button_event *button_event = data;
+ +
+#ifdef POINTERCONSTRAINTS
+ struct wlr_pointer_motion_absolute_event *event = data; + struct wlr_pointer_motion_absolute_event *event = data;
+ double lx, ly, dx, dy; + double lx, ly, dx, dy;
+ +
@ -158,9 +148,6 @@ index 76ed8aa..26dff23 100644
+ dx = lx - cursor->x; + dx = lx - cursor->x;
+ dy = ly - cursor->y; + dy = ly - cursor->y;
+ motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy); + motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy);
+#else
+ motionabsolute(listener, data);
+#endif
+ +
+ button_event->button=BTN_LEFT; + button_event->button=BTN_LEFT;
+ button_event->state=WLR_BUTTON_PRESSED; + button_event->state=WLR_BUTTON_PRESSED;
@ -179,3 +166,6 @@ index 76ed8aa..26dff23 100644
void void
unlocksession(struct wl_listener *listener, void *data) unlocksession(struct wl_listener *listener, void *data)
{ {
--
2.43.2