From 1e203f46312060fa44717c86ca1f43161b2d8bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 5 Nov 2019 20:17:19 +0100 Subject: [PATCH] cleanup: Replace deprecated lower/raise calls Those methods have been deprecated for a long time, so move to the drop-in replacement. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/808 --- js/ui/background.js | 2 +- js/ui/boxpointer.js | 2 +- js/ui/dnd.js | 4 ++-- js/ui/ibusCandidatePopup.js | 2 +- js/ui/layout.js | 2 +- js/ui/lightbox.js | 6 +++--- js/ui/magnifier.js | 2 +- js/ui/modalDialog.js | 4 ++-- js/ui/overview.js | 6 ++++-- js/ui/popupMenu.js | 2 +- js/ui/screenShield.js | 2 +- js/ui/windowManager.js | 4 ++-- js/ui/workspace.js | 15 +++++++++------ js/ui/workspaceThumbnail.js | 14 ++++++++------ js/ui/xdndHandler.js | 2 +- tests/interactive/scroll-view-sizing.js | 2 +- 16 files changed, 39 insertions(+), 32 deletions(-) diff --git a/js/ui/background.js b/js/ui/background.js index 44476418f..f99ad381c 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -767,7 +767,7 @@ var BackgroundManager = class BackgroundManager { if (this._controlPosition) { let monitor = this._layoutManager.monitors[this._monitorIndex]; backgroundActor.set_position(monitor.x, monitor.y); - backgroundActor.lower_bottom(); + this._container.set_child_below_sibling(backgroundActor, null); } let changeSignalId = background.connect('bg-changed', () => { diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index d55543a70..319702403 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -44,7 +44,7 @@ var BoxPointer = GObject.registerClass({ this._border = new St.DrawingArea(); this._border.connect('repaint', this._drawBorder.bind(this)); this.add_actor(this._border); - this.bin.raise(this._border); + this.set_child_above_sibling(this.bin, this._border); this._sourceAlignment = 0.5; this._muteInput = true; diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 7d3929d6e..6fff86b25 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -338,7 +338,7 @@ var _Draggable = class _Draggable { if (this.actor._delegate && this.actor._delegate.getDragActor) { this._dragActor = this.actor._delegate.getDragActor(); Main.uiGroup.add_child(this._dragActor); - this._dragActor.raise_top(); + Main.uiGroup.set_child_above_sibling(this._dragActor, null); Shell.util_set_hidden_from_pick(this._dragActor, true); // Drag actor does not always have to be the same as actor. For example drag actor @@ -388,7 +388,7 @@ var _Draggable = class _Draggable { this._dragOrigParent.remove_actor(this._dragActor); Main.uiGroup.add_child(this._dragActor); - this._dragActor.raise_top(); + Main.uiGroup.set_child_above_sibling(this._dragActor, null); Shell.util_set_hidden_from_pick(this._dragActor, true); } diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index aadd43087..cdd547d2a 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -308,7 +308,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer { if (isVisible) { this.setPosition(this._dummyCursor, 0); this.open(BoxPointer.PopupAnimation.NONE); - this.raise_top(); + this.get_parent().set_child_above_sibling(this, null); } else { this.close(BoxPointer.PopupAnimation.NONE); } diff --git a/js/ui/layout.js b/js/ui/layout.js index ed552b367..6729f87c4 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -269,7 +269,7 @@ var LayoutManager = GObject.registerClass({ this._backgroundGroup = new Meta.BackgroundGroup(); global.window_group.add_child(this._backgroundGroup); - this._backgroundGroup.lower_bottom(); + global.window_group.set_child_below_sibling(this._backgroundGroup, null); this._bgManagers = []; this._interfaceSettings = new Gio.Settings({ diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index 35e40016f..47659de7c 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -139,7 +139,7 @@ var Lightbox = GObject.registerClass({ this.set({ opacity: 0, style_class: 'lightbox' }); container.add_actor(this); - this.raise_top(); + container.set_child_above_sibling(this, null); this.connect('destroy', this._onDestroy.bind(this)); @@ -264,9 +264,9 @@ var Lightbox = GObject.registerClass({ let below = this; for (let i = this._children.length - 1; i >= 0; i--) { if (this._children[i] == window) - this._children[i].raise_top(); + this._container.set_child_above_sibling(this._children[i], null); else if (this._children[i] == this._highlighted) - this._children[i].lower(below); + this._container.set_child_below_sibling(this._children[i], below); else below = this._children[i]; } diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 191784c20..6893e1fe9 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -1651,7 +1651,7 @@ class Crosshairs extends Clutter.Actor { } container.add_actor(crosshairsActor); - container.raise_child(magnifiedMouse, crosshairsActor); + container.set_child_above_sibling(magnifiedMouse, crosshairsActor); let [xMouse, yMouse] = magnifiedMouse.get_position(); let [crosshairsWidth, crosshairsHeight] = crosshairsActor.get_size(); crosshairsActor.set_position(xMouse - crosshairsWidth / 2, yMouse - crosshairsHeight / 2); diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index f35774407..d7633acd8 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -206,7 +206,7 @@ var ModalDialog = GObject.registerClass({ this._hasModal = false; if (!this._shellReactive) - this._eventBlocker.raise_top(); + this.backgroundStack.set_child_above_sibling(this._eventBlocker, null); } pushModal(timestamp) { @@ -229,7 +229,7 @@ var ModalDialog = GObject.registerClass({ } if (!this._shellReactive) - this._eventBlocker.lower_bottom(); + this.backgroundStack.set_child_below_sibling(this._eventBlocker, null); return true; } diff --git a/js/ui/overview.js b/js/ui/overview.js index e09f523be..bb4ab092c 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -581,7 +581,8 @@ var Overview = class { }); this._shadeBackgrounds(); - this._coverPane.raise_top(); + Main.layoutManager.overviewGroup.set_child_above_sibling( + this._coverPane, null); this._coverPane.show(); this.emit('showing'); } @@ -644,7 +645,8 @@ var Overview = class { }); this._unshadeBackgrounds(); - this._coverPane.raise_top(); + Main.layoutManager.overviewGroup.set_child_above_sibling( + this._coverPane, null); this._coverPane.show(); this.emit('hiding'); } diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 74c228f56..c168e00dc 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -892,7 +892,7 @@ var PopupMenu = class extends PopupMenuBase { this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment); this._boxPointer.open(animate); - this.actor.raise_top(); + this.actor.get_parent().set_child_above_sibling(this.actor, null); this.emit('open-state-changed', true); } diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 71f8795ac..b64096244 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -464,7 +464,7 @@ var ScreenShield = class { this._backgroundGroup = new Clutter.Actor(); this._lockScreenGroup.add_actor(this._backgroundGroup); - this._backgroundGroup.lower_bottom(); + this._lockScreenGroup.set_child_below_sibling(this._backgroundGroup, null); this._bgManagers = []; this._updateBackgrounds(); diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index c184db181..5b3387741 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1874,13 +1874,13 @@ var WindowManager = class { actor: new Clutter.Actor() }; switchData.surroundings[dir] = info; switchData.container.add_actor(info.actor); - info.actor.raise_top(); + switchData.container.set_child_above_sibling(info.actor, null); let [x, y] = this._getPositionForDirection(dir, curWs, ws); info.actor.set_position(x, y); } - switchData.movingWindowBin.raise_top(); + wgroup.set_child_above_sibling(switchData.movingWindowBin, null); for (let i = 0; i < windows.length; i++) { let actor = windows[i]; diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 48329e18e..15d9be503 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -328,11 +328,12 @@ var WindowClone = GObject.registerClass({ // We'll fix up the stack after the drag return; + let parent = this.get_parent(); let actualAbove = this.getActualStackAbove(); if (actualAbove == null) - this.lower_bottom(); + parent.set_child_below_sibling(this, null); else - this.raise(actualAbove); + parent.set_child_above_sibling(this, actualAbove); } _disconnectSignals() { @@ -462,11 +463,12 @@ var WindowClone = GObject.registerClass({ // We may not have a parent if DnD completed successfully, in // which case our clone will shortly be destroyed and replaced // with a new one on the target workspace. - if (this.get_parent() != null) { + let parent = this.get_parent(); + if (parent !== null) { if (this._stackAbove == null) - this.lower_bottom(); + parent.set_child_below_sibling(this, null); else - this.raise(this._stackAbove); + parent.set_child_above_sibling(this, this._stackAbove); } @@ -671,7 +673,8 @@ var WindowOverlay = class { } _animateVisible() { - this._parentActor.raise_top(); + this._parentActor.get_parent().set_child_above_sibling( + this._parentActor, null); let toAnimate = [this.border, this.title]; if (this._windowCanClose()) diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index d7cd6396c..7604d503c 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -124,11 +124,12 @@ var WindowClone = GObject.registerClass({ if (actor.inDrag) return; + let parent = this.get_parent(); let actualAbove = this.getActualStackAbove(); if (actualAbove == null) - this.lower_bottom(); + parent.set_child_below_sibling(this, null); else - this.raise(actualAbove); + parent.set_child_above_sibling(this, actualAbove); } addAttachedDialog(win) { @@ -214,11 +215,12 @@ var WindowClone = GObject.registerClass({ // We may not have a parent if DnD completed successfully, in // which case our clone will shortly be destroyed and replaced // with a new one on the target workspace. - if (this.get_parent() != null) { + let parent = this.get_parent(); + if (parent !== null) { if (this._stackAbove == null) - this.lower_bottom(); + parent.set_child_below_sibling(this, null); else - this.raise(this._stackAbove); + parent.set_child_above_sibling(this, this._stackAbove); } @@ -1014,7 +1016,7 @@ var ThumbnailsBox = GObject.registerClass({ this._queueUpdateStates(); // The thumbnails indicator actually needs to be on top of the thumbnails - this._indicator.raise_top(); + this.set_child_above_sibling(this._indicator, null); // Clear the splice index, we got the message this._spliceIndex = -1; diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js index d56385428..df5314d4e 100644 --- a/js/ui/xdndHandler.js +++ b/js/ui/xdndHandler.js @@ -80,7 +80,7 @@ var XdndHandler = class { // Make sure that the cursor window is on top if (this._cursorWindowClone) - this._cursorWindowClone.raise_top(); + Main.uiGroup.set_child_above_sibling(this._cursorWindowClone, null); let dragEvent = { x: x, diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js index b5eb17949..dc1613d0c 100644 --- a/tests/interactive/scroll-view-sizing.js +++ b/tests/interactive/scroll-view-sizing.js @@ -154,7 +154,7 @@ class SizingIllustrator extends St.Widget { add(child) { this.child = child; this.add_child(child); - this.child.lower_bottom(); + this.set_child_below_sibling(child, null); } vfunc_get_preferred_width(forHeight) {