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 758239 - Fetch input event codes from ClutterEvent directly
Fetch input event codes from ClutterEvent directly
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal enhancement
: ---
Assigned To: mutter-maint
mutter-maint
Depends on: 758238
Blocks:
 
 
Reported: 2015-11-17 17:01 UTC by Carlos Garnacho
Modified: 2015-11-25 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Fetch pointer button event codes from the ClutterEvent (1.43 KB, patch)
2015-11-17 17:04 UTC, Carlos Garnacho
none Details | Review
wayland: Fetch keyboard event codes from ClutterEvents (1.72 KB, patch)
2015-11-17 17:04 UTC, Carlos Garnacho
none Details | Review
wayland: Fetch pointer button event codes from the ClutterEvent (3.10 KB, patch)
2015-11-19 14:49 UTC, Carlos Garnacho
committed Details | Review
wayland: Fetch keyboard event codes from ClutterEvents (2.12 KB, patch)
2015-11-19 14:49 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2015-11-17 17:01:09 UTC
In bug #758238 I've attached some patches that let Clutter carry event codes in ClutterEvents, this can help making the places where we figure out the event codes ourselves a lot simpler, also in prevision to tablets/buttonsets being handled.

I'm attaching here the mutter-side patches to make use of that.
Comment 1 Carlos Garnacho 2015-11-17 17:04:19 UTC
Created attachment 315773 [details] [review]
wayland: Fetch pointer button event codes from the ClutterEvent

No more reverse mapping the 1-indexed button to an event code.
Comment 2 Carlos Garnacho 2015-11-17 17:04:23 UTC
Created attachment 315774 [details] [review]
wayland: Fetch keyboard event codes from ClutterEvents

No more figuring out of event->key.hardware_keycode.
Comment 3 Carlos Garnacho 2015-11-19 14:49:08 UTC
Uhm... I can't just remove that code, otherwise I break nested compositors. Attaching new patches.
Comment 4 Carlos Garnacho 2015-11-19 14:49:31 UTC
Created attachment 315890 [details] [review]
wayland: Fetch pointer button event codes from the ClutterEvent

When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.
Comment 5 Carlos Garnacho 2015-11-19 14:49:36 UTC
Created attachment 315891 [details] [review]
wayland: Fetch keyboard event codes from ClutterEvents

When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.
Comment 6 Jonas Ådahl 2015-11-25 14:37:52 UTC
Review of attachment 315891 [details] [review]:

::: src/wayland/meta-wayland-keyboard.c
@@ +457,3 @@
 {
   gboolean is_press = event->type == CLUTTER_KEY_PRESS;
+  MetaBackend *backend = meta_get_backend ();

I suppose we will never ever build this file without HAVE_NATIVE_BACKEND not defined, but this will cause an "unused variable" warning when its not.
Comment 7 Jonas Ådahl 2015-11-25 14:40:37 UTC
Review of attachment 315890 [details] [review]:

::: src/wayland/meta-wayland-pointer.c
@@ +309,3 @@
+            default:
+              button = button + (BTN_LEFT - 1) + 4;
+              break;

Already discussed this but the changes to the switch statement should either be documented in the commit message or split out in a separate commit.
Comment 8 Carlos Garnacho 2015-11-25 17:05:16 UTC
Thanks for the review! Pushed with a HAVE_NATIVE_BACKEND check around that variable declaration, and further explanations in the meta-wayland-pointer.c patch commit log.

Attachment 315890 [details] pushed as 7309b20 - wayland: Fetch pointer button event codes from the ClutterEvent
Attachment 315891 [details] pushed as 3078f70 - wayland: Fetch keyboard event codes from ClutterEvents