overview: Don't use a captured-event handler to detect the control key

captured-event handlers are easily messed up by an earlier event
handler capturing the event. Instead, use the current Clutter event
and check for the state of that.

https://bugzilla.gnome.org/show_bug.cgi?id=695161

https://bugzilla.gnome.org/show_bug.cgi?id=695801
This commit is contained in:
Jasper St. Pierre 2013-03-04 17:54:02 -05:00
parent 01deb9ef7d
commit b39e76200a

View File

@ -95,9 +95,7 @@ const Overview = new Lang.Class({
_init: function() {
this._overviewCreated = false;
this._initCalled = false;
this._controlPressed = false;
global.stage.connect('captured-event', Lang.bind(this, this._capturedEvent));
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
this._sessionUpdated();
},
@ -241,20 +239,6 @@ const Overview = new Lang.Class({
}
},
_capturedEvent: function(actor, event) {
let type = event.type();
if (type != Clutter.EventType.KEY_PRESS &&
type != Clutter.EventType.KEY_RELEASE)
return false;
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Control_L ||
symbol == Clutter.KEY_Control_R)
this._controlPressed = type == Clutter.EventType.KEY_PRESS;
return false;
},
_sessionUpdated: function() {
this.isDummy = !Main.sessionMode.hasOverview;
this._createOverview();
@ -587,7 +571,8 @@ const Overview = new Lang.Class({
if (!this._shown)
return;
if (this._controlPressed)
let event = Clutter.get_current_event();
if (event && (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0)
return;
this._animateNotVisible();