js: Use global.focus_manager, rather than grabbing it ourselves

This commit is contained in:
Jasper St. Pierre 2012-08-15 12:22:01 -04:00
parent cb5095370e
commit 0711a70398
3 changed files with 6 additions and 11 deletions

View File

@ -27,7 +27,6 @@ const CtrlAltTabManager = new Lang.Class({
_init: function() { _init: function() {
this._items = []; this._items = [];
this._focusManager = St.FocusManager.get_for_stage(global.stage);
}, },
addGroup: function(root, name, icon, params) { addGroup: function(root, name, icon, params) {
@ -41,11 +40,11 @@ const CtrlAltTabManager = new Lang.Class({
this._items.push(item); this._items.push(item);
root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); })); root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); }));
this._focusManager.add_group(root); global.focus_manager.add_group(root);
}, },
removeGroup: function(root) { removeGroup: function(root) {
this._focusManager.remove_group(root); global.focus_manager.remove_group(root);
for (let i = 0; i < this._items.length; i++) { for (let i = 0; i < this._items.length; i++) {
if (this._items[i].root == root) { if (this._items[i].root == root) {
this._items.splice(i, 1); this._items.splice(i, 1);

View File

@ -314,8 +314,6 @@ const Notification = new Lang.Class({
this._table.connect('style-changed', Lang.bind(this, this._styleChanged)); this._table.connect('style-changed', Lang.bind(this, this._styleChanged));
this.actor.set_child(this._table); this.actor.set_child(this._table);
this._buttonFocusManager = St.FocusManager.get_for_stage(global.stage);
// The first line should have the title, followed by the // The first line should have the title, followed by the
// banner text, but ellipsized if they won't both fit. We can't // banner text, but ellipsized if they won't both fit. We can't
// make St.Table or St.BoxLayout do this the way we want (don't // make St.Table or St.BoxLayout do this the way we want (don't
@ -638,10 +636,10 @@ const Notification = new Lang.Class({
} }
if (this._buttonBox.get_n_children() > 0) if (this._buttonBox.get_n_children() > 0)
this._buttonFocusManager.remove_group(this._buttonBox); global.focus_manager.remove_group(this._buttonBox);
this._buttonBox.add(button); this._buttonBox.add(button);
this._buttonFocusManager.add_group(this._buttonBox); global.focus_manager.add_group(this._buttonBox);
button.connect('clicked', Lang.bind(this, this._onActionInvoked, id)); button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
this.updated(); this.updated();
@ -1211,8 +1209,7 @@ const SummaryItem = new Lang.Class({
this.rightClickMenu.add(item.actor); this.rightClickMenu.add(item.actor);
} }
let focusManager = St.FocusManager.get_for_stage(global.stage); global.focus_manager.add_group(this.rightClickMenu);
focusManager.add_group(this.rightClickMenu);
}, },
prepareNotificationStackForShowing: function() { prepareNotificationStackForShowing: function() {

View File

@ -182,8 +182,7 @@ const Button = new Lang.Class({
_onMenuKeyPress: function(actor, event) { _onMenuKeyPress: function(actor, event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
let focusManager = St.FocusManager.get_for_stage(global.stage); let group = global.focus_manager.get_group(this.actor);
let group = focusManager.get_group(this.actor);
if (group) { if (group) {
let direction = (symbol == Clutter.KEY_Left) ? Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT; let direction = (symbol == Clutter.KEY_Left) ? Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT;
group.navigate_focus(this.actor, direction, false); group.navigate_focus(this.actor, direction, false);