GNOME Bugzilla – Bug 681083
imon USB touchscreen is not reported as GDK_SOURCE_TOUCHSCREEN
Last modified: 2018-04-15 00:27:47 UTC
I have an imon USB touchscreen on which I am trying to run a GTK application. Unfortunately, this touchscreen is not recognised as a GDK_SOURCE_TOUCHSCREEN but as a GDK_SOURCE_MOUSE, so that kinetic scrolling is not enabled. Library is libgtk-3.4.2-0ubuntu0.4 Output from gdk_device_manager_list_sources() Eee PC WMI hotkeys <enum GDK_SOURCE_KEYBOARD of type GdkInputSource> iMON Remote (15c2:0035) <enum GDK_SOURCE_KEYBOARD of type GdkInputSource> iMON USB Touchscreen (15c2:0035) <enum GDK_SOURCE_MOUSE of type GdkInputSource> iMON Panel, Knob and Mouse(15c2:0035) <enum GDK_SOURCE_MOUSE of type GdkInputSource> Power Button <enum GDK_SOURCE_KEYBOARD of type GdkInputSource> Power Button <enum GDK_SOURCE_KEYBOARD of type GdkInputSource> Virtual core XTEST keyboard <enum GDK_SOURCE_KEYBOARD of type GdkInputSource> Virtual core XTEST pointer <enum GDK_SOURCE_MOUSE of type GdkInputSource> Is there a way to force touchscreen mode? I have included gtk-touchscreen-mode=1 in .gtkrc2.0, but I guess that applies only to gtk+2.x Thanks for any pointers.
Lets try to get some diagnostics. Can you run xinput list identify the touchscreen device in the output, and then run xinput query-state <device id> xinput list-props <device id> ?
$ xinput query-state 9 2 classes : ButtonClass button[1]=up button[2]=up button[3]=up button[4]=up button[5]=up ValuatorClass Mode=Absolute Proximity=In valuator[0]=320 valuator[1]=180 $ xinput list-props 9 Device 'iMON USB Touchscreen (15c2:0035)': Device Enabled (132): 1 Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 Device Accel Profile (257): 0 Device Accel Constant Deceleration (258): 1.000000 Device Accel Adaptive Deceleration (259): 1.000000 Device Accel Velocity Scaling (260): 10.000000 Device Product ID (252): 5570, 53 Device Node (253): "/dev/input/event4" Evdev Axis Inversion (261): 0, 0 Evdev Axis Calibration (262): 62, 3824, 358, 3839 Evdev Axes Swap (263): 0 Axis Labels (264): "Abs X" (278), "Abs Y" (279) Button Labels (265): "Button Unknown" (255), "Button Unknown" (255), "Button Unknown" (255), "Button Wheel Up" (138), "Button Wheel Down" (139) Evdev Middle Button Emulation (266): 0 Evdev Middle Button Timeout (267): 50 Evdev Third Button Emulation (268): 0 Evdev Third Button Emulation Timeout (269): 1000 Evdev Third Button Emulation Button (270): 3 Evdev Third Button Emulation Threshold (271): 20 Evdev Wheel Emulation (272): 0 Evdev Wheel Emulation Axes (273): 0, 0, 4, 5 Evdev Wheel Emulation Inertia (274): 10 Evdev Wheel Emulation Timeout (275): 200 Evdev Wheel Emulation Button (276): 4 Evdev Drag Lock Buttons (277): 0
ok, so the reason we don't consider this a touch device is that it doesn't have a touch class. Peter, any advice for how to best recognize such devices. Just look for 'touchscreen' in the name ? :-(
The kernel driver knows this is a touch screen because of the device id. Maybe it doesn't export this flag to the XInput layer?
Unfortunately not, it's missing from XI2. You can query the XI 1.x XDeviceInfo->type and check if it matches "TOUCHSCREEN" but I'm not sure that's always set correctly. This would still be the most reliable approach. Alternatively, you can check the axes and assume that something with 2 absolute axes is a touchscreen but that's prone to errors too. Sorry, I don't really have any better suggestions here.
Well, if it is complicated to autodetect the correct settings, it should at least be possible to override the detection manually. But setting gtk_touchscreen_mode=1 in .gtkrc2.0 does not seem to have any effect.
A setting in the GTK+ 2 config isn't going to affect GTK+ 3. The setting was moved to GtkSettings:gtk-touchscreen-mode in GTK+ 3, although it's deprecated. You could try it, though, if this is still a problem in 3.22. And on that note: is it?
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new