[gnome-shell] messageTray: Close the notification on Escape
- From: StÃphane DÃmurget <stef src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] messageTray: Close the notification on Escape
- Date: Thu, 8 Nov 2012 20:27:01 +0000 (UTC)
commit f30dcad8a711069c58f35863ac5c0046ea48d7b6
Author: StÃphane DÃmurget <stephane demurget free fr>
Date: Thu Nov 8 15:38:57 2012 +0100
messageTray: Close the notification on Escape
Now that the notifications can be focused with the keyboard, it's
important we can close the active one also this way.
https://bugzilla.gnome.org/show_bug.cgi?id=652082
js/ui/messageTray.js | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 2f714b0..6a2e430 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1394,6 +1394,8 @@ const MessageTray = new Lang.Class({
y_expand: true,
x_expand: true,
layout_manager: new Clutter.BinLayout() });
+ this._notificationWidget.connect('key-release-event', Lang.bind(this, this._onNotificationKeyRelease));
+
this.actor.add_actor(this._notificationWidget);
this._notificationBin = new St.Bin({ y_expand: true });
@@ -1443,7 +1445,7 @@ const MessageTray = new Lang.Class({
this._closeButton = makeCloseButton();
this._closeButton.hide();
- this._closeButton.connect('clicked', Lang.bind(this, this._onCloseClicked));
+ this._closeButton.connect('clicked', Lang.bind(this, this._closeNotification));
this._notificationWidget.add_actor(this._closeButton);
this._idleMonitorBecameActiveId = 0;
@@ -1598,7 +1600,19 @@ const MessageTray = new Lang.Class({
return false;
},
- _onCloseClicked: function() {
+ _onNotificationKeyRelease: function(actor, event) {
+ let ignoredModifiers = global.display.get_ignored_modifier_mask();
+ let modifierState = event.get_state() & ~ignoredModifiers;
+
+ if (event.get_key_symbol() == Clutter.KEY_Escape && modifierState == 0) {
+ this._closeNotification();
+ return true;
+ }
+
+ return false;
+ },
+
+ _closeNotification: function() {
if (this._notificationState == State.SHOWN) {
this._closeButton.hide();
this._notificationClosed = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]