From e6fd2bed4d70de561569c8580308f77b321bf8bd Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 26 Sep 2012 12:42:56 -0300 Subject: [PATCH] dnd: Add drag actors to the stage before querying their sizes Drag actors may be St widgets, which require that they're added to the stage before they have a size. https://bugzilla.gnome.org/show_bug.cgi?id=684888 --- js/ui/dnd.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 76a86afc1..b99eb45cb 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -235,6 +235,10 @@ const _Draggable = new Lang.Class({ if (this.actor._delegate && this.actor._delegate.getDragActor) { this._dragActor = this.actor._delegate.getDragActor(this._dragStartX, this._dragStartY); + this._dragActor.reparent(Main.uiGroup); + this._dragActor.raise_top(); + 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 // can be an image that's part of the actor. So to perform "snap back" correctly we need // to know what was the drag actor source. @@ -263,6 +267,10 @@ const _Draggable = new Lang.Class({ this._dragOffsetY = this._dragActor.y - this._dragStartY; } else { this._dragActor = this.actor; + this._dragActor.reparent(Main.uiGroup); + this._dragActor.raise_top(); + Shell.util_set_hidden_from_pick(this._dragActor, true); + this._dragActorSource = undefined; this._dragOrigParent = this.actor.get_parent(); this._dragOrigX = this._dragActor.x; @@ -280,10 +288,6 @@ const _Draggable = new Lang.Class({ scaledHeight / this.actor.height); } - this._dragActor.reparent(Main.uiGroup); - this._dragActor.raise_top(); - Shell.util_set_hidden_from_pick(this._dragActor, true); - this._dragOrigOpacity = this._dragActor.opacity; if (this._dragActorOpacity != undefined) this._dragActor.opacity = this._dragActorOpacity;