[gnome-shell] appDisplay: Ensure the currently focused icon is viewable



commit d0f69a72dc25af0b4230df6dd766e8ecc4a366f3
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Mar 20 14:54:04 2014 +0100

    appDisplay: Ensure the currently focused icon is viewable
    
    We either scroll or paginate to the correct place when an icon gets
    key focus.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726759

 js/ui/appDisplay.js |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 2d8fc38..90fac87 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -99,6 +99,9 @@ const BaseAppView = new Lang.Class({
         else
             this._grid = new IconGrid.IconGrid(gridParams);
 
+        this._grid.connect('key-focus-in', Lang.bind(this, function(grid, actor) {
+            this._keyFocusIn(actor);
+        }));
         // Standard hack for ClutterBinLayout
         this._grid.actor.x_expand = true;
 
@@ -106,6 +109,10 @@ const BaseAppView = new Lang.Class({
         this._allItems = [];
     },
 
+    _keyFocusIn: function(actor) {
+        // Nothing by default
+    },
+
     removeAll: function() {
         this._grid.destroyAll();
         this._items = {};
@@ -558,7 +565,7 @@ const AllView = new Lang.Class({
             }));
     },
 
-    _ensureIconVisible: function(icon) {
+    _keyFocusIn: function(icon) {
         let itemPage = this._grid.getItemPage(icon);
         this.goToPage(itemPage);
     },
@@ -929,6 +936,10 @@ const FolderView = new Lang.Class({
         this.actor.add_action(action);
     },
 
+    _keyFocusIn: function(actor) {
+        Util.ensureActorVisibleInScrollView(this.actor, actor);
+    },
+
     createFolderIcon: function(size) {
         let layout = new Clutter.TableLayout();
         let icon = new St.Widget({ layout_manager: layout,


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