windowManager: Drop AppSwitchAction
This gesture to switch the focused app was already a bit of a compromise solution at the time it was added, its clunky way to work (3fg long press, then taps with a 4th finger to switch application) was pretty much picking up the remains of our limited wiggle room (sticking to 3fg/4fg global gestures, since 2fg are application domain). But then directional 3fg gestures took prevalence, and made it easier to switch between applications. This small gesture remained a bit of an easter egg, largely unused and unknown. Fast forward to today, and it's being noticed in a bad way. The changes to event handling and delivery to actions has made this gesture take prevalence over the wee-bit-more-popular 3fg swipe gestures, making those never become active and never trigger. While a gesture framework is being investigated that might help handle these situations (or, in a less undefined manner), this doesn't seem like a case worth going out of our way to hack around until that is in place. We can remove this, and make all WM interactions go through the 3fg directional gestures. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2729 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2910>
This commit is contained in:
parent
f2b7b84c03
commit
7501f3cd11
@ -38,7 +38,6 @@ const SCROLL_TIMEOUT_TIME = 150;
|
|||||||
const DIM_BRIGHTNESS = -0.3;
|
const DIM_BRIGHTNESS = -0.3;
|
||||||
const DIM_TIME = 500;
|
const DIM_TIME = 500;
|
||||||
const UNDIM_TIME = 250;
|
const UNDIM_TIME = 250;
|
||||||
const APP_MOTION_THRESHOLD = 30;
|
|
||||||
|
|
||||||
const ONE_SECOND = 1000; // in ms
|
const ONE_SECOND = 1000; // in ms
|
||||||
|
|
||||||
@ -475,63 +474,6 @@ class TilePreview extends St.Widget {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const AppSwitchAction = GObject.registerClass({
|
|
||||||
Signals: {'activated': {}},
|
|
||||||
}, class AppSwitchAction extends Clutter.GestureAction {
|
|
||||||
_init() {
|
|
||||||
super._init();
|
|
||||||
this.set_n_touch_points(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
vfunc_gesture_prepare(_actor) {
|
|
||||||
if (Main.actionMode !== Shell.ActionMode.NORMAL) {
|
|
||||||
this.cancel();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.get_n_current_points() <= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
vfunc_gesture_begin(_actor) {
|
|
||||||
// in milliseconds
|
|
||||||
const LONG_PRESS_TIMEOUT = 250;
|
|
||||||
|
|
||||||
let nPoints = this.get_n_current_points();
|
|
||||||
let event = this.get_last_event(nPoints - 1);
|
|
||||||
|
|
||||||
if (nPoints === 3) {
|
|
||||||
this._longPressStartTime = event.get_time();
|
|
||||||
} else if (nPoints === 4) {
|
|
||||||
// Check whether the 4th finger press happens after a 3-finger long press,
|
|
||||||
// this only needs to be checked on the first 4th finger press
|
|
||||||
if (this._longPressStartTime != null &&
|
|
||||||
event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) {
|
|
||||||
this.cancel();
|
|
||||||
} else {
|
|
||||||
this._longPressStartTime = null;
|
|
||||||
this.emit('activated');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.get_n_current_points() <= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
vfunc_gesture_progress(_actor) {
|
|
||||||
if (this.get_n_current_points() === 3) {
|
|
||||||
for (let i = 0; i < this.get_n_current_points(); i++) {
|
|
||||||
let [startX, startY] = this.get_press_coords(i);
|
|
||||||
let [x, y] = this.get_motion_coords(i);
|
|
||||||
|
|
||||||
if (Math.abs(x - startX) > APP_MOTION_THRESHOLD ||
|
|
||||||
Math.abs(y - startY) > APP_MOTION_THRESHOLD)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const ResizePopup = GObject.registerClass(
|
const ResizePopup = GObject.registerClass(
|
||||||
class ResizePopup extends St.Widget {
|
class ResizePopup extends St.Widget {
|
||||||
_init() {
|
_init() {
|
||||||
@ -947,10 +889,6 @@ export class WindowManager {
|
|||||||
if (Main.sessionMode.hasWorkspaces)
|
if (Main.sessionMode.hasWorkspaces)
|
||||||
this._workspaceTracker = new WorkspaceTracker(this);
|
this._workspaceTracker = new WorkspaceTracker(this);
|
||||||
|
|
||||||
let appSwitchAction = new AppSwitchAction();
|
|
||||||
appSwitchAction.connect('activated', this._switchApp.bind(this));
|
|
||||||
global.stage.add_action_full('app-switch', Clutter.EventPhase.CAPTURE, appSwitchAction);
|
|
||||||
|
|
||||||
let mode = Shell.ActionMode.NORMAL;
|
let mode = Shell.ActionMode.NORMAL;
|
||||||
let topDragAction = new EdgeDragAction.EdgeDragAction(St.Side.TOP, mode);
|
let topDragAction = new EdgeDragAction.EdgeDragAction(St.Side.TOP, mode);
|
||||||
topDragAction.connect('activated', () => {
|
topDragAction.connect('activated', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user