@@ -23,10 +23,20 @@ namespace Gala {
2323 public const string TOGGLE_RECORDING_ACTION = " toggle-recording-action" ;
2424 }
2525
26- /**
27- * Function that should return true if the given shortcut should be blocked.
28- */
29- public delegate bool KeybindingFilter (Meta .KeyBinding binding );
26+ [Flags ]
27+ public enum ModalActions {
28+ NONE = 0 ,
29+ SWITCH_WORKSPACE ,
30+ SWITCH_WINDOWS ,
31+ MULTITASKING_VIEW ,
32+ WINDOW_OVERVIEW ,
33+ ZOOM ,
34+ LOCATE_POINTER ,
35+ SCREENSHOT ,
36+ SCREENSHOT_AREA ,
37+ SCREENSHOT_WINDOW ,
38+ MEDIA_KEYS
39+ }
3040
3141 /**
3242 * A minimal class mostly used to identify your call to {@link WindowManager.push_modal} and used
@@ -35,38 +45,16 @@ namespace Gala {
3545 public class ModalProxy : Object {
3646 public Clutter . Grab ? grab { get ; set ; }
3747
38- private GestureAction [] allowed_actions;
39-
40- /**
41- * A function which is called whenever a keybinding is pressed. If you supply a custom
42- * one you can filter out those that'd you like to be passed through and block all others.
43- * Defaults to blocking all.
44- * @see KeybindingFilter
45- */
46- private KeybindingFilter ? _keybinding_filter = () = > true ;
47- public unowned KeybindingFilter ? get_keybinding_filter () {
48- return _keybinding_filter;
49- }
50-
51- public void set_keybinding_filter (KeybindingFilter ? filter ) {
52- _keybinding_filter = filter;
53- }
48+ private ModalActions allowed_actions;
5449
5550 public ModalProxy () {
5651 }
5752
58- /**
59- * Small utility to allow all keybindings
60- */
61- public void allow_all_keybindings () {
62- _keybinding_filter = null ;
63- }
64-
65- public void allow_actions (GestureAction [] actions ) {
53+ public void allow_actions (ModalActions actions ) {
6654 allowed_actions = actions;
6755 }
6856
69- public bool filter_action (GestureAction action ) {
57+ public bool filter_action (ModalActions action ) {
7058 return ! (action in allowed_actions);
7159 }
7260 }
@@ -172,6 +160,6 @@ namespace Gala {
172160 * Checks whether the action should currently be prohibited.
173161 * @return true if the action should be prohibited, false otherwise
174162 */
175- public abstract bool filter_action (GestureAction action );
163+ public abstract bool filter_action (ModalActions action );
176164 }
177165}
0 commit comments