mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 17:54:17 +00:00
Update simple-touch-input.patch since pointer constraints merge
This commit is contained in:
parent
cab910fd1a
commit
2723afe575
@ -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>
|
||||
Date: Sun, 14 Jan 2024 08:30:31 -0600
|
||||
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
|
||||
|
||||
!!!!!!!!!!!!!!!
|
||||
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
|
||||
`motionabsolute` function in anon_cvptw's `main` branch:
|
||||
`motionabsolute` function:
|
||||
|
||||
The `touchdown` function here incorporates the contents of the
|
||||
`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.
|
||||
|
||||
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:
|
||||
|
||||
@ -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
|
||||
THEN button 'Q' registers a click. This is annoying, doesn't always
|
||||
happen, and I don't yet know how to fix it.
|
||||
!!!!!!!!!!!!!!!
|
||||
---
|
||||
dwl.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 87 insertions(+)
|
||||
dwl.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 83 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 76ed8aa..26dff23 100644
|
||||
index d508d79..0773473 100644
|
||||
--- a/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_single_pixel_buffer_v1.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_virtual_keyboard_v1.h>
|
||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||
@@ -255,6 +256,7 @@ static void createlocksurface(struct wl_listener *listener, void *data);
|
||||
static void createmon(struct wl_listener *listener, void *data);
|
||||
@@ -264,6 +265,7 @@ static void createmon(struct wl_listener *listener, void *data);
|
||||
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 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 destroydecoration(struct wl_listener *listener, void *data);
|
||||
static void destroydragicon(struct wl_listener *listener, void *data);
|
||||
@@ -321,6 +323,8 @@ static void togglefloating(const Arg *arg);
|
||||
static void cursorwarptohint(void);
|
||||
@@ -334,6 +336,8 @@ static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void toggletag(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 unmaplayersurfacenotify(struct wl_listener *listener, void *data);
|
||||
static void unmapnotify(struct wl_listener *listener, void *data);
|
||||
@@ -1015,6 +1019,50 @@ createpointer(struct wlr_pointer *pointer)
|
||||
wlr_cursor_attach_input_device(cursor, &pointer->base);
|
||||
@@ -1041,6 +1045,50 @@ createpointerconstraint(struct wl_listener *listener, void *data)
|
||||
&pointer_constraint->destroy, destroypointerconstraint);
|
||||
}
|
||||
|
||||
+void
|
||||
@ -117,9 +108,9 @@ index 76ed8aa..26dff23 100644
|
||||
+}
|
||||
+
|
||||
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:
|
||||
createpointer(wlr_pointer_from_input_device(device));
|
||||
break;
|
||||
@ -129,7 +120,7 @@ index 76ed8aa..26dff23 100644
|
||||
default:
|
||||
/* TODO handle other input device types */
|
||||
break;
|
||||
@@ -2320,6 +2371,10 @@ setup(void)
|
||||
@@ -2427,6 +2478,10 @@ setup(void)
|
||||
LISTEN_STATIC(&cursor->events.button, buttonpress);
|
||||
LISTEN_STATIC(&cursor->events.axis, axisnotify);
|
||||
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);
|
||||
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();
|
||||
}
|
||||
|
||||
@ -149,7 +140,6 @@ index 76ed8aa..26dff23 100644
|
||||
+{
|
||||
+ struct wlr_pointer_button_event *button_event = data;
|
||||
+
|
||||
+#ifdef POINTERCONSTRAINTS
|
||||
+ struct wlr_pointer_motion_absolute_event *event = data;
|
||||
+ double lx, ly, dx, dy;
|
||||
+
|
||||
@ -158,9 +148,6 @@ index 76ed8aa..26dff23 100644
|
||||
+ dx = lx - cursor->x;
|
||||
+ dy = ly - cursor->y;
|
||||
+ motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy);
|
||||
+#else
|
||||
+ motionabsolute(listener, data);
|
||||
+#endif
|
||||
+
|
||||
+ button_event->button=BTN_LEFT;
|
||||
+ button_event->state=WLR_BUTTON_PRESSED;
|
||||
@ -179,3 +166,6 @@ index 76ed8aa..26dff23 100644
|
||||
void
|
||||
unlocksession(struct wl_listener *listener, void *data)
|
||||
{
|
||||
--
|
||||
2.43.2
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user