After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687425 - 'Enter' should activate legacy status icons
'Enter' should activate legacy status icons
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: message-tray
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 687077 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-02 11:16 UTC by Guillaume Desmottes
Modified: 2013-01-18 19:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
MessageTray: pass keyboard events to tray icons (5.38 KB, patch)
2012-11-02 15:24 UTC, Giovanni Campagna
reviewed Details | Review
MessageTray: pass keyboard events to tray icons (4.45 KB, patch)
2013-01-08 22:13 UTC, Giovanni Campagna
reviewed Details | Review
MessageTray: pass keyboard events to tray icons (5.34 KB, patch)
2013-01-09 19:39 UTC, Giovanni Campagna
committed Details | Review

Description Guillaume Desmottes 2012-11-02 11:16:15 UTC
- Hit Ctrl+M to open the message tray
- Select an IM chat and hit 'Enter'
- The notification is activated and you can chat, all good

- Start Tomboy
- Hit Ctrl+M to open the message tray
- Select the tomboy status icon and hit 'Enter'
- Nothing happens

We should stay coherent and activate the status icon like if I'd have clicked on it.
Comment 1 Giovanni Campagna 2012-11-02 15:24:54 UTC
Created attachment 227903 [details] [review]
MessageTray: pass keyboard events to tray icons

Synthetize XKeyEvents for clicks emulated by StButton using Return or
Space.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-11-02 15:28:28 UTC
Review of attachment 227903 [details] [review]:

::: js/ui/keyboard.js
@@ +587,3 @@
 
+    handleSummaryClick: function(button) {
+        if (button != St.ButtonMask.ONE)

This seems unrelated. Why do we care about the keyboard status icon here?

::: js/ui/notificationDaemon.js
@@ +576,3 @@
         // clicks are always forwarded, as the right click menu is not useful for
         // tray icons
+        if (button == St.Button.ONE &&

St.Button.ONE doesn't exist.

::: src/shell-tray-icon.c
@@ -189,3 @@
   Window xwindow, xrootwindow;
 
-  g_return_if_fail (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE);

I'd prefer an || here that describes the events allowed.

@@ +242,3 @@
+      xkevent.time = xcevent.time;
+      xkevent.x = xcevent.x;
+      xkevent.y = xcevent.y;

A lot of these properties are the same. Split them out into a shared section, please.
Comment 3 Giovanni Campagna 2012-11-02 15:34:26 UTC
(In reply to comment #2)
> Review of attachment 227903 [details] [review]:
> 
> ::: js/ui/keyboard.js
> @@ +587,3 @@
> 
> +    handleSummaryClick: function(button) {
> +        if (button != St.ButtonMask.ONE)
> 
> This seems unrelated. Why do we care about the keyboard status icon here?

Because I changed the API of handleSummaryClick (and because keyboard navigation makes sense there too)
 
> @@ +242,3 @@
> +      xkevent.time = xcevent.time;
> +      xkevent.x = xcevent.x;
> +      xkevent.y = xcevent.y;
> 
> A lot of these properties are the same. Split them out into a shared section,
> please.

They're not the same, unless you consider reasonable to assume that XKeyEvent and XButtonEvent share more than the common XEvent structure (which is true in practice)
Comment 4 Giovanni Campagna 2012-11-02 15:41:48 UTC
*** Bug 687077 has been marked as a duplicate of this bug. ***
Comment 5 Giovanni Campagna 2013-01-08 22:13:08 UTC
Created attachment 233021 [details] [review]
MessageTray: pass keyboard events to tray icons

Synthetize XKeyEvents for clicks emulated by StButton using Return or
Space.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-01-08 22:45:31 UTC
Review of attachment 233021 [details] [review]:

::: js/ui/keyboard.js
@@ +639,3 @@
 
+    handleSummaryClick: function(button) {
+        if (button != St.ButtonMask.ONE)

Make this into a separate commit -- this is changing behaviour unrelated to this bug.

@@ -640,3 @@
-    handleSummaryClick: function() {
-        let event = Clutter.get_current_event();
-        if (event.type() != Clutter.EventType.BUTTON_RELEASE)

Are we intentionally dropping checking for release here?

::: js/ui/notificationDaemon.js
@@ +576,3 @@
         // clicks are always forwarded, as the right click menu is not useful for
         // tray icons
+        if (button == St.ButtonMask.ONE &&

St.ButtonMask is wrong. button == 1 is correct.

::: src/shell-tray-icon.c
@@ +236,3 @@
+  else
+    {
+      XKeyEvent *xkevent = (XKeyEvent*) &xbevent;

Yeah, I missed that these were different before, so even though the code is long-winded, I like it more.
Comment 7 Giovanni Campagna 2013-01-09 19:21:01 UTC
(In reply to comment #6)
> Review of attachment 233021 [details] [review]:
> 
> ::: js/ui/keyboard.js
> @@ +639,3 @@
> 
> +    handleSummaryClick: function(button) {
> +        if (button != St.ButtonMask.ONE)
> 
> Make this into a separate commit -- this is changing behaviour unrelated to
> this bug.

Indeed it is changing behavior. I should not do this.

> @@ -640,3 @@
> -    handleSummaryClick: function() {
> -        let event = Clutter.get_current_event();
> -        if (event.type() != Clutter.EventType.BUTTON_RELEASE)
> 
> Are we intentionally dropping checking for release here?

Yes, because sometimes the current event will be a key release.
It is fine, however, because StButton only emits clicked on release.
Comment 8 Giovanni Campagna 2013-01-09 19:39:09 UTC
Created attachment 233100 [details] [review]
MessageTray: pass keyboard events to tray icons

Synthetize XKeyEvents for clicks emulated by StButton using Return or
Space.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-01-18 18:35:55 UTC
Review of attachment 233100 [details] [review]:

ACN after one fix, otherwise looks good.

::: src/shell-tray-icon.c
@@ -189,3 @@
   Window xwindow, xrootwindow;
 
-  g_return_if_fail (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE);

I'd prefer to modify this so it's:

    ClutterEventType event_type = clutter_event_type (event);

    g_return_if_fail (event_type == CLUTTER_BUTTON_RELEASE ||
                      event_type == CLUTTER_KEY_RELEASE);
Comment 10 Giovanni Campagna 2013-01-18 19:53:59 UTC
Attachment 233100 [details] pushed as 59ecd61 - MessageTray: pass keyboard events to tray icons