diff --git a/extension.js b/extension.js index b8e726e..d55e89a 100644 --- a/extension.js +++ b/extension.js @@ -857,7 +857,7 @@ export default class DesktopCube extends Extension { // Then sort the children actors accordingly. const parent = actors[0].get_parent(); for (let i = 0; i < copy.length; i++) { - parent.set_child_at_index(copy[i], -1); + parent.set_child_at_index(copy[i], i); } } @@ -954,7 +954,7 @@ export default class DesktopCube extends Extension { // Finally, sort the children actors accordingly. for (let i = 0; i < copy.length; i++) { - parent.set_child_at_index(copy[i], -1); + parent.set_child_at_index(copy[i], i); } } @@ -1165,9 +1165,17 @@ export default class DesktopCube extends Extension { // SwipeTracker's gesture ends, the St.Adjustment's value will be eased to zero. _addDragGesture(actor, tracker, mode) { const gesture = new DragGesture(actor, mode); - gesture.connect('begin', tracker._beginGesture.bind(tracker)); - gesture.connect('update', tracker._updateGesture.bind(tracker)); - gesture.connect('end', tracker._endTouchGesture.bind(tracker)); + + if (utils.shellVersionIsAtLeast(49, 'beta')) { + gesture.connect('begin', tracker._beginTouchpadGesture.bind(tracker)); + gesture.connect('update', tracker._updateTouchpadGesture.bind(tracker)); + gesture.connect('end', tracker._endTouchpadGesture.bind(tracker)); + } else { + gesture.connect('begin', tracker._beginGesture.bind(tracker)); + gesture.connect('update', tracker._updateGesture.bind(tracker)); + gesture.connect('end', tracker._endTouchGesture.bind(tracker)); + } + tracker.bind_property('distance', gesture, 'distance', GObject.BindingFlags.SYNC_CREATE); diff --git a/metadata.json b/metadata.json index 0db30cd..57f7b2c 100644 --- a/metadata.json +++ b/metadata.json @@ -11,5 +11,5 @@ "settings-schema": "org.gnome.shell.extensions.desktop-cube", "shell-version": ["45", "46", "47", "48", "49"], "url": "https://github.com/Schneegans/Desktop-Cube", - "version": 29 + "version": 30 } diff --git a/src/DragGesture.js b/src/DragGesture.js index 5dc4a0a..461e7fa 100644 --- a/src/DragGesture.js +++ b/src/DragGesture.js @@ -30,7 +30,7 @@ import {Workspace} from 'resource:///org/gnome/shell/ui/workspace.js'; // able to rotate the cube with the left mouse button, so we add the gesture defined // // below to these two SwipeTracker instances (this is done by the _addDragGesture() of // // the extension class). The gesture is loosely based on the gesture defined here: // -// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/swipeTracker.js#L213 // +// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/swipeTracker.js#L89 // // It behaves the same in the regard that it reports update events for horizontal // // movements. However, it stores vertical movements as well and makes this accessible // // via the "pitch" property. This is then used for vertical rotations of the cube. // @@ -176,11 +176,7 @@ export var DragGesture = // When starting a drag in desktop mode, we grab the input so that we can move // the pointer across windows without loosing the input events. if (Main.actionMode == Shell.ActionMode.NORMAL) { - const sequence = event.type() == Clutter.EventType.TOUCH_UPDATE ? - event.get_event_sequence() : - null; - - if (!this._grab(event.get_device(), sequence)) { + if (!this._grab()) { return Clutter.EVENT_PROPAGATE; } } @@ -256,7 +252,7 @@ export var DragGesture = // Makes sure that all events from the pointing device we received last input from is // passed to the given actor. This is used to ensure that we do not "loose" the touch // buttons will dragging them around. - _grab(device, sequence) { + _grab() { this._lastGrab = global.stage.grab(this._actor); return this._lastGrab != null; }