modalDialog: grab focus immediately, not after fade-in
If the user types Alt+F2 and then immediately starts typing, some keys can get lost. Fix that by grabbing focus sooner. https://bugzilla.gnome.org/show_bug.cgi?id=644857
This commit is contained in:
parent
d0dd37fe94
commit
bad8dbc2d2
@ -148,19 +148,23 @@ ModalDialog.prototype = {
|
|||||||
this._lightbox.show();
|
this._lightbox.show();
|
||||||
this._group.opacity = 0;
|
this._group.opacity = 0;
|
||||||
this._group.show();
|
this._group.show();
|
||||||
|
this._initialKeyFocus.grab_key_focus();
|
||||||
Tweener.addTween(this._group,
|
Tweener.addTween(this._group,
|
||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
time: OPEN_AND_CLOSE_TIME,
|
time: OPEN_AND_CLOSE_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: Lang.bind(this,
|
onComplete: Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
this._initialKeyFocus.grab_key_focus();
|
|
||||||
this.state = State.OPENED;
|
this.state = State.OPENED;
|
||||||
this.emit('opened');
|
this.emit('opened');
|
||||||
}),
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setInitialKeyFocus: function(actor) {
|
||||||
|
this._initialKeyFocus = actor;
|
||||||
|
},
|
||||||
|
|
||||||
open: function(timestamp) {
|
open: function(timestamp) {
|
||||||
if (this.state == State.OPENED || this.state == State.OPENING)
|
if (this.state == State.OPENED || this.state == State.OPENING)
|
||||||
return true;
|
return true;
|
||||||
@ -168,8 +172,6 @@ ModalDialog.prototype = {
|
|||||||
if (!Main.pushModal(this._group, timestamp))
|
if (!Main.pushModal(this._group, timestamp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
global.stage.set_key_focus(this._group);
|
|
||||||
|
|
||||||
this._fadeOpen();
|
this._fadeOpen();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -210,10 +210,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
|
|||||||
|
|
||||||
this._entryText = entry.clutter_text;
|
this._entryText = entry.clutter_text;
|
||||||
this.contentLayout.add(entry, { y_align: St.Align.START });
|
this.contentLayout.add(entry, { y_align: St.Align.START });
|
||||||
this.connect('opened',
|
this.setInitialKeyFocus(this._entryText);
|
||||||
Lang.bind(this, function() {
|
|
||||||
this._entryText.grab_key_focus();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._errorBox = new St.BoxLayout({ style_class: 'run-dialog-error-box' });
|
this._errorBox = new St.BoxLayout({ style_class: 'run-dialog-error-box' });
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user