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)
offset = vfade.fade_offset;
if (icon.y < value + offset)
value = Math.max(0, icon.y - offset);
else if (icon.y + icon.height > value + pageSize - offset)
value = Math.min(upper, icon.y + icon.height + offset - pageSize);
// If this gets called as part of a right-click, the actor
// will be needs_allocation, and so "icon.y" would return 0
let box = icon.get_allocation_box();
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
return;