-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathWindowManager.vala
More file actions
183 lines (159 loc) · 6.65 KB
/
Copy pathWindowManager.vala
File metadata and controls
183 lines (159 loc) · 6.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
//
// Copyright (C) 2014 Tom Beckmann
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
namespace Gala {
namespace ActionKeys {
public const string INTERACTIVE_SCREENSHOT_ACTION = "interactive-screenshot-action";
public const string OVERLAY_ACTION = "overlay-action";
public const string PANEL_MAIN_MENU_ACTION = "panel-main-menu-action";
public const string TOGGLE_RECORDING_ACTION = "toggle-recording-action";
}
[Flags]
public enum ModalActions {
NONE = 0,
SWITCH_WORKSPACE,
SWITCH_WINDOWS,
MULTITASKING_VIEW,
WINDOW_OVERVIEW,
ZOOM,
LOCATE_POINTER,
SCREENSHOT,
SCREENSHOT_AREA,
SCREENSHOT_WINDOW,
MEDIA_KEYS
}
public enum WindowGroup {
DESKTOP_SHELL,
LOCK_SCREEN_APPLICATION,
LOCK_SCREEN,
LOCK_SCREEN_SHELL,
MODAL,
OVERLAY,
}
/**
* A minimal class mostly used to identify your call to {@link WindowManager.push_modal} and used
* to end your modal mode again with {@link WindowManager.pop_modal}
*/
public class ModalProxy : Object {
public Clutter.Grab? grab { get; set; }
private ModalActions allowed_actions;
private WindowGroup[] allowed_window_groups;
public ModalProxy () {
}
public void allow_actions (ModalActions actions) {
allowed_actions = actions;
}
public bool filter_action (ModalActions action) {
return !(action in allowed_actions);
}
public void allow_window_groups (WindowGroup[] window_groups) requires (grab == null) {
allowed_window_groups = window_groups;
}
public bool is_window_group_allowed (WindowGroup window_group) {
return window_group in allowed_window_groups;
}
}
public interface WindowManager : Meta.Plugin {
/**
* This is the container you'll most likely want to add your component to. It wraps
* every other container listed in this interface and is a direct child of the stage.
*/
public abstract Clutter.Actor ui_group { get; protected set; }
/**
* The stage of the window manager
*/
public abstract Clutter.Stage stage { get; protected set; }
/**
* A group containing all 'usual' windows
* @see top_window_group
*/
public abstract Clutter.Actor window_group { get; protected set; }
/**
* The top window group contains special windows that are always placed on top
* like fullscreen windows.
*/
public abstract Clutter.Actor top_window_group { get; protected set; }
/**
* The background group is a container for the background actors forming the wallpaper
*/
public abstract Meta.BackgroundGroup background_group { get; protected set; }
/**
* Enters the modal mode, which will block keybindings and gestures. See {@link ModalProxy} for
* how to allow certain gestures and keybindings.
* If {@link grab} is true all events will be redirected to the given {@link Clutter.Actor}.
* If {@link grab} is false other actors and shell windows may still receive events.
* Normal windows will never receive keyboard focus though they will still receive pointer events
* if {@link grab} is false and their {@link Meta.WindowActor} is visible.
*
* @param actor The actor to grab events for
* @param grab Whether to grab all events onto the actor
*
* @return a {@link ModalProxy} which is needed to end the modal mode again and provides some
* some basic control on the behavior of the window manager while it is in modal mode.
*/
public abstract ModalProxy push_modal (Clutter.Actor actor, bool grab);
/**
* May exit the modal mode again, unless another component has called {@link push_modal}
*
* @param proxy The {@link ModalProxy} received from {@link push_modal}
*/
public abstract void pop_modal (ModalProxy proxy);
/**
* Returns whether the window manager is currently in modal mode.
* @see push_modal
*/
public abstract bool is_modal ();
/**
* Tests if a given {@link ModalProxy} is valid and may be popped. Should not be necessary
* to use this function in most cases, but it may be helpful for debugging. Gala catches
* invalid proxies as well and emits a warning in that case.
*
* @param proxy The {@link ModalProxy} to check
* @return Returns true if the prox is valid
*/
public abstract bool modal_proxy_valid (ModalProxy proxy);
/**
* Tells the window manager to perform the given action.
*
* @param type The type of action to perform
*/
public abstract void perform_action (ActionType type);
/**
* Moves the window to the given workspace.
*
* @param window The window to be moved
* @param workspace The workspace the window should be moved to
*/
public abstract void move_window (Meta.Window? window, Meta.Workspace workspace, uint32 timestamp);
/**
* Switches to the next workspace in the given direction.
*
* @param direction The direction in which to switch
*/
public abstract void switch_to_next_workspace (Meta.MotionDirection direction, uint32 timestamp);
/**
* Gets action command from gsettings and executes it.
*
* @param action_key The gsettings key of action. Available keys are stored in ActionKeys
*/
public abstract void launch_action (string action_key);
/**
* Checks whether the action should currently be prohibited.
* @return true if the action should be prohibited, false otherwise
*/
public abstract bool filter_action (ModalActions action);
}
}