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

@ -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;
}
/**