runDialog: popModal before running the command

If you run a command from Alt+F2 that tries to get a server grab (eg,
xmag), it will fail if it starts up before the run dialog is finished
hiding.

Additionally, the run dialog currently stays focused while it is
fading out, potentially stealing keystrokes (or causing the user to
accidentally launch two copies of a program).

Change ModalDialog.close() to call popModal() immediately

Add a ModalDialog.popModal method, and call that before running the
RunDialog command. If the command succeeds, close the dialog as
before. If it fails, call ModalDialog.pushModal() to put things back
to normal before displaying the error.

https://bugzilla.gnome.org/show_bug.cgi?id=644857
This commit is contained in:
Dan Winship
2011-03-18 11:28:18 -04:00
parent 1e366aa56e
commit a40daa3c22
2 changed files with 55 additions and 16 deletions

View File

@ -240,15 +240,20 @@ __proto__: ModalDialog.ModalDialog.prototype,
this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) {
let symbol = e.get_key_symbol();
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
this.popModal();
if (Shell.get_event_state(e) & Clutter.ModifierType.CONTROL_MASK)
this._run(o.get_text(), true);
else
this._run(o.get_text(), false);
if (!this._commandError)
this.close(global.get_current_time());
this.close();
else {
if (!this.pushModal())
this.close();
}
}
if (symbol == Clutter.Escape) {
this.close(global.get_current_time());
this.close();
return true;
}
if (symbol == Clutter.slash) {