[gnome-shell] endSessionDialog: fix keyboard navigation



commit 59c3e3a179783b880e96d1bb1deb13cc3ba4a610
Author: Dan Winship <danw gnome org>
Date:   Wed Apr 6 12:54:47 2011 -0400

    endSessionDialog: fix keyboard navigation
    
    The addition of _backgroundStack to ModalDialog broke focus
    navigation, because it was interposed between the focus group root and
    all of the interesting content, but since it isn't an StWidget,
    st_widget_navigate_focus() was unable to navigate through it. Fix this
    by moving the focus root to this._dialogLayout (inside the
    _backgroundStack) instead.
    
    Additionally, in EndSessionDialog specifically, _initialKeyFocus
    wasn't being set until after opening the dialog, so it was ignored.
    
    Also change ModalDialog.close() to clear the _savedKeyFocus that
    popModal() set, so that dialogs that are repeatedly closed and
    reopened will have their focus revert back to _initialKeyFocus each
    time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646740

 js/ui/endSessionDialog.js |    7 ++-----
 js/ui/modalDialog.js      |    9 +++++----
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index a10b86d..47963bc 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -408,10 +408,6 @@ EndSessionDialog.prototype = {
     },
 
     _updateButtons: function() {
-        if (this.state != ModalDialog.State.OPENING &&
-            this.state != ModalDialog.State.OPENED)
-            return;
-
         let dialogContent = DialogContent[this._type];
         let buttons = [{ action: Lang.bind(this, this.cancel),
                          label:  _("Cancel"),
@@ -521,11 +517,12 @@ EndSessionDialog.prototype = {
             this._inhibitors.push(inhibitor);
         }
 
+        this._updateButtons();
+
         if (!this.open(timestamp))
             throw new DBus.DBusError('org.gnome.Shell.ModalDialog.GrabError',
                                      "Cannot grab pointer and keyboard");
 
-        this._updateButtons();
         this._updateContent();
 
         let signalId = this.connect('opened',
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 802f9c9..dfebc47 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -50,10 +50,6 @@ ModalDialog.prototype = {
                                                       coordinate: Clutter.BindCoordinate.POSITION | Clutter.BindCoordinate.SIZE });
         this._group.add_constraint(constraint);
 
-        global.focus_manager.add_group(this._group);
-        this._initialKeyFocus = this._group;
-        this._savedKeyFocus = null;
-
         this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
 
         this._actionKeys = {};
@@ -94,6 +90,10 @@ ModalDialog.prototype = {
                                { expand:  true,
                                  x_align: St.Align.MIDDLE,
                                  y_align: St.Align.END });
+
+        global.focus_manager.add_group(this._dialogLayout);
+        this._initialKeyFocus = this._dialogLayout;
+        this._savedKeyFocus = null;
     },
 
     setButtons: function(buttons) {
@@ -195,6 +195,7 @@ ModalDialog.prototype = {
 
         this.state = State.CLOSING;
         this.popModal(timestamp);
+        this._savedKeyFocus = null;
 
         Tweener.addTween(this._group,
                          { opacity: 0,



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