GNOME Bugzilla – Bug 782040
Wacom pen calibration application responds to mouse input
Last modified: 2017-06-30 19:29:30 UTC
When performing a pen calibration under Wayland, the utility appears to respond to normal mouse clicks instead of /only/ pen taps. This doesn't cause too much of an issue since the clicks will often trigger the "mis-click" detection, but its still not desirable. System Info -------------- Arch Linux gnome-control-center 3.24.1-1 gnome-settings-daemon 3.24.1+7+g42f75ed4-1 mutter 3.24.1+1+geb394f19d-1 xf86-input-wacom 0.34.2-1 xorg-server 1.19.3-2 Wayland session
Created attachment 353911 [details] [review] wacom: Make calibrator use GDK for button events This way we can cut down the last step in the mapping across GUdevDevice->GsdDevice->GdkDevice->ClutterInputDevice.
Created attachment 353912 [details] [review] wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator This makes the calibrator only reactive to the tablet being calibrated again.
The code looks reasonable enough* but doesn't seem to be working for some reason. The calibration UI still responds to clicks from all of my input devices. I'll have to poke around and see if I can figure out what's going next week unfortunately... Nitpick: Is there any way to match more specifically than by VID:PID? It should be fine, if a little imprecise. The chances of someone have two same-model display tablets connected should be pretty low, and on top of that GNOME would have to have incorrect display mapping to cause the calibration window to appear on the wrong head.
(In reply to Jason Gerecke from comment #3) > The code looks reasonable enough* but doesn't seem to be working for some > reason. The calibration UI still responds to clicks from all of my input > devices. I'll have to poke around and see if I can figure out what's going > next week unfortunately... Right... wayland needed https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=9e740bd4355ac57b97fd6698fa5da27cf2be89ab additionally. > > Nitpick: Is there any way to match more specifically than by VID:PID? It > should be fine, if a little imprecise. The chances of someone have two > same-model display tablets connected should be pretty low, and on top of > that GNOME would have to have incorrect display mapping to cause the > calibration window to appear on the wrong head. True, we could use the /dev/input path, unfortunately that's down to backend-specific GDK calls, probably better would be to do the lookup in GsdDeviceManager x11/wayland dependent paths.
(In reply to Carlos Garnacho from comment #4) > (In reply to Jason Gerecke from comment #3) > > The code looks reasonable enough* but doesn't seem to be working for some > > reason. The calibration UI still responds to clicks from all of my input > > devices. I'll have to poke around and see if I can figure out what's going > > next week unfortunately... > > Right... wayland needed > https://git.gnome.org/browse/gtk+/commit/?h=gtk-3- > 22&id=9e740bd4355ac57b97fd6698fa5da27cf2be89ab additionally. > Thanks for the tip -- that seems to do the trick. Calibration now only responds to input from the tablet being calibrated.
Actually, I've just ran into an issue with this patch. Looks like its possible under an X11 session for the "pad" device to be returned by `cc_wacom_page_get_gdk_device`. This prevents the pen from being used for calibration since its a different device. I'd normally say that the pad shouldn't be classified as a GDK_SOURCE_PEN device, but I wonder if any software relies on it being one...
Created attachment 354589 [details] [review] GTK: x11: Assign GDK_SOURCE_TABLET_PAD when necessary Just realized Wayland already sets pad devices as GDK_SOURCE_TABLET_PAD, so we might as well be consistent and do the same thing under X. Doing so should fix the calibration issue I ran into earlier.
Created attachment 354713 [details] [review] wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator This makes the calibrator only reactive to the tablet being calibrated again.
Comment on attachment 354589 [details] [review] GTK: x11: Assign GDK_SOURCE_TABLET_PAD when necessary Better GDK_SOURCE_TABLET_PAD than GDK_SOURCE_MOUSE :). It's pretty clear that GTK ever had involvement with pads, thanks to g-s-d passive grabs.
Comment on attachment 354713 [details] [review] wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator >+ >+ if (g_strcmp0 (device_node, gsd_device_get_device_file (gsd_device))) >+ gdk_device = l->data; >+ >+ g_free (device_node); >+ } Missing an `== 0` at the end of your string comparison, but otherwise looks good.
(In reply to Jason Gerecke from comment #10) > Comment on attachment 354713 [details] [review] [review] > wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator > > >+ > >+ if (g_strcmp0 (device_node, gsd_device_get_device_file (gsd_device))) > >+ gdk_device = l->data; > >+ > >+ g_free (device_node); > >+ } > > Missing an `== 0` at the end of your string comparison, but otherwise looks > good. Yeah, g_strcmp vs g_str_equal thinko... I noticed after sending and had it fixed locally. Thanks for the keen eye :).
Attachment 353911 [details] pushed as b26d6ac - wacom: Make calibrator use GDK for button events Attachment 354713 [details] pushed as 42489e2 - wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator