boxPointer: use shell_util_get_transformed_allocation()
Using ClutterActor.get_transformed_size() can produce bugs if we happen to position the box pointer when the source actor has a relayout queued. Use our newly added reliable utility function instead. https://bugzilla.gnome.org/show_bug.cgi?id=645744
This commit is contained in:
parent
905c4bb4a5
commit
bc48bd5f4a
@ -330,10 +330,9 @@ BoxPointer.prototype = {
|
|||||||
// Position correctly relative to the sourceActor
|
// Position correctly relative to the sourceActor
|
||||||
let sourceNode = sourceActor.get_theme_node();
|
let sourceNode = sourceActor.get_theme_node();
|
||||||
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
|
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
|
||||||
let [sourceX, sourceY] = sourceActor.get_transformed_position();
|
let sourceAllocation = Shell.util_get_transformed_allocation(sourceActor);
|
||||||
let [sourceWidth, sourceHeight] = sourceActor.get_transformed_size();
|
let sourceCenterX = sourceAllocation.x1 + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2;
|
||||||
let sourceCenterX = sourceX + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2;
|
let sourceCenterY = sourceAllocation.y1 + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2;
|
||||||
let sourceCenterY = sourceY + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2;
|
|
||||||
let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size();
|
let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size();
|
||||||
|
|
||||||
// We also want to keep it onscreen, and separated from the
|
// We also want to keep it onscreen, and separated from the
|
||||||
@ -351,16 +350,16 @@ BoxPointer.prototype = {
|
|||||||
|
|
||||||
switch (this._arrowSide) {
|
switch (this._arrowSide) {
|
||||||
case St.Side.TOP:
|
case St.Side.TOP:
|
||||||
resY = sourceY + sourceHeight + gap;
|
resY = sourceAllocation.y2 + gap;
|
||||||
break;
|
break;
|
||||||
case St.Side.BOTTOM:
|
case St.Side.BOTTOM:
|
||||||
resY = sourceY - natHeight - gap;
|
resY = sourceAllocation.y1 - natHeight - gap;
|
||||||
break;
|
break;
|
||||||
case St.Side.LEFT:
|
case St.Side.LEFT:
|
||||||
resX = sourceX + sourceWidth + gap;
|
resX = sourceAllocation.x2 + gap;
|
||||||
break;
|
break;
|
||||||
case St.Side.RIGHT:
|
case St.Side.RIGHT:
|
||||||
resX = sourceX - natWidth - gap;
|
resX = sourceAllocation.x1 - natWidth - gap;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user