grabHelper: Fix regression for dwelling with mouse down

b203a95a78 introduced a regression
where we forgot to bail out if the pushModal didn't succeed properly.

https://bugzilla.gnome.org/show_bug.cgi?id=684344
This commit is contained in:
Jasper St. Pierre 2012-09-18 23:04:57 -03:00
parent 449d116af2
commit 2acb097662

View File

@ -148,31 +148,32 @@ const GrabHelper = new Lang.Class({
return true; return true;
params.savedFocus = focus; params.savedFocus = focus;
this._grabStack.push(params);
if (params.modal) if (params.modal && !this._takeModalGrab())
this._takeModalGrab(); return false;
if (params.grabFocus) if (params.grabFocus && !this._takeFocusGrab(hadFocus))
this._takeFocusGrab(hadFocus); return false;
if (hadFocus || params.grabFocus) if (hadFocus || params.grabFocus)
_navigateActor(newFocus); _navigateActor(newFocus);
this._grabStack.push(params);
return true; return true;
}, },
_takeModalGrab: function() { _takeModalGrab: function() {
let firstGrab = (this._modalCount == 0); let firstGrab = (this._modalCount == 0);
this._modalCount++; if (firstGrab) {
if (!firstGrab)
return;
if (!Main.pushModal(this._owner)) if (!Main.pushModal(this._owner))
return; return false;
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
this._eventId = global.stage.connect('event', Lang.bind(this, this._onEvent)); this._eventId = global.stage.connect('event', Lang.bind(this, this._onEvent));
}
this._modalCount++;
return true;
}, },
_releaseModalGrab: function() { _releaseModalGrab: function() {
@ -196,10 +197,7 @@ const GrabHelper = new Lang.Class({
_takeFocusGrab: function(hadFocus) { _takeFocusGrab: function(hadFocus) {
let firstGrab = (this._grabFocusCount == 0); let firstGrab = (this._grabFocusCount == 0);
this._grabFocusCount++; if (firstGrab) {
if (!firstGrab)
return;
let metaDisplay = global.screen.get_display(); let metaDisplay = global.screen.get_display();
this._grabbedFromKeynav = hadFocus; this._grabbedFromKeynav = hadFocus;
@ -213,6 +211,10 @@ const GrabHelper = new Lang.Class({
this._keyFocusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged)); this._keyFocusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
this._focusWindowChangedId = metaDisplay.connect('notify::focus-window', Lang.bind(this, this._focusWindowChanged)); this._focusWindowChangedId = metaDisplay.connect('notify::focus-window', Lang.bind(this, this._focusWindowChanged));
}
this._grabFocusCount++;
return true;
}, },
_releaseFocusGrab: function() { _releaseFocusGrab: function() {