Skip to content

Commit 5949cce

Browse files
committed
Make triggered bool and have everything add their own
1 parent 1c7456f commit 5949cce

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

src/SuperScrollAction.vala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
public class Gala.SuperScrollAction : Clutter.Action {
7-
public signal void triggered (uint32 timestamp, double dx, double dy);
7+
public signal bool triggered (uint32 timestamp, double dx, double dy);
88

99
public Meta.Display display { private get; construct; }
1010

@@ -37,9 +37,7 @@ public class Gala.SuperScrollAction : Clutter.Action {
3737

3838
// TODO: support natural scroll settings
3939

40-
triggered (event.get_time (), dx, dy);
41-
42-
return Clutter.EVENT_STOP;
40+
return triggered (event.get_time (), dx, dy);
4341
}
4442

4543
return Clutter.EVENT_PROPAGATE;

src/WindowManager.vala

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,6 @@ namespace Gala {
159159
#endif
160160
}
161161

162-
private void handle_super_scroll (uint32 timestamp, double dx, double dy) {
163-
if (behavior_settings.get_enum ("super-scroll-action") != 1) {
164-
super_scroll_triggered (timestamp, dx, dy);
165-
return;
166-
}
167-
168-
var d = dx.abs () > dy.abs () ? dx : dy;
169-
170-
if (d > 0) {
171-
switch_to_next_workspace (Meta.MotionDirection.RIGHT, timestamp);
172-
} else if (d < 0) {
173-
switch_to_next_workspace (Meta.MotionDirection.LEFT, timestamp);
174-
}
175-
}
176-
177162
#if WITH_SYSTEMD
178163
private async void start_x11_services (GLib.Task task) {
179164
try {
@@ -413,7 +398,7 @@ namespace Gala {
413398

414399
var scroll_action = new SuperScrollAction (display);
415400
scroll_action.triggered.connect (handle_super_scroll);
416-
stage.add_action_full ("super-scroll-action", CAPTURE, scroll_action);
401+
stage.add_action_full ("wm-super-scroll-action", CAPTURE, scroll_action);
417402

418403
stage.show ();
419404

@@ -473,6 +458,22 @@ namespace Gala {
473458
screen_shield.expand_to_screen_size ();
474459
}
475460

461+
private bool handle_super_scroll (uint32 timestamp, double dx, double dy) {
462+
if (behavior_settings.get_enum ("super-scroll-action") != 1) {
463+
return Clutter.EVENT_PROPAGATE;
464+
}
465+
466+
var d = dx.abs () > dy.abs () ? dx : dy;
467+
468+
if (d > 0) {
469+
switch_to_next_workspace (Meta.MotionDirection.RIGHT, timestamp);
470+
} else if (d < 0) {
471+
switch_to_next_workspace (Meta.MotionDirection.LEFT, timestamp);
472+
}
473+
474+
return Clutter.EVENT_STOP;
475+
}
476+
476477
[CCode (instance_pos = -1)]
477478
private void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
478479
Meta.KeyBinding binding) {

src/Zoom.vala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public class Gala.Zoom : Object {
3535
gesture_tracker.on_gesture_detected.connect (on_gesture_detected);
3636

3737
behavior_settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");
38-
wm.super_scroll_triggered.connect (handle_super_scroll);
38+
39+
var scroll_action = new SuperScrollAction (display);
40+
scroll_action.triggered.connect (handle_super_scroll);
41+
display.get_stage ().add_action_full ("zoom-super-scroll-action", CAPTURE, scroll_action);
3942
}
4043

4144
~Zoom () {
@@ -79,9 +82,9 @@ public class Gala.Zoom : Object {
7982
}
8083
}
8184

82-
private void handle_super_scroll (uint32 timestamp, double dx, double dy) {
85+
private bool handle_super_scroll (uint32 timestamp, double dx, double dy) {
8386
if (behavior_settings.get_enum ("super-scroll-action") != 2) {
84-
return;
87+
return Clutter.EVENT_PROPAGATE;
8588
}
8689

8790
var d = dx.abs () > dy.abs () ? dx : dy;
@@ -91,6 +94,8 @@ public class Gala.Zoom : Object {
9194
} else if (d < 0) {
9295
zoom (-SHORTCUT_DELTA, true, AnimationsSettings.get_enable_animations ());
9396
}
97+
98+
return Clutter.EVENT_STOP;
9499
}
95100

96101
private void zoom_with_gesture (GestureDirection direction) {

0 commit comments

Comments
 (0)