appDisplay: use get_allocation_box() in _ensureIconVisible

When right-clicking on an AppWellIcon, the icon will become focused,
which (presumably via style-changed) invalidates its current
allocation, causing "icon.y" to return 0 until it has been
reallocated, messing up our idea of where in the AppDisplay the icon
is. Work around this by calling get_allocation_box() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=645162
This commit is contained in:
Dan Winship 2011-03-18 14:33:45 -04:00
parent b2df3fcd1d
commit d0dd37fe94

View File

@ -86,10 +86,14 @@ AlphabeticalView.prototype = {
if (vfade) if (vfade)
offset = vfade.fade_offset; offset = vfade.fade_offset;
if (icon.y < value + offset) // If this gets called as part of a right-click, the actor
value = Math.max(0, icon.y - offset); // will be needs_allocation, and so "icon.y" would return 0
else if (icon.y + icon.height > value + pageSize - offset) let box = icon.get_allocation_box();
value = Math.min(upper, icon.y + icon.height + offset - pageSize);
if (box.y1 < value + offset)
value = Math.max(0, box.y1 - offset);
else if (box.y2 > value + pageSize - offset)
value = Math.min(upper, box.y2 + offset - pageSize);
else else
return; return;