grabHelper: Use captured-event for escape ungrabs
I have no idea why we used 'event' rather than 'captured-event' before. 'event' has some really strange quirks that came up when porting PopupMenu to the GrabHelper https://bugzilla.gnome.org/show_bug.cgi?id=689109
This commit is contained in:
parent
184ac11c93
commit
41db363b06
@ -43,7 +43,6 @@ const GrabHelper = new Lang.Class({
|
|||||||
|
|
||||||
this._actors = [];
|
this._actors = [];
|
||||||
this._capturedEventId = 0;
|
this._capturedEventId = 0;
|
||||||
this._eventId = 0;
|
|
||||||
this._keyFocusNotifyId = 0;
|
this._keyFocusNotifyId = 0;
|
||||||
this._focusWindowChangedId = 0;
|
this._focusWindowChangedId = 0;
|
||||||
this._ignoreRelease = false;
|
this._ignoreRelease = false;
|
||||||
@ -171,7 +170,6 @@ const GrabHelper = new Lang.Class({
|
|||||||
return false;
|
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._modalCount++;
|
this._modalCount++;
|
||||||
@ -188,11 +186,6 @@ const GrabHelper = new Lang.Class({
|
|||||||
this._capturedEventId = 0;
|
this._capturedEventId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._eventId > 0) {
|
|
||||||
global.stage.disconnect(this._eventId);
|
|
||||||
this._eventId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Main.popModal(this._owner);
|
Main.popModal(this._owner);
|
||||||
global.sync_pointer();
|
global.sync_pointer();
|
||||||
},
|
},
|
||||||
@ -310,6 +303,12 @@ const GrabHelper = new Lang.Class({
|
|||||||
if (!button && this._modalCount == 0)
|
if (!button && this._modalCount == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (type == Clutter.EventType.KEY_PRESS &&
|
||||||
|
event.get_key_symbol() == Clutter.KEY_Escape) {
|
||||||
|
this.ungrab();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this._isWithinGrabbedActor(event.get_source()))
|
if (this._isWithinGrabbedActor(event.get_source()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -327,18 +326,6 @@ const GrabHelper = new Lang.Class({
|
|||||||
return this._modalCount > 0;
|
return this._modalCount > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
// We catch 'event' rather than 'key-press-event' so that we get
|
|
||||||
// a chance to run before the overview's own Escape check
|
|
||||||
_onEvent: function(actor, event) {
|
|
||||||
if (event.type() == Clutter.EventType.KEY_PRESS &&
|
|
||||||
event.get_key_symbol() == Clutter.KEY_Escape) {
|
|
||||||
this.ungrab();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
_onKeyFocusChanged: function() {
|
_onKeyFocusChanged: function() {
|
||||||
let focus = global.stage.key_focus;
|
let focus = global.stage.key_focus;
|
||||||
if (!focus || !this._isWithinGrabbedActor(focus))
|
if (!focus || !this._isWithinGrabbedActor(focus))
|
||||||
|
Loading…
Reference in New Issue
Block a user