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 720563 - MetaIdleMonitor: Don't make assumptions about input device ids
MetaIdleMonitor: Don't make assumptions about input device ids
Status: RESOLVED OBSOLETE
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2013-12-16 21:32 UTC by Jonas Ådahl
Modified: 2014-12-29 05:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
MetaIdleMonitor: Don't make assumptions about input device ids (3.53 KB, patch)
2013-12-16 21:32 UTC, Jonas Ådahl
reviewed Details | Review

Description Jonas Ådahl 2013-12-16 21:32:35 UTC
Store virtual 'core' monitor separately and don't associate it with some
input device.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Comment 1 Jonas Ådahl 2013-12-16 21:32:37 UTC
Created attachment 264331 [details] [review]
MetaIdleMonitor: Don't make assumptions about input device ids
Comment 2 Giovanni Campagna 2013-12-16 21:51:26 UTC
Review of attachment 264331 [details] [review]:

Input device ids are part of the XInput 2 protocol. We can make assumptions until the protocol is broken in the next major revision of the extensions.
Comment 3 Jonas Ådahl 2013-12-16 22:00:04 UTC
This change is related to https://bugzilla.gnome.org/show_bug.cgi?id=720566 which doesn't adhere to XInput 2.
Comment 4 Giovanni Campagna 2013-12-16 22:04:41 UTC
What's wrong with using the integer part of the sysfs basename (plus some offset to account for virtual devices) as the device ID?
It's a small integer, and allows us to keep the assumptions and keep the code small and fast (and that's a very hot path - invoked for every input event)
Comment 5 Jonas Ådahl 2013-12-16 22:30:00 UTC
The patch in bug 720566 takes multi seat setups into consideration, thus it does not have "core devices" (right now core devices are just mapped to the virtual devices of the first seat created). Because of this, the I just changed the ids to be global_id_next++ for every new device for simplicity. There is no particular reason for not keep having it generated from the sysfs basename I guess, I just couldn't see the need.

I don't think it's a performance problem though, as the hash table wont grow very large and, I assume, look up is O(1).
Comment 6 Jasper St. Pierre (not reading bugmail) 2014-12-29 05:37:17 UTC
We should probably rewrite this code with a hash table at some point given how many bugs we found in the custom sparse array, but this patch doesn't apply anymore.