From 189702c44d37b9f6bc3e073145943182bbef51ae Mon Sep 17 00:00:00 2001 From: Alexander Rutz Date: Fri, 22 Nov 2024 06:40:10 -0700 Subject: [PATCH 1/2] touch: make use of two new edge_swipe types edge-s1-swipe = 20% edge-swipe = 60% edge-s2-swipe = 20% --- src/core/seat/touch.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/core/seat/touch.cpp b/src/core/seat/touch.cpp index ce6cf8f9b..a8e9b9279 100644 --- a/src/core/seat/touch.cpp +++ b/src/core/seat/touch.cpp @@ -535,14 +535,41 @@ void wf::touch_interface_t::add_default_gestures() auto ack_edge_swipe = [esw_ptr, this] () { - uint32_t possible_edges = find_swipe_edges(finger_state.get_center().origin); + wf::touch::point_t point = finger_state.get_center().origin; + uint32_t possible_edges = find_swipe_edges(point); uint32_t direction = wf_touch_to_wf_dir(esw_ptr->target_direction); - + auto output = wf::get_core().seat->get_active_output(); + auto geometry = output->get_layout_geometry(); + touch_gesture_type_t edgeType = GESTURE_TYPE_NONE; + possible_edges &= direction; + if (possible_edges) { + if ((direction == GESTURE_DIRECTION_LEFT || direction == GESTURE_DIRECTION_RIGHT)) + { + if (point.y <= (geometry.height * 0.2)) + edgeType = GESTURE_TYPE_EDGE_S1_SWIPE; + else if (edgeType == GESTURE_TYPE_NONE && (point.y > (geometry.height * 0.2)) + && (point.y < (geometry.height * 0.8))) + edgeType = GESTURE_TYPE_EDGE_SWIPE; + else if (edgeType == GESTURE_TYPE_NONE && point.y >= (geometry.height * 0.8)) + edgeType = GESTURE_TYPE_EDGE_S2_SWIPE; + } + + if ((direction == GESTURE_DIRECTION_UP || direction == GESTURE_DIRECTION_DOWN)) + { + if (point.x <= (geometry.width * 0.2)) + edgeType = GESTURE_TYPE_EDGE_S1_SWIPE; + else if (edgeType == GESTURE_TYPE_NONE && (point.x > (geometry.width * 0.2)) + && (point.x < (geometry.width * 0.8))) + edgeType = GESTURE_TYPE_EDGE_SWIPE; + else if (edgeType == GESTURE_TYPE_NONE && point.x >= (geometry.width * 0.8)) + edgeType = GESTURE_TYPE_EDGE_S2_SWIPE; + } + wf::touchgesture_t gesture{ - GESTURE_TYPE_EDGE_SWIPE, + edgeType, direction, esw_ptr->cnt_fingers }; From 6bb282716fe15059f6c81c1c9a4b47d120855e8b Mon Sep 17 00:00:00 2001 From: arpio23 Date: Thu, 21 Nov 2024 14:10:00 -0700 Subject: [PATCH 2/2] touch: make edge_swipe section length configurable If set to 0.0, the full length of the edge will be recognized as edge-swipe. If set to 0.1, 10% -> edge-s1-swipe, 80% -> edge-swipe, 10% edge-s2-swipe --- metadata/input.xml | 7 +++++++ src/core/seat/touch.cpp | 27 +++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/metadata/input.xml b/metadata/input.xml index 57aaa885c..7395d7b3f 100644 --- a/metadata/input.xml +++ b/metadata/input.xml @@ -227,6 +227,13 @@ 0.1 5.0 +