remove pointer-gestures-unstable-v1 from stale folder

export pointer-gestures-unstable-v1 with `git format-patch`
This commit is contained in:
wochap 2024-03-08 13:28:23 -05:00 committed by A Frederick Christensen
parent 3f9a58cde9
commit 42002d1d1e
2 changed files with 161 additions and 309 deletions

View File

@ -1,11 +0,0 @@
### Description
Forward the following events to client:
swipe_begin, swipe_update, swipe_end, pinch_begin, pinch_update and pinch_end
This patch allows you to pinch zoom in Chrome for example and in combination with the following patch https://github.com/djpohly/dwl/wiki/gestures and https://github.com/djpohly/dwl/wiki/shiftview, it would allow you to switch workspaces by performing a 3-finger swipe on your touchpad.
### Download
- [2023-09-08](https://github.com/djpohly/dwl/compare/main...wochap:pointer-gestures-unstable-v1.patch)
### Authors
- [wochap](https://github.com/wochap)

View File

@ -1,299 +1,162 @@
diff --git a/dwl.c b/dwl.c From 12e9008e1f9ab82cc5342ab7579859912ed7d1a3 Mon Sep 17 00:00:00 2001
index ef27a1d..2aeaca1 100644 From: wochap <gean.marroquin@gmail.com>
--- a/dwl.c Date: Wed, 6 Mar 2024 07:21:15 -0500
+++ b/dwl.c Subject: [PATCH] Implement pointer-gestures-unstable-v1
@@ -34,6 +34,7 @@
#include <wlr/types/wlr_output_layout.h> Forward the following events to client: swipe_begin, swipe_update, swipe_end, pinch_begin, pinch_update and pinch_end
#include <wlr/types/wlr_output_management_v1.h> ---
#include <wlr/types/wlr_pointer.h> dwl.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#include <wlr/types/wlr_pointer_gestures_v1.h> 1 file changed, 103 insertions(+)
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_primary_selection.h> diff --git a/dwl.c b/dwl.c
#include <wlr/types/wlr_primary_selection_v1.h> index ef27a1d..2aeaca1 100644
@@ -235,6 +236,12 @@ static void arrangelayer(Monitor *m, struct wl_list *list, --- a/dwl.c
static void arrangelayers(Monitor *m); +++ b/dwl.c
static void axisnotify(struct wl_listener *listener, void *data); @@ -34,6 +34,7 @@
static void buttonpress(struct wl_listener *listener, void *data); #include <wlr/types/wlr_output_layout.h>
+static void swipe_begin(struct wl_listener *listener, void *data); #include <wlr/types/wlr_output_management_v1.h>
+static void swipe_update(struct wl_listener *listener, void *data); #include <wlr/types/wlr_pointer.h>
+static void swipe_end(struct wl_listener *listener, void *data); +#include <wlr/types/wlr_pointer_gestures_v1.h>
+static void pinch_begin(struct wl_listener *listener, void *data); #include <wlr/types/wlr_presentation_time.h>
+static void pinch_update(struct wl_listener *listener, void *data); #include <wlr/types/wlr_primary_selection.h>
+static void pinch_end(struct wl_listener *listener, void *data); #include <wlr/types/wlr_primary_selection_v1.h>
static void chvt(const Arg *arg); @@ -235,6 +236,12 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
static void checkidleinhibitor(struct wlr_surface *exclude); static void arrangelayers(Monitor *m);
static void cleanup(void); static void axisnotify(struct wl_listener *listener, void *data);
@@ -357,6 +364,7 @@ static struct wlr_output_manager_v1 *output_mgr; static void buttonpress(struct wl_listener *listener, void *data);
static struct wlr_gamma_control_manager_v1 *gamma_control_mgr; +static void swipe_begin(struct wl_listener *listener, void *data);
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr; +static void swipe_update(struct wl_listener *listener, void *data);
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr; +static void swipe_end(struct wl_listener *listener, void *data);
+static struct wlr_pointer_gestures_v1 *pointer_gestures; +static void pinch_begin(struct wl_listener *listener, void *data);
+static void pinch_update(struct wl_listener *listener, void *data);
static struct wlr_cursor *cursor; +static void pinch_end(struct wl_listener *listener, void *data);
static struct wlr_xcursor_manager *cursor_mgr; static void chvt(const Arg *arg);
@@ -597,6 +605,94 @@ buttonpress(struct wl_listener *listener, void *data) static void checkidleinhibitor(struct wlr_surface *exclude);
event->time_msec, event->button, event->state); static void cleanup(void);
} @@ -357,6 +364,7 @@ static struct wlr_output_manager_v1 *output_mgr;
static struct wlr_gamma_control_manager_v1 *gamma_control_mgr;
+void static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
+swipe_begin(struct wl_listener *listener, void *data) static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
+{ +static struct wlr_pointer_gestures_v1 *pointer_gestures;
+ struct wlr_pointer_swipe_begin_event *event = data;
+ static struct wlr_cursor *cursor;
+ // Forward swipe begin event to client static struct wlr_xcursor_manager *cursor_mgr;
+ wlr_pointer_gestures_v1_send_swipe_begin( @@ -597,6 +605,94 @@ buttonpress(struct wl_listener *listener, void *data)
+ pointer_gestures, event->time_msec, event->button, event->state);
+ seat, }
+ event->time_msec,
+ event->fingers +void
+ ); +swipe_begin(struct wl_listener *listener, void *data)
+} +{
+ + struct wlr_pointer_swipe_begin_event *event = data;
+void +
+swipe_update(struct wl_listener *listener, void *data) + // Forward swipe begin event to client
+{ + wlr_pointer_gestures_v1_send_swipe_begin(
+ struct wlr_pointer_swipe_update_event *event = data; + pointer_gestures,
+ + seat,
+ // Forward swipe update event to client + event->time_msec,
+ wlr_pointer_gestures_v1_send_swipe_update( + event->fingers
+ pointer_gestures, + );
+ seat, +}
+ event->time_msec, +
+ event->dx, +void
+ event->dy +swipe_update(struct wl_listener *listener, void *data)
+ ); +{
+} + struct wlr_pointer_swipe_update_event *event = data;
+ +
+void + // Forward swipe update event to client
+swipe_end(struct wl_listener *listener, void *data) + wlr_pointer_gestures_v1_send_swipe_update(
+{ + pointer_gestures,
+ struct wlr_pointer_swipe_end_event *event = data; + seat,
+ + event->time_msec,
+ // Forward swipe end event to client + event->dx,
+ wlr_pointer_gestures_v1_send_swipe_end( + event->dy
+ pointer_gestures, + );
+ seat, +}
+ event->time_msec, +
+ event->cancelled +void
+ ); +swipe_end(struct wl_listener *listener, void *data)
+} +{
+ + struct wlr_pointer_swipe_end_event *event = data;
+void +
+pinch_begin(struct wl_listener *listener, void *data) + // Forward swipe end event to client
+{ + wlr_pointer_gestures_v1_send_swipe_end(
+ struct wlr_pointer_pinch_begin_event *event = data; + pointer_gestures,
+ + seat,
+ // Forward pinch begin event to client + event->time_msec,
+ wlr_pointer_gestures_v1_send_pinch_begin( + event->cancelled
+ pointer_gestures, + );
+ seat, +}
+ event->time_msec, +
+ event->fingers +void
+ ); +pinch_begin(struct wl_listener *listener, void *data)
+} +{
+ + struct wlr_pointer_pinch_begin_event *event = data;
+void +
+pinch_update(struct wl_listener *listener, void *data) + // Forward pinch begin event to client
+{ + wlr_pointer_gestures_v1_send_pinch_begin(
+ struct wlr_pointer_pinch_update_event *event = data; + pointer_gestures,
+ + seat,
+ // Forward pinch update event to client + event->time_msec,
+ wlr_pointer_gestures_v1_send_pinch_update( + event->fingers
+ pointer_gestures, + );
+ seat, +}
+ event->time_msec, +
+ event->dx, +void
+ event->dy, +pinch_update(struct wl_listener *listener, void *data)
+ event->scale, +{
+ event->rotation + struct wlr_pointer_pinch_update_event *event = data;
+ ); +
+} + // Forward pinch update event to client
+ + wlr_pointer_gestures_v1_send_pinch_update(
+void + pointer_gestures,
+pinch_end(struct wl_listener *listener, void *data) + seat,
+{ + event->time_msec,
+ struct wlr_pointer_pinch_end_event *event = data; + event->dx,
+ + event->dy,
+ // Forward pinch end event to client + event->scale,
+ wlr_pointer_gestures_v1_send_pinch_end( + event->rotation
+ pointer_gestures, + );
+ seat, +}
+ event->time_msec, +
+ event->cancelled +void
+ ); +pinch_end(struct wl_listener *listener, void *data)
+} +{
+ + struct wlr_pointer_pinch_end_event *event = data;
void +
chvt(const Arg *arg) + // Forward pinch end event to client
{ + wlr_pointer_gestures_v1_send_pinch_end(
@@ -2315,6 +2411,12 @@ setup(void) + pointer_gestures,
LISTEN_STATIC(&cursor->events.motion, motionrelative); + seat,
LISTEN_STATIC(&cursor->events.motion_absolute, motionabsolute); + event->time_msec,
LISTEN_STATIC(&cursor->events.button, buttonpress); + event->cancelled
+ LISTEN_STATIC(&cursor->events.swipe_begin, swipe_begin); + );
+ LISTEN_STATIC(&cursor->events.swipe_update, swipe_update); +}
+ LISTEN_STATIC(&cursor->events.swipe_end, swipe_end); +
+ LISTEN_STATIC(&cursor->events.pinch_begin, pinch_begin); void
+ LISTEN_STATIC(&cursor->events.pinch_update, pinch_update); chvt(const Arg *arg)
+ LISTEN_STATIC(&cursor->events.pinch_end, pinch_end); {
LISTEN_STATIC(&cursor->events.axis, axisnotify); @@ -2315,6 +2411,12 @@ setup(void)
LISTEN_STATIC(&cursor->events.frame, cursorframe); LISTEN_STATIC(&cursor->events.motion, motionrelative);
LISTEN_STATIC(&cursor->events.motion_absolute, motionabsolute);
@@ -2331,6 +2433,7 @@ setup(void) LISTEN_STATIC(&cursor->events.button, buttonpress);
LISTEN_STATIC(&backend->events.new_input, inputdevice); + LISTEN_STATIC(&cursor->events.swipe_begin, swipe_begin);
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy); + LISTEN_STATIC(&cursor->events.swipe_update, swipe_update);
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard); + LISTEN_STATIC(&cursor->events.swipe_end, swipe_end);
+ pointer_gestures = wlr_pointer_gestures_v1_create(dpy); + LISTEN_STATIC(&cursor->events.pinch_begin, pinch_begin);
seat = wlr_seat_create(dpy, "seat0"); + LISTEN_STATIC(&cursor->events.pinch_update, pinch_update);
LISTEN_STATIC(&seat->events.request_set_cursor, setcursor); + LISTEN_STATIC(&cursor->events.pinch_end, pinch_end);
LISTEN_STATIC(&seat->events.request_set_selection, setsel); LISTEN_STATIC(&cursor->events.axis, axisnotify);
diff --git a/dwl.c b/dwl.c LISTEN_STATIC(&cursor->events.frame, cursorframe);
index ef27a1d..2aeaca1 100644
--- a/dwl.c @@ -2331,6 +2433,7 @@ setup(void)
+++ b/dwl.c LISTEN_STATIC(&backend->events.new_input, inputdevice);
@@ -34,6 +34,7 @@ virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
#include <wlr/types/wlr_output_layout.h> LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
#include <wlr/types/wlr_output_management_v1.h> + pointer_gestures = wlr_pointer_gestures_v1_create(dpy);
#include <wlr/types/wlr_pointer.h> seat = wlr_seat_create(dpy, "seat0");
+#include <wlr/types/wlr_pointer_gestures_v1.h> LISTEN_STATIC(&seat->events.request_set_cursor, setcursor);
#include <wlr/types/wlr_presentation_time.h> LISTEN_STATIC(&seat->events.request_set_selection, setsel);
#include <wlr/types/wlr_primary_selection.h> --
#include <wlr/types/wlr_primary_selection_v1.h> 2.42.0
@@ -235,6 +236,12 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
static void arrangelayers(Monitor *m);
static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data);
+static void swipe_begin(struct wl_listener *listener, void *data);
+static void swipe_update(struct wl_listener *listener, void *data);
+static void swipe_end(struct wl_listener *listener, void *data);
+static void pinch_begin(struct wl_listener *listener, void *data);
+static void pinch_update(struct wl_listener *listener, void *data);
+static void pinch_end(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg);
static void checkidleinhibitor(struct wlr_surface *exclude);
static void cleanup(void);
@@ -357,6 +364,7 @@ static struct wlr_output_manager_v1 *output_mgr;
static struct wlr_gamma_control_manager_v1 *gamma_control_mgr;
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
+static struct wlr_pointer_gestures_v1 *pointer_gestures;
static struct wlr_cursor *cursor;
static struct wlr_xcursor_manager *cursor_mgr;
@@ -597,6 +605,94 @@ buttonpress(struct wl_listener *listener, void *data)
event->time_msec, event->button, event->state);
}
+void
+swipe_begin(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_swipe_begin_event *event = data;
+
+ // Forward swipe begin event to client
+ wlr_pointer_gestures_v1_send_swipe_begin(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->fingers
+ );
+}
+
+void
+swipe_update(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_swipe_update_event *event = data;
+
+ // Forward swipe update event to client
+ wlr_pointer_gestures_v1_send_swipe_update(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->dx,
+ event->dy
+ );
+}
+
+void
+swipe_end(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_swipe_end_event *event = data;
+
+ // Forward swipe end event to client
+ wlr_pointer_gestures_v1_send_swipe_end(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->cancelled
+ );
+}
+
+void
+pinch_begin(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_pinch_begin_event *event = data;
+
+ // Forward pinch begin event to client
+ wlr_pointer_gestures_v1_send_pinch_begin(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->fingers
+ );
+}
+
+void
+pinch_update(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_pinch_update_event *event = data;
+
+ // Forward pinch update event to client
+ wlr_pointer_gestures_v1_send_pinch_update(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->dx,
+ event->dy,
+ event->scale,
+ event->rotation
+ );
+}
+
+void
+pinch_end(struct wl_listener *listener, void *data)
+{
+ struct wlr_pointer_pinch_end_event *event = data;
+
+ // Forward pinch end event to client
+ wlr_pointer_gestures_v1_send_pinch_end(
+ pointer_gestures,
+ seat,
+ event->time_msec,
+ event->cancelled
+ );
+}
+
void
chvt(const Arg *arg)
{
@@ -2315,6 +2411,12 @@ setup(void)
LISTEN_STATIC(&cursor->events.motion, motionrelative);
LISTEN_STATIC(&cursor->events.motion_absolute, motionabsolute);
LISTEN_STATIC(&cursor->events.button, buttonpress);
+ LISTEN_STATIC(&cursor->events.swipe_begin, swipe_begin);
+ LISTEN_STATIC(&cursor->events.swipe_update, swipe_update);
+ LISTEN_STATIC(&cursor->events.swipe_end, swipe_end);
+ LISTEN_STATIC(&cursor->events.pinch_begin, pinch_begin);
+ LISTEN_STATIC(&cursor->events.pinch_update, pinch_update);
+ LISTEN_STATIC(&cursor->events.pinch_end, pinch_end);
LISTEN_STATIC(&cursor->events.axis, axisnotify);
LISTEN_STATIC(&cursor->events.frame, cursorframe);
@@ -2331,6 +2433,7 @@ setup(void)
LISTEN_STATIC(&backend->events.new_input, inputdevice);
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
+ pointer_gestures = wlr_pointer_gestures_v1_create(dpy);
seat = wlr_seat_create(dpy, "seat0");
LISTEN_STATIC(&seat->events.request_set_cursor, setcursor);
LISTEN_STATIC(&seat->events.request_set_selection, setsel);