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
This commit is contained in:
parent
42e26a8682
commit
59c3e3a179
@ -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',
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user