[gnome-shell] Change event handling so Escape always works
- From: Siegfried-Angel Gevatter Pujals <sgevatter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Change event handling so Escape always works
- Date: Fri, 18 Dec 2009 20:51:46 +0000 (UTC)
commit 44712c274e67f6cfd1ce6d35a300e4ea0c4313b2
Author: Siegfried-Angel Gevatter Pujals <rainct ubuntu com>
Date: Fri Dec 18 21:22:58 2009 +0100
Change event handling so Escape always works
Until now LookingGlass could only be closed using the Escape
key when the Evaluator class was active, as the relevant code
was associated to the text input field; this moves it into a
global event handler instead which works everywhere in LG.
js/ui/lookingGlass.js | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index f66321d..783d3ef 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -556,10 +556,7 @@ LookingGlass.prototype = {
}));
this._entry.clutter_text.connect('key-press-event', Lang.bind(this, function(o, e) {
let symbol = e.get_key_symbol();
- if (symbol == Clutter.Escape) {
- this.close();
- return true;
- } else if (symbol == Clutter.Up) {
+ if (symbol == Clutter.Up) {
if (this._historyNavIndex >= this._history.length - 1)
return true;
this._historyNavIndex++;
@@ -704,6 +701,16 @@ LookingGlass.prototype = {
this._resizeTo(actor);
},
+ // Handle key events which are relevant for all tabs of the LookingGlass
+ _globalKeyPressEvent : function(actor, event) {
+ let symbol = event.get_key_symbol();
+ if (symbol == Clutter.Escape) {
+ this.close();
+ return true;
+ }
+ return false;
+ },
+
open : function() {
if (this._open)
return;
@@ -711,6 +718,9 @@ LookingGlass.prototype = {
if (!Main.pushModal(this.actor))
return;
+ this._keyPressEventId = global.stage.connect('key-press-event',
+ Lang.bind(this, this._globalKeyPressEvent));
+
this.actor.show();
this.actor.lower(Main.chrome.actor);
this._open = true;
@@ -729,6 +739,9 @@ LookingGlass.prototype = {
if (!this._open)
return;
+ if (this._keyPressEventId)
+ global.stage.disconnect(this._keyPressEventId);
+
this._historyNavIndex = -1;
this._open = false;
Tweener.removeTweens(this.actor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]