Skip to content

Commit e2b5f17

Browse files
committed
gestures: Only allow window actions on ordinary windows and
dialogs. - Check if minimize, maximize or fullscreen can be performed on a window before attempting it (fullscreen and maximized have the same conditions in muffin, except for an uncommon corner-case). - Improve some logging. Fixes linuxmint/mint21.2-beta#25
1 parent 0c57f02 commit e2b5f17

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

js/ui/gestures/actions.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ var WorkspaceSwitchAction = class extends BaseAction {
119119
}
120120
}
121121

122+
const actionable_window_types = [
123+
Meta.WindowType.NORMAL,
124+
Meta.WindowType.DIALOG,
125+
Meta.WindowType.MODAL_DIALOG
126+
]
127+
122128
var WindowOpAction = class extends BaseAction {
123129
constructor(definition, device, threshold) {
124130
super(definition, device, threshold);
@@ -136,23 +142,33 @@ var WindowOpAction = class extends BaseAction {
136142
return
137143
}
138144

145+
if (!actionable_window_types.includes(window.window_type)) {
146+
return;
147+
}
148+
139149
switch (this.definition.action) {
140150
case "MINIMIZE":
141-
window.minimize();
151+
if (window.can_minimize()) {
152+
window.minimize();
153+
}
142154
break
143155
case "MAXIMIZE":
144156
if (window.maximized_horizontally && window.maximized_vertically) {
145157
window.unmaximize(Meta.MaximizeFlags.BOTH);
146158
}
147159
else {
148-
window.maximize(Meta.MaximizeFlags.BOTH);
160+
if (window.can_maximize()) {
161+
window.maximize(Meta.MaximizeFlags.BOTH);
162+
}
149163
}
150164
break
151165
case "CLOSE":
152166
window.delete(global.get_current_time());
153167
break
154168
case "FULLSCREEN":
155-
window.make_fullscreen();
169+
if (window.can_maximize()) {
170+
window.make_fullscreen();
171+
}
156172
break
157173
case "UNFULLSCREEN":
158174
window.unmake_fullscreen();

js/ui/gestures/gesturesManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ var GesturesManager = class {
216216
return;
217217
}
218218

219-
debug_gesture(`Gesture started: (${DeviceTypeString[device]}) ${GestureTypeString[type]}, ${GestureDirectionString[direction]}, fingers: ${fingers}`);
219+
debug_gesture(`Gesture started: (${DeviceTypeString[device]}) ${GestureTypeString[type]}, ${GestureDirectionString[direction]}, fingers: ${fingers} [${definition_match.action}]`);
220220

221221
this.current_gesture = actions.make_action(this.settings, definition_match, device);
222222
this.current_gesture.begin(direction, percentage, elapsed_time);
@@ -249,7 +249,7 @@ var GesturesManager = class {
249249
return;
250250
}
251251

252-
debug_gesture(`${GestureTypeString[type]} end: progress: ${parseInt(percentage)} (threshold: ${this.current_gesture.threshold})`);
252+
debug_gesture(`${GestureTypeString[type]} end: progress: ${parseInt(percentage)} (threshold: ${this.current_gesture.threshold}) [${def.action}]`);
253253

254254
if (percentage < this.current_gesture.threshold) {
255255
debug_gesture(`Gesture threshold not met`);

0 commit comments

Comments
 (0)