[gnome-shell] appDisplay: use get_allocation_box() in _ensureIconVisible



commit d0dd37fe947fd43151f2f06a7794688689ed706c
Author: Dan Winship <danw gnome org>
Date:   Fri Mar 18 14:33:45 2011 -0400

    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

 js/ui/appDisplay.js |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 5017446..bfe5ff7 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]