[gnome-shell/gbsneto/40-stuff: 43/68] viewSelector: Remove pinch gestures
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/40-stuff: 43/68] viewSelector: Remove pinch gestures
- Date: Wed, 20 Jan 2021 22:41:08 +0000 (UTC)
commit 8cf811cb1ac4fe224045e64f7028ed2363fd2099
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 5 10:38:33 2021 -0300
viewSelector: Remove pinch gestures
It'll be replaced by a 4 finger gesture that sticks to fingers
and progressively transitions between states.
Remove both pinch and touchpad pinch gestures from ViewSelector.
js/ui/viewSelector.js | 97 +--------------------------------------------------
1 file changed, 1 insertion(+), 96 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index d77bdf9737..b1ddf6ad92 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -1,8 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported ViewSelector */
-const { Clutter, GObject, Meta, Shell, St } = imports.gi;
-const Signals = imports.signals;
+const { Clutter, GObject, Shell, St } = imports.gi;
const AppDisplay = imports.ui.appDisplay;
const Main = imports.ui.main;
@@ -12,8 +11,6 @@ const Search = imports.ui.search;
const ShellEntry = imports.ui.shellEntry;
const WorkspacesView = imports.ui.workspacesView;
-var PINCH_GESTURE_THRESHOLD = 0.7;
-
var ViewPage = {
APPS: 1,
SEARCH: 2,
@@ -38,86 +35,6 @@ function getTermsForSearchString(searchString) {
return terms;
}
-var TouchpadShowOverviewAction = class {
- constructor(actor) {
- actor.connect('captured-event::touchpad', this._handleEvent.bind(this));
- }
-
- _handleEvent(actor, event) {
- if (event.type() != Clutter.EventType.TOUCHPAD_PINCH)
- return Clutter.EVENT_PROPAGATE;
-
- if (event.get_touchpad_gesture_finger_count() != 3)
- return Clutter.EVENT_PROPAGATE;
-
- if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END)
- this.emit('activated', event.get_gesture_pinch_scale());
-
- return Clutter.EVENT_STOP;
- }
-};
-Signals.addSignalMethods(TouchpadShowOverviewAction.prototype);
-
-var ShowOverviewAction = GObject.registerClass({
- Signals: { 'activated': { param_types: [GObject.TYPE_DOUBLE] } },
-}, class ShowOverviewAction extends Clutter.GestureAction {
- _init() {
- super._init();
- this.set_n_touch_points(3);
-
- global.display.connect('grab-op-begin', () => {
- this.cancel();
- });
- }
-
- vfunc_gesture_prepare(_actor) {
- return Main.actionMode == Shell.ActionMode.NORMAL &&
- this.get_n_current_points() == this.get_n_touch_points();
- }
-
- _getBoundingRect(motion) {
- let minX, minY, maxX, maxY;
-
- for (let i = 0; i < this.get_n_current_points(); i++) {
- let x, y;
-
- if (motion == true)
- [x, y] = this.get_motion_coords(i);
- else
- [x, y] = this.get_press_coords(i);
-
- if (i == 0) {
- minX = maxX = x;
- minY = maxY = y;
- } else {
- minX = Math.min(minX, x);
- minY = Math.min(minY, y);
- maxX = Math.max(maxX, x);
- maxY = Math.max(maxY, y);
- }
- }
-
- return new Meta.Rectangle({ x: minX,
- y: minY,
- width: maxX - minX,
- height: maxY - minY });
- }
-
- vfunc_gesture_begin(_actor) {
- this._initialRect = this._getBoundingRect(false);
- return true;
- }
-
- vfunc_gesture_end(_actor) {
- let rect = this._getBoundingRect(true);
- let oldArea = this._initialRect.width * this._initialRect.height;
- let newArea = rect.width * rect.height;
- let areaDiff = newArea / oldArea;
-
- this.emit('activated', areaDiff);
- }
-});
-
var AppsPageContainer = GObject.registerClass(
class AppsPageContainer extends St.Widget {
_init(workspacesDisplay, appDisplay, overviewAdjustment) {
@@ -279,18 +196,6 @@ var ViewSelector = GObject.registerClass({
this._stageKeyPressId = 0;
}
});
-
- let gesture = new ShowOverviewAction();
- gesture.connect('activated', this._pinchGestureActivated.bind(this));
- global.stage.add_action(gesture);
-
- gesture = new TouchpadShowOverviewAction(global.stage);
- gesture.connect('activated', this._pinchGestureActivated.bind(this));
- }
-
- _pinchGestureActivated(action, scale) {
- if (scale < PINCH_GESTURE_THRESHOLD)
- Main.overview.show();
}
prepareToEnterOverview() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]