Change keyboard handling API to handle nested modal calls

Rename beginModal/endModal to pushModal/popModal.  All of the current callers
just want to ensure that we're in a modal state; they don't actually need to
fail if we already are.

These functions also now take the Clutter keyboard focus, while recording
the previous focus.

https://bugzilla.gnome.org/show_bug.cgi?id=595116
This commit is contained in:
Colin Walters
2009-09-15 15:53:07 -04:00
parent 2ddc7cf00f
commit 8a2bfd0e55
4 changed files with 87 additions and 31 deletions

View File

@ -43,8 +43,7 @@ RunDialog.prototype = {
this._internalCommands = { 'lg':
Lang.bind(this, function() {
// Run in an idle to avoid recursive key grab problems
Mainloop.idle_add(function() { Main.createLookingGlass().open(); });
Main.createLookingGlass().open();
}),
'r': Lang.bind(this, function() {
@ -182,12 +181,10 @@ RunDialog.prototype = {
if (this._isOpen) // Already shown
return;
if (!Main.beginModal())
return;
this._isOpen = true;
this._group.show();
Main.pushModal(this._group);
global.stage.set_key_focus(this._entry);
},
@ -203,7 +200,7 @@ RunDialog.prototype = {
this._group.hide();
this._entry.text = '';
Main.endModal();
Main.popModal(this._group);
}
};
Signals.addSignalMethods(RunDialog.prototype);