Skip to content

Commit 3e49bc3

Browse files
committed
Introduce custom gestures
These are gestures that aren't relevant globally but instead local. The backend decides whether its gestures are custom or not. It then has full responsibility to filter the correct gestures.
1 parent 79c9ff1 commit 3e49bc3

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

lib/Gestures/Gesture.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ namespace Gala {
4747
private class Gesture {
4848
public const float INVALID_COORD = float.MAX;
4949

50+
/**
51+
* A hint that this gesture isn't a globally configured gesture but instead a local custom one.
52+
* Examples for this are a scroll gesture on the workspaces or a scroll gesture to close windows.
53+
*/
54+
public bool custom = false;
5055
public Clutter.EventType type;
5156
public GestureDirection direction;
5257
public int fingers;

lib/Gestures/GestureController.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public class Gala.GestureController : Object {
158158

159159
var recognized_action = GestureSettings.get_action (gesture, out _action_info);
160160
recognizing = !wm.filter_action (recognized_action) && recognized_action == action ||
161-
backend == scroll_backend && recognized_action == NONE;
161+
recognized_action == CUSTOM;
162162

163163
if (recognizing) {
164164
if (gesture.direction == UP || gesture.direction == RIGHT || gesture.direction == OUT) {

lib/Gestures/GestureSettings.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ private class Gala.GestureSettings : Object {
5757

5858
public static GestureAction get_action (Gesture gesture, out Variant? action_info = null) {
5959
action_info = null;
60+
61+
if (gesture.custom) {
62+
return CUSTOM;
63+
}
64+
6065
var fingers = gesture.fingers;
6166

6267
switch (gesture.type) {

lib/Gestures/ScrollBackend.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ private class Gala.ScrollBackend : Object, GestureBackend {
156156
}
157157

158158
return new Gesture () {
159+
custom = true,
159160
type = Clutter.EventType.SCROLL,
160161
direction = direction,
161162
fingers = 2,

0 commit comments

Comments
 (0)