[gnome-shell] boxpointer: Don't use the box allocation when calculating the arrow side
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] boxpointer: Don't use the box allocation when calculating the arrow side
- Date: Fri, 21 Dec 2012 17:25:22 +0000 (UTC)
commit d6cace32f579d54b878ff3a9c3dccbbbc03e55ea
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Dec 21 09:17:49 2012 -0500
boxpointer: Don't use the box allocation when calculating the arrow side
Depending on the current state of arrowSide, the box allocation may be
wrong; e.g. if the user requested a TOP, but we flipped to a BOTTOM, the
next request would look to the y2 value of the flipped BOTTOM, which is
wrong.
Instead, use the origin, plus the calculated preferred size of the box.
https://bugzilla.gnome.org/show_bug.cgi?id=690608
js/ui/boxpointer.js | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 5d892aa..8973404 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -548,29 +548,27 @@ const BoxPointer = new Lang.Class({
_calculateArrowSide: function(arrowSide) {
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
- let boxAllocation = Shell.util_get_transformed_allocation(this.actor);
- let boxWidth = boxAllocation.x2 - boxAllocation.x1;
- let boxHeight = boxAllocation.y2 - boxAllocation.y1;
+ let [minWidth, minHeight, boxWidth, boxHeight] = this._container.get_preferred_size();
let monitor = Main.layoutManager.findMonitorForActor(this.actor);
switch (arrowSide) {
case St.Side.TOP:
- if (boxAllocation.y2 > monitor.y + monitor.height &&
+ if (sourceAllocation.y2 + boxHeight > monitor.y + monitor.height &&
boxHeight < sourceAllocation.y1 - monitor.y)
return St.Side.BOTTOM;
break;
case St.Side.BOTTOM:
- if (boxAllocation.y1 < monitor.y &&
+ if (sourceAllocation.y1 - boxHeight < monitor.y &&
boxHeight < monitor.y + monitor.height - sourceAllocation.y2)
return St.Side.TOP;
break;
case St.Side.LEFT:
- if (boxAllocation.x2 > monitor.x + monitor.width &&
+ if (sourceAllocation.y2 + boxWidth > monitor.x + monitor.width &&
boxWidth < sourceAllocation.x1 - monitor.x)
return St.Side.RIGHT;
break;
case St.Side.RIGHT:
- if (boxAllocation.x1 < monitor.x &&
+ if (sourceAllocation.y1 - boxWidth < monitor.x &&
boxWidth < monitor.x + monitor.width - sourceAllocation.x2)
return St.Side.LEFT;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]