[gnome-shell] overview: Don't use a captured-event handler to detect the control key
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] overview: Don't use a captured-event handler to detect the control key
- Date: Thu, 14 Mar 2013 16:06:07 +0000 (UTC)
commit b39e76200a772a68ec7a2293346958653d9f11eb
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Mar 4 17:54:02 2013 -0500
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
js/ui/overview.js | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 7d00251..4fdcd02 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]