Skip to content

Commit 403c25d

Browse files
committed
🐛 Fix regressions due to recent changes in GNOME 49
1 parent eb8aa17 commit 403c25d

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

extension.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ export default class DesktopCube extends Extension {
857857
// Then sort the children actors accordingly.
858858
const parent = actors[0].get_parent();
859859
for (let i = 0; i < copy.length; i++) {
860-
parent.set_child_at_index(copy[i], -1);
860+
parent.set_child_at_index(copy[i], i);
861861
}
862862
}
863863

@@ -954,7 +954,7 @@ export default class DesktopCube extends Extension {
954954

955955
// Finally, sort the children actors accordingly.
956956
for (let i = 0; i < copy.length; i++) {
957-
parent.set_child_at_index(copy[i], -1);
957+
parent.set_child_at_index(copy[i], i);
958958
}
959959
}
960960

@@ -1165,9 +1165,17 @@ export default class DesktopCube extends Extension {
11651165
// SwipeTracker's gesture ends, the St.Adjustment's value will be eased to zero.
11661166
_addDragGesture(actor, tracker, mode) {
11671167
const gesture = new DragGesture(actor, mode);
1168-
gesture.connect('begin', tracker._beginGesture.bind(tracker));
1169-
gesture.connect('update', tracker._updateGesture.bind(tracker));
1170-
gesture.connect('end', tracker._endTouchGesture.bind(tracker));
1168+
1169+
if (utils.shellVersionIsAtLeast(49, "beta")) {
1170+
gesture.connect('begin', tracker._beginTouchpadGesture.bind(tracker));
1171+
gesture.connect('update', tracker._updateTouchpadGesture.bind(tracker));
1172+
gesture.connect('end', tracker._endTouchpadGesture.bind(tracker));
1173+
} else {
1174+
gesture.connect('begin', tracker._beginGesture.bind(tracker));
1175+
gesture.connect('update', tracker._updateGesture.bind(tracker));
1176+
gesture.connect('end', tracker._endTouchGesture.bind(tracker));
1177+
}
1178+
11711179
tracker.bind_property('distance', gesture, 'distance',
11721180
GObject.BindingFlags.SYNC_CREATE);
11731181

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"settings-schema": "org.gnome.shell.extensions.desktop-cube",
1212
"shell-version": ["45", "46", "47", "48", "49"],
1313
"url": "https://github.com/Schneegans/Desktop-Cube",
14-
"version": 29
14+
"version": 30
1515
}

src/DragGesture.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {Workspace} from 'resource:///org/gnome/shell/ui/workspace.js';
3030
// able to rotate the cube with the left mouse button, so we add the gesture defined //
3131
// below to these two SwipeTracker instances (this is done by the _addDragGesture() of //
3232
// the extension class). The gesture is loosely based on the gesture defined here: //
33-
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/swipeTracker.js#L213 //
33+
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/swipeTracker.js#L89 //
3434
// It behaves the same in the regard that it reports update events for horizontal //
3535
// movements. However, it stores vertical movements as well and makes this accessible //
3636
// via the "pitch" property. This is then used for vertical rotations of the cube. //
@@ -176,11 +176,7 @@ export var DragGesture =
176176
// When starting a drag in desktop mode, we grab the input so that we can move
177177
// the pointer across windows without loosing the input events.
178178
if (Main.actionMode == Shell.ActionMode.NORMAL) {
179-
const sequence = event.type() == Clutter.EventType.TOUCH_UPDATE ?
180-
event.get_event_sequence() :
181-
null;
182-
183-
if (!this._grab(event.get_device(), sequence)) {
179+
if (!this._grab()) {
184180
return Clutter.EVENT_PROPAGATE;
185181
}
186182
}
@@ -256,7 +252,7 @@ export var DragGesture =
256252
// Makes sure that all events from the pointing device we received last input from is
257253
// passed to the given actor. This is used to ensure that we do not "loose" the touch
258254
// buttons will dragging them around.
259-
_grab(device, sequence) {
255+
_grab() {
260256
this._lastGrab = global.stage.grab(this._actor);
261257
return this._lastGrab != null;
262258
}

0 commit comments

Comments
 (0)