-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: lenemter <[email protected]>
- Loading branch information
1 parent
0e82d63
commit c7d14d6
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* SPDX-FileCopyrightText: 2024 elementary, Inc. (https://elementary.io) | ||
*/ | ||
|
||
public class Gala.SuperScrollAction : Clutter.Action { | ||
public signal bool triggered (uint32 timestamp, double dx, double dy); | ||
|
||
public Meta.Display display { private get; construct; } | ||
|
||
public SuperScrollAction (Meta.Display display) { | ||
Object (display: display); | ||
} | ||
|
||
public override bool handle_event (Clutter.Event event) { | ||
if ( | ||
event.get_type () == SCROLL && | ||
(event.get_state () & display.compositor_modifiers) != 0 | ||
) { | ||
double dx = 0.0, dy = 0.0; | ||
switch (event.get_scroll_direction ()) { | ||
case LEFT: | ||
dx = -1.0; | ||
break; | ||
case RIGHT: | ||
dx = 1.0; | ||
break; | ||
case UP: | ||
dy = 1.0; | ||
break; | ||
case DOWN: | ||
dy = -1.0; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
// TODO: support natural scroll settings | ||
|
||
return triggered (event.get_time (), dx, dy); | ||
} | ||
|
||
return Clutter.EVENT_PROPAGATE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters