update gestures for HEAD

This commit is contained in:
wochap 2024-04-11 18:23:43 -05:00
parent 655fd2916c
commit be3735bc6a
No known key found for this signature in database
GPG Key ID: FE4CF844E73095E1

View File

@ -1,30 +1,28 @@
From a68af2e251dcc0cccef32a3cbbbe44481ed32576 Mon Sep 17 00:00:00 2001 From 6b9c8f96a2f1ed3c36d260df1e1dcba24cb98550 Mon Sep 17 00:00:00 2001
From: wochap <gean.marroquin@gmail.com> From: wochap <gean.marroquin@gmail.com>
Date: Wed, 6 Mar 2024 10:35:18 -0500 Date: Thu, 11 Apr 2024 14:46:48 -0500
Subject: [PATCH] add swipe gestures to trigger functions Subject: [PATCH] add swipe gestures to trigger functions
like libinput-gestures, it supports the following gestures: SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT and SWIPE_RIGHT like libinput-gestures, it supports the following gestures: SWIPE_UP, SWIPE_DOWN, SWIPE_LEFT and SWIPE_RIGHTsupport multiple fingers count in gestures[]support mods in gestures[]
support multiple fingers count in gestures[]
support mods in gestures[]
--- ---
config.def.h | 9 +++++++ config.def.h | 9 +++++++
dwl.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ dwl.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+) 2 files changed, 77 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index db0babc..e2ec245 100644 index 8847e58..53a8437 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -13,6 +13,8 @@ static const float urgentcolor[] = COLOR(0xff0000ff); @@ -14,6 +14,8 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
+static const unsigned int swipe_min_threshold = 0; +static const unsigned int swipe_min_threshold = 0;
+ +
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9) #define TAGCOUNT (9)
@@ -167,3 +169,10 @@ static const Button buttons[] = { @@ -169,3 +171,10 @@ static const Button buttons[] = {
{ MODKEY, BTN_MIDDLE, togglefloating, {0} }, { MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
}; };
@ -36,10 +34,10 @@ index db0babc..e2ec245 100644
+ { MODKEY, SWIPE_DOWN, 3, focusstack, {.i = -1} }, + { MODKEY, SWIPE_DOWN, 3, focusstack, {.i = -1} },
+}; +};
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 2aeaca1..fd7ab00 100644 index e96ea09..7e8a684 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -81,6 +81,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrFS, LyrTop, LyrOverlay, LyrBlock, @@ -87,6 +87,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock,
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */ NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
#endif #endif
@ -47,7 +45,7 @@ index 2aeaca1..fd7ab00 100644
typedef union { typedef union {
int i; int i;
@@ -96,6 +97,14 @@ typedef struct { @@ -102,6 +103,14 @@ typedef struct {
const Arg arg; const Arg arg;
} Button; } Button;
@ -62,7 +60,7 @@ index 2aeaca1..fd7ab00 100644
typedef struct Monitor Monitor; typedef struct Monitor Monitor;
typedef struct { typedef struct {
/* Must keep these three elements in this order */ /* Must keep these three elements in this order */
@@ -236,6 +245,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list, @@ -249,6 +258,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
static void arrangelayers(Monitor *m); static void arrangelayers(Monitor *m);
static void axisnotify(struct wl_listener *listener, void *data); static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data); static void buttonpress(struct wl_listener *listener, void *data);
@ -70,7 +68,7 @@ index 2aeaca1..fd7ab00 100644
static void swipe_begin(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_update(struct wl_listener *listener, void *data);
static void swipe_end(struct wl_listener *listener, void *data); static void swipe_end(struct wl_listener *listener, void *data);
@@ -385,6 +395,10 @@ static struct wlr_box sgeom; @@ -413,6 +423,10 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -81,7 +79,7 @@ index 2aeaca1..fd7ab00 100644
#ifdef XWAYLAND #ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data); static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data);
@@ -404,6 +418,8 @@ static xcb_atom_t netatom[NetLast]; @@ -432,6 +446,8 @@ static xcb_atom_t netatom[NetLast];
/* attempt to encapsulate suck into one file */ /* attempt to encapsulate suck into one file */
#include "client.h" #include "client.h"
@ -90,7 +88,7 @@ index 2aeaca1..fd7ab00 100644
/* function implementations */ /* function implementations */
void void
applybounds(Client *c, struct wlr_box *bbox) applybounds(Client *c, struct wlr_box *bbox)
@@ -610,6 +626,11 @@ swipe_begin(struct wl_listener *listener, void *data) @@ -641,6 +657,11 @@ swipe_begin(struct wl_listener *listener, void *data)
{ {
struct wlr_pointer_swipe_begin_event *event = data; struct wlr_pointer_swipe_begin_event *event = data;
@ -102,7 +100,7 @@ index 2aeaca1..fd7ab00 100644
// Forward swipe begin event to client // Forward swipe begin event to client
wlr_pointer_gestures_v1_send_swipe_begin( wlr_pointer_gestures_v1_send_swipe_begin(
pointer_gestures, pointer_gestures,
@@ -624,6 +645,11 @@ swipe_update(struct wl_listener *listener, void *data) @@ -655,6 +676,11 @@ swipe_update(struct wl_listener *listener, void *data)
{ {
struct wlr_pointer_swipe_update_event *event = data; struct wlr_pointer_swipe_update_event *event = data;
@ -114,7 +112,7 @@ index 2aeaca1..fd7ab00 100644
// Forward swipe update event to client // Forward swipe update event to client
wlr_pointer_gestures_v1_send_swipe_update( wlr_pointer_gestures_v1_send_swipe_update(
pointer_gestures, pointer_gestures,
@@ -634,11 +660,53 @@ swipe_update(struct wl_listener *listener, void *data) @@ -665,11 +691,53 @@ swipe_update(struct wl_listener *listener, void *data)
); );
} }
@ -125,8 +123,8 @@ index 2aeaca1..fd7ab00 100644
+ uint32_t mods; + uint32_t mods;
+ const Gesture *g; + const Gesture *g;
+ unsigned int motion; + unsigned int motion;
+ unsigned int adx = fabs(swipe_dx); + unsigned int adx = ROUND(fabs(swipe_dx));
+ unsigned int ady = fabs(swipe_dy); + unsigned int ady = ROUND(fabs(swipe_dy));
+ int handled = 0; + int handled = 0;
+ +
+ if (event->cancelled) { + if (event->cancelled) {
@ -169,5 +167,4 @@ index 2aeaca1..fd7ab00 100644
wlr_pointer_gestures_v1_send_swipe_end( wlr_pointer_gestures_v1_send_swipe_end(
pointer_gestures, pointer_gestures,
-- --
2.42.0 2.43.2