dotfiles/pkgs/rofi-wayland/0003-exit-on-long-tap.patch

46 lines
1.5 KiB
Diff

From 8b417bc6304c30bafb56113b868ecac2ffc0ed08 Mon Sep 17 00:00:00 2001
From: chayleaf <chayleaf-git@pavluk.org>
Date: Sat, 24 Aug 2024 13:29:32 +0700
Subject: [PATCH 3/3] exit on long tap
---
source/wayland/display.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/source/wayland/display.c b/source/wayland/display.c
index 5154589a..cfd883b3 100644
--- a/source/wayland/display.c
+++ b/source/wayland/display.c
@@ -551,10 +551,8 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
if (id >= MAX_TOUCHPOINTS) {
return;
}
- gboolean is_move =
- time - self->touches[id].start_time > 500
- || self->touches[id].start_time != self->touches[id].move_time;
- if (is_move) {
+ gboolean has_moved = self->touches[id].start_time != self->touches[id].move_time;
+ if (has_moved) {
return;
}
RofiViewState *state = rofi_view_get_active();
@@ -562,10 +560,12 @@ static void wayland_touch_up(void *data, struct wl_touch *wl_touch,
if (state == NULL) {
return;
}
- //rofi_view_handle_mouse_motion(state, self->touches[id].x, self->touches[id].start_y,
- // FALSE);
+ int key = KEY_ENTER;
+ if (time - self->touches[id].start_time > 200) {
+ key = KEY_ESC;
+ }
nk_bindings_seat_handle_key(wayland->bindings_seat, NULL,
- KEY_ENTER + 8,
+ key + 8,
NK_BINDINGS_KEY_STATE_PRESS);
rofi_view_maybe_update(state);
}
--
2.45.2