Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 3 additions & 7 deletions src/DragGesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -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. //
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
Expand Down