diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index 82dbbaf6a..c8e5ceda7 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -473,11 +473,15 @@ var BoxPointer = GObject.registerClass({ _reposition() { let sourceActor = this._sourceActor; let alignment = this._arrowAlignment; + let monitorIndex = Main.layoutManager.findIndexForActor(sourceActor); + + this._sourceAllocation = Shell.util_get_transformed_allocation(sourceActor); + this._workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex); // Position correctly relative to the sourceActor let sourceNode = sourceActor.get_theme_node(); let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box()); - let sourceAllocation = Shell.util_get_transformed_allocation(sourceActor); + let sourceAllocation = this._sourceAllocation; let sourceCenterX = sourceAllocation.x1 + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) * this._sourceAlignment; let sourceCenterY = sourceAllocation.y1 + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) * this._sourceAlignment; let [minWidth, minHeight, natWidth, natHeight] = this.get_preferred_size(); @@ -485,8 +489,7 @@ var BoxPointer = GObject.registerClass({ // We also want to keep it onscreen, and separated from the // edge by the same distance as the main part of the box is // separated from its sourceActor - let monitorIndex = Main.layoutManager.findIndexForActor(sourceActor); - let workarea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex); + let workarea = this._workArea; let themeNode = this.get_theme_node(); let borderWidth = themeNode.get_length('-arrow-border-width'); let arrowBase = themeNode.get_length('-arrow-base'); @@ -606,10 +609,9 @@ var BoxPointer = GObject.registerClass({ } _calculateArrowSide(arrowSide) { - let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor); + let sourceAllocation = this._sourceAllocation; let [minWidth, minHeight, boxWidth, boxHeight] = this.get_preferred_size(); - let monitorIndex = Main.layoutManager.findIndexForActor(this._sourceActor); - let workarea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex); + let workarea = this._workArea; switch (arrowSide) { case St.Side.TOP: