dnd: Set drag actor position immediately after reparenting

For drag actors which get reparented to the uiGroup, we currently wait
until the next input event to set the fixed position of the actor, until
that they will just be allocated their old fixed position, which is 0,
0.

So avoid drag actors flickering at the top left for one frame and
position them correctly right after reparenting.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1310
This commit is contained in:
Jonas Dreßler 2020-06-09 18:31:23 +02:00
parent 82da73baff
commit 89ba8562c3

View File

@ -428,6 +428,10 @@ var _Draggable = class _Draggable {
this._dragOffsetX -= transX; this._dragOffsetX -= transX;
this._dragOffsetY -= transY; this._dragOffsetY -= transY;
this._dragActor.set_position(
this._dragX + this._dragOffsetX,
this._dragY + this._dragOffsetY);
if (this._dragActorMaxSize != undefined) { if (this._dragActorMaxSize != undefined) {
let [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size(); let [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size();
let currentSize = Math.max(scaledWidth, scaledHeight); let currentSize = Math.max(scaledWidth, scaledHeight);