sync gestures patch with latest dwl

This commit is contained in:
wochap 2024-07-09 10:57:29 -05:00
parent 3a3efa39b0
commit 13d96b51b5
No known key found for this signature in database
GPG Key ID: FE4CF844E73095E1

View File

@ -1,16 +1,15 @@
From 6b9c8f96a2f1ed3c36d260df1e1dcba24cb98550 Mon Sep 17 00:00:00 2001
From 42f97e88bd901d81b81da61c44a790b583706308 Mon Sep 17 00:00:00 2001
From: wochap <gean.marroquin@gmail.com>
Date: Thu, 11 Apr 2024 14:46:48 -0500
Subject: [PATCH] add swipe gestures to trigger functions
Date: Fri, 5 Jul 2024 11:18:49 -0500
Subject: [PATCH] implement gestures
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[]
---
config.def.h | 9 +++++++
dwl.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
diff --git a/config.def.h b/config.def.h
index 8847e58..53a8437 100644
index 22d2171..8b75564 100644
--- a/config.def.h
+++ b/config.def.h
@@ -14,6 +14,8 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
@ -22,7 +21,7 @@ index 8847e58..53a8437 100644
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
@@ -169,3 +171,10 @@ static const Button buttons[] = {
@@ -174,3 +176,10 @@ static const Button buttons[] = {
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};
@ -34,10 +33,10 @@ index 8847e58..53a8437 100644
+ { MODKEY, SWIPE_DOWN, 3, focusstack, {.i = -1} },
+};
diff --git a/dwl.c b/dwl.c
index e96ea09..7e8a684 100644
index ded83e2..5d861e8 100644
--- a/dwl.c
+++ b/dwl.c
@@ -87,6 +87,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock,
@@ -88,6 +88,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock,
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
#endif
@ -45,7 +44,7 @@ index e96ea09..7e8a684 100644
typedef union {
int i;
@@ -102,6 +103,14 @@ typedef struct {
@@ -103,6 +104,14 @@ typedef struct {
const Arg arg;
} Button;
@ -60,7 +59,7 @@ index e96ea09..7e8a684 100644
typedef struct Monitor Monitor;
typedef struct {
/* Must keep these three elements in this order */
@@ -249,6 +258,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
@@ -251,6 +260,7 @@ 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);
@ -68,7 +67,7 @@ index e96ea09..7e8a684 100644
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);
@@ -413,6 +423,10 @@ static struct wlr_box sgeom;
@@ -416,6 +426,10 @@ static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
@ -79,7 +78,7 @@ index e96ea09..7e8a684 100644
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
@@ -432,6 +446,8 @@ static xcb_atom_t netatom[NetLast];
@@ -435,6 +449,8 @@ static xcb_atom_t netatom[NetLast];
/* attempt to encapsulate suck into one file */
#include "client.h"
@ -88,7 +87,7 @@ index e96ea09..7e8a684 100644
/* function implementations */
void
applybounds(Client *c, struct wlr_box *bbox)
@@ -641,6 +657,11 @@ swipe_begin(struct wl_listener *listener, void *data)
@@ -657,6 +673,11 @@ swipe_begin(struct wl_listener *listener, void *data)
{
struct wlr_pointer_swipe_begin_event *event = data;
@ -100,7 +99,7 @@ index e96ea09..7e8a684 100644
// Forward swipe begin event to client
wlr_pointer_gestures_v1_send_swipe_begin(
pointer_gestures,
@@ -655,6 +676,11 @@ swipe_update(struct wl_listener *listener, void *data)
@@ -671,6 +692,11 @@ swipe_update(struct wl_listener *listener, void *data)
{
struct wlr_pointer_swipe_update_event *event = data;
@ -112,7 +111,7 @@ index e96ea09..7e8a684 100644
// Forward swipe update event to client
wlr_pointer_gestures_v1_send_swipe_update(
pointer_gestures,
@@ -665,11 +691,53 @@ swipe_update(struct wl_listener *listener, void *data)
@@ -681,11 +707,53 @@ swipe_update(struct wl_listener *listener, void *data)
);
}
@ -123,8 +122,8 @@ index e96ea09..7e8a684 100644
+ uint32_t mods;
+ const Gesture *g;
+ unsigned int motion;
+ unsigned int adx = ROUND(fabs(swipe_dx));
+ unsigned int ady = ROUND(fabs(swipe_dy));
+ unsigned int adx = (int)round(fabs(swipe_dx));
+ unsigned int ady = (int)round(fabs(swipe_dy));
+ int handled = 0;
+
+ if (event->cancelled) {
@ -167,4 +166,4 @@ index e96ea09..7e8a684 100644
wlr_pointer_gestures_v1_send_swipe_end(
pointer_gestures,
--
2.43.2
2.45.1