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 758238 - [evdev] Add evdev-specific API to get event codes from ClutterEvents
[evdev] Add evdev-specific API to get event codes from ClutterEvents
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
1.20.x
Other Linux
: Normal enhancement
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks: 758239
 
 
Reported: 2015-11-17 16:56 UTC by Carlos Garnacho
Modified: 2015-11-18 12:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
device-manager: Add private interface to manipulate platform event data (3.27 KB, patch)
2015-11-17 16:58 UTC, Carlos Garnacho
none Details | Review
backend: Bridge platform-dependent event data creation to device managers (2.36 KB, patch)
2015-11-17 16:58 UTC, Carlos Garnacho
none Details | Review
evdev: Implement the ClutterDeviceManagerPlatform interface (2.53 KB, patch)
2015-11-17 16:58 UTC, Carlos Garnacho
accepted-commit_now Details | Review
evdev: Allow to retrieve the input.h event code from ClutterEvents (6.76 KB, patch)
2015-11-17 16:58 UTC, Carlos Garnacho
committed Details | Review
evdev: Set event code on button/key events (1.37 KB, patch)
2015-11-17 16:58 UTC, Carlos Garnacho
committed Details | Review
device-manager: Add private interface to manipulate platform event data (3.07 KB, patch)
2015-11-17 18:51 UTC, Carlos Garnacho
committed Details | Review
backend: Bridge platform-dependent event data creation to device managers (2.40 KB, patch)
2015-11-17 18:51 UTC, Carlos Garnacho
committed Details | Review
evdev: Implement the ClutterEventExtender interface (2.49 KB, patch)
2015-11-17 18:51 UTC, Carlos Garnacho
committed Details | Review
x11: Implement ClutterEventExtender (4.33 KB, patch)
2015-11-17 18:51 UTC, Carlos Garnacho
committed Details | Review
gdk: Implement ClutterEventExtender (4.07 KB, patch)
2015-11-17 18:51 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2015-11-17 16:56:47 UTC
The places in mutter where we transform from ClutterEvent info to linux/input.h event codes is somewhat finicky atm :(, and will previsibly get worse when we add tablet/buttonset support, as the BTN_ keycode ranges to be expected vary more wildly there. 

It would be great to pass event codes along in input events. I'm attaching some patches to do that.
Comment 1 Carlos Garnacho 2015-11-17 16:58:12 UTC
Created attachment 315768 [details] [review]
device-manager: Add private interface to manipulate platform event data

This normally belonged to the ClutterBackend, however there's device
managers (eg. evdev) that are somewhat detached from the backend, so
need to bridge this somehow.

This allows device managers to implement these bits that were usually
responsibility of the ClutterBackend.
Comment 2 Carlos Garnacho 2015-11-17 16:58:17 UTC
Created attachment 315769 [details] [review]
backend: Bridge platform-dependent event data creation to device managers

Device managers can now implement the ClutterDeviceManagerPlatform interface
that allows them to set their own data to events, make the backend call
those implementations on the backends that don't provide their own.
Comment 3 Carlos Garnacho 2015-11-17 16:58:21 UTC
Created attachment 315770 [details] [review]
evdev: Implement the ClutterDeviceManagerPlatform interface

This will allow the ClutterDeviceManagerEvdev to define evdev-specific
event data.
Comment 4 Carlos Garnacho 2015-11-17 16:58:25 UTC
Created attachment 315771 [details] [review]
evdev: Allow to retrieve the input.h event code from ClutterEvents

This is now stored as platform data in the ClutterEvent, so can
be retrieved with the clutter_evdev_event_get_event_code() call
that's been added to the evdev backend.
Comment 5 Carlos Garnacho 2015-11-17 16:58:29 UTC
Created attachment 315772 [details] [review]
evdev: Set event code on button/key events

This will allow users to know the event code without strange calculations
on event->key.hardware_keycode or event->button.button.
Comment 6 Emmanuele Bassi (:ebassi) 2015-11-17 17:09:09 UTC
Review of attachment 315769 [details] [review]:

::: clutter/clutter-backend.c
@@ +1008,3 @@
+  else if (CLUTTER_IS_DEVICE_MANAGER_PLATFORM (backend->device_manager))
+    {
+      iface = CLUTTER_DEVICE_MANAGER_PLATFORM_GET_IFACE (backend->device_manager);

I'd actually flip the priority — i.e. use the ClutterBackend's mechanism as the fallback.
Comment 7 Emmanuele Bassi (:ebassi) 2015-11-17 17:12:25 UTC
Review of attachment 315768 [details] [review]:

::: clutter/clutter-device-manager-private.h
@@ +147,3 @@
 
+/* Platform-dependent interface */
+typedef struct _ClutterDeviceManagerPlatform ClutterDeviceManagerPlatform;

Not really sold on the name, to be honest. :-/

We have ClutterEventTranslator, maybe we should have something under that same naming scheme — like ClutterEventExtender.
Comment 8 Emmanuele Bassi (:ebassi) 2015-11-17 17:13:02 UTC
Review of attachment 315771 [details] [review]:

Okay.
Comment 9 Emmanuele Bassi (:ebassi) 2015-11-17 17:13:18 UTC
Review of attachment 315772 [details] [review]:

Okay.
Comment 10 Emmanuele Bassi (:ebassi) 2015-11-17 17:13:33 UTC
Review of attachment 315770 [details] [review]:

Okay.
Comment 11 Emmanuele Bassi (:ebassi) 2015-11-17 17:14:43 UTC
Would probably be nice to port some other DeviceManager subclasses to the new interface, instead of using the Backend.
Comment 12 Carlos Garnacho 2015-11-17 17:18:06 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #7)
> Review of attachment 315768 [details] [review] [review]:
> 
> ::: clutter/clutter-device-manager-private.h
> @@ +147,3 @@
>  
> +/* Platform-dependent interface */
> +typedef struct _ClutterDeviceManagerPlatform ClutterDeviceManagerPlatform;
> 
> Not really sold on the name, to be honest. :-/

Yeah, me neither... Couldn't think of a better name though

> 
> We have ClutterEventTranslator, maybe we should have something under that
> same naming scheme — like ClutterEventExtender.

Right :), I like that more than all the names I came up with, updating now the patches.
Comment 13 Carlos Garnacho 2015-11-17 18:51:06 UTC
Created attachment 315778 [details] [review]
device-manager: Add private interface to manipulate platform event data

This normally belonged to the ClutterBackend, however there's device
managers (eg. evdev) that are somewhat detached from the backend, so
need to bridge this somehow.

This allows device managers to implement these bits that were usually
responsibility of the ClutterBackend.
Comment 14 Carlos Garnacho 2015-11-17 18:51:11 UTC
Created attachment 315779 [details] [review]
backend: Bridge platform-dependent event data creation to device managers

Device managers can now implement the ClutterEventExtender interface
that allows them to set their own data to events, make the backend call
those implementations if the device manager implements the interface.
Comment 15 Carlos Garnacho 2015-11-17 18:51:16 UTC
Created attachment 315780 [details] [review]
evdev: Implement the ClutterEventExtender interface

This will allow the ClutterDeviceManagerEvdev to define evdev-specific
event data.
Comment 16 Carlos Garnacho 2015-11-17 18:51:45 UTC
Created attachment 315781 [details] [review]
x11: Implement ClutterEventExtender

This lifts the responsibility off its ClutterBackend.
Comment 17 Carlos Garnacho 2015-11-17 18:51:49 UTC
Created attachment 315782 [details] [review]
gdk: Implement ClutterEventExtender

This lifts the responsibility off its ClutterBackend.
Comment 18 Carlos Garnacho 2015-11-17 18:53:49 UTC
Comment on attachment 315780 [details] [review]
evdev: Implement the ClutterEventExtender interface

This one just went through the ClutterEventExtender rename, setting tentatively as a-c-n as I mark the old one obsolete
Comment 19 Emmanuele Bassi (:ebassi) 2015-11-18 11:28:29 UTC
Review of attachment 315778 [details] [review]:

Okay.
Comment 20 Emmanuele Bassi (:ebassi) 2015-11-18 11:28:56 UTC
Review of attachment 315779 [details] [review]:

Okay.
Comment 21 Emmanuele Bassi (:ebassi) 2015-11-18 11:29:15 UTC
Review of attachment 315780 [details] [review]:

Okay.
Comment 22 Emmanuele Bassi (:ebassi) 2015-11-18 11:29:50 UTC
Review of attachment 315781 [details] [review]:

Okay.
Comment 23 Emmanuele Bassi (:ebassi) 2015-11-18 11:30:15 UTC
Review of attachment 315782 [details] [review]:

Okay.
Comment 24 Carlos Garnacho 2015-11-18 12:08:47 UTC
Thanks! This will help me get rid of some finicky code in my tablet branches too :). Pushed now everything:

Attachment 315771 [details] pushed as f1ad702 - evdev: Allow to retrieve the input.h event code from ClutterEvents
Attachment 315772 [details] pushed as 8aeea7f - evdev: Set event code on button/key events
Attachment 315778 [details] pushed as 5ea70bd - device-manager: Add private interface to manipulate platform event data
Attachment 315779 [details] pushed as 4115f21 - backend: Bridge platform-dependent event data creation to device managers
Attachment 315780 [details] pushed as dfc749e - evdev: Implement the ClutterEventExtender interface
Attachment 315781 [details] pushed as 9215852 - x11: Implement ClutterEventExtender
Attachment 315782 [details] pushed as a9b0715 - gdk: Implement ClutterEventExtender