Misleading X11/XI2 input source name in GDK_DEBUG=input debug log
Commits c1d90273 and 3285f52d drop eraser and cursor from GkdInputSource enum without dropping them from source_names array (at https://gitlab.gnome.org/GNOME/gtk/-/blob/310ab7b53135c1ebd4460cabeb52dcbd51832671/gdk/x11/gdkdevicemanager-xi2.c#L523) which can potentially mislead user/debugger about the actual source type of an input device under X11/XI2 environment.
Steps to reproduce
- Under X11 desktop environment, launch gtk4-demo with GDK_DEBUG=input environment variable.
- Observe any connected keyboard/touchscreen/touchpad/trackpoint/tabletpad device with mismatched source type in debug log.
Current behavior
Because the GdkInputSource enum and the source_names array do not line up for keyboard/touchscreen/touchpad/trackpoint/tabletpad devices, GDK_DEBUG=input messages will currently show incorrect source type for these devices.
Example with Cooler Master keyboard and Intuos drawing tablet (some text culled for less verbosity):
$ GDK_DEBUG=input _build/demos/gtk-demo/gtk4-demo
Creating XI2 (version 2.4) device manager
...
input device:
name: Cooler Master MasterKeys Pro M RGB
type: physical
source: eraser
has cursor: 0
touches: 0
...
input device:
name: Wacom Intuos Pro M Pad pad
type: physical
source: indirect touch
has cursor: 0
touches: 0
...
input device:
name: Wacom Intuos Pro M Pen stylus
type: physical
source: pen
has cursor: 0
touches: 0
...
input device:
name: Wacom Intuos Pro M Pen eraser
type: physical
source: pen
has cursor: 0
touches: 0
...
input device:
name: Wacom Intuos Pro M Finger touch
type: physical
source: keyboard
has cursor: 0
touches: 10
...
Expected outcome
Show correct source type for each connect input device.
Version information
- GTK 4.14.2 (debug build of f4a87872)
- Arch Linux
- KDE Plasma 6 (X11)
Edited by Hansem Ro