Better handle pushModal failing

Previously we'd leave the focus on the stack, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=595382
This commit is contained in:
Colin Walters 2009-09-16 11:37:51 -04:00 committed by Owen W. Taylor
parent 2c0661d377
commit cee7106cb1
4 changed files with 20 additions and 11 deletions

View File

@ -542,13 +542,15 @@ LookingGlass.prototype = {
if (this._open)
return;
if (!Main.pushModal(this.actor))
return;
this.actor.show();
this.actor.lower(Main.chrome.actor);
this._open = true;
Tweener.removeTweens(this.actor);
Main.pushModal(this.actor);
global.stage.set_key_focus(this._entry);
Tweener.addTween(this.actor, { time: 0.5,

View File

@ -205,10 +205,21 @@ function _findModal(actor) {
* Next, record the current Clutter keyboard focus on a stack. If the modal stack
* returns to this actor, reset the focus to the actor which was focused
* at the time pushModal() was invoked.
*
* Returns: true iff we successfully acquired a grab or already had one
*/
function pushModal(actor) {
let timestamp = global.screen.get_display().get_current_time();
if (modalCount == 0) {
if (!global.begin_modal(timestamp)) {
log("pushModal: invocation of begin_modal failed");
return false;
}
}
global.set_stage_input_mode(Shell.StageInputMode.FULLSCREEN);
modalCount += 1;
actor.connect('destroy', function() {
let index = _findModal(actor);
@ -225,14 +236,7 @@ function pushModal(actor) {
}
modalActorFocusStack.push([actor, curFocus]);
if (modalCount > 1)
return;
if (!global.begin_modal(timestamp)) {
log("pushModal: invocation of begin_modal failed");
return;
}
global.set_stage_input_mode(Shell.StageInputMode.FULLSCREEN);
return true;
}
/**

View File

@ -277,7 +277,8 @@ Overview.prototype = {
show : function() {
if (this.visible)
return;
Main.pushModal(this._dash.actor);
if (!Main.pushModal(this._dash.actor))
return;
this.visible = true;
this.animationInProgress = true;

View File

@ -186,10 +186,12 @@ RunDialog.prototype = {
if (this._isOpen) // Already shown
return;
if (!Main.pushModal(this._group))
return;
this._isOpen = true;
this._group.show();
Main.pushModal(this._group);
global.stage.set_key_focus(this._entry);
},