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 773779 - Implement drawing tablet support on x11
Implement drawing tablet support on x11
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-11-01 16:03 UTC by Carlos Garnacho
Modified: 2016-11-07 14:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Revert "backends: Use g-s-d settings for tablet configuration" (17.73 KB, patch)
2016-11-01 16:24 UTC, Carlos Garnacho
committed Details | Review
clutter/x11: Implement XTest-based ClutterVirtualInputDevice (5.28 KB, patch)
2016-11-01 16:24 UTC, Carlos Garnacho
committed Details | Review
clutter/x11: Add minimal support for pad devices (4.74 KB, patch)
2016-11-01 16:24 UTC, Carlos Garnacho
committed Details | Review
core: Handle special actions associated to pad buttons in generic code (3.09 KB, patch)
2016-11-01 16:24 UTC, Carlos Garnacho
committed Details | Review
backends: Add missing pad button-to-keycombo translation (4.15 KB, patch)
2016-11-01 16:27 UTC, Carlos Garnacho
committed Details | Review
clutter: Add ClutterDeviceManager::tool-changed signal (1.98 KB, patch)
2016-11-01 16:29 UTC, Carlos Garnacho
committed Details | Review
clutter/evdev: Emit ClutterDeviceManager::tool-changed (1.87 KB, patch)
2016-11-01 16:29 UTC, Carlos Garnacho
committed Details | Review
clutter/evdev: Take over stylus configuration (28.19 KB, patch)
2016-11-01 16:30 UTC, Carlos Garnacho
committed Details | Review
backends: Remove ToolSettings struct (7.05 KB, patch)
2016-11-01 16:30 UTC, Carlos Garnacho
committed Details | Review
backends: extend tablet device checks (3.27 KB, patch)
2016-11-01 16:30 UTC, Carlos Garnacho
committed Details | Review
backends/x11: Implement tablet settings based on the Wacom driver (9.37 KB, patch)
2016-11-01 16:30 UTC, Carlos Garnacho
committed Details | Review
clutter/x11: Implement ClutterInputDeviceTool (9.33 KB, patch)
2016-11-01 16:36 UTC, Carlos Garnacho
none Details | Review
clutter/x11: Implement ClutterInputDeviceTool (14.21 KB, patch)
2016-11-04 18:06 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2016-11-01 16:03:43 UTC
Currently we only have mutter managing tablet configuration on wayland, management on X11 is still done by gnome-settings-daemon, based on "old" settings. I'm attaching some patches to make mutter take over X11 tablet configuration too, and we can finally remove the wacom tablet management in g-s-d.

This is based on the Wacom input driver at the moment, the libinput driver is not the fallback driver yet for tablets and pads, so that is left as another bridge to cross (hopefully soon). That said, porting from Wacom to libinput will be mostly straightforward on top of these patches.
Comment 1 Carlos Garnacho 2016-11-01 16:24:12 UTC
Created attachment 338891 [details] [review]
Revert "backends: Use g-s-d settings for tablet configuration"

This reverts commit b52f304f9db590220555cb3a04a3c31f32ee7f19.
Comment 2 Carlos Garnacho 2016-11-01 16:24:17 UTC
Created attachment 338892 [details] [review]
clutter/x11: Implement XTest-based ClutterVirtualInputDevice

This will be used too on X11 in order to implement the button-to-keycombo
mapping in pad devices.
Comment 3 Carlos Garnacho 2016-11-01 16:24:23 UTC
Created attachment 338893 [details] [review]
clutter/x11: Add minimal support for pad devices

We most notably handle button events (acquired through a passive grab on
all device buttons) which are translated to CLUTTER_PAD_BUTTON* events,
so there is generic handling of pad actions on X11.
Comment 4 Carlos Garnacho 2016-11-01 16:24:29 UTC
Created attachment 338894 [details] [review]
core: Handle special actions associated to pad buttons in generic code

And remove the wayland-specific handling. This works for both Wayland and
X11 (provided the compositor receives pad events through a passive grab
there).
Comment 5 Carlos Garnacho 2016-11-01 16:27:01 UTC
Created attachment 338895 [details] [review]
backends: Add missing pad button-to-keycombo translation
Comment 6 Carlos Garnacho 2016-11-01 16:29:48 UTC
Created attachment 338896 [details] [review]
clutter: Add ClutterDeviceManager::tool-changed signal

This signal will notify whenever a device changed tool.
Comment 7 Carlos Garnacho 2016-11-01 16:29:58 UTC
Created attachment 338897 [details] [review]
clutter/evdev: Emit ClutterDeviceManager::tool-changed

We do so whenever a tool enters or leaves proximity. We now also
ensure that last_tool is NULL after it leaves proximity, although
the CLUTTER_PROXIMITY_OUT event itself should still contain tool
information.
Comment 8 Carlos Garnacho 2016-11-01 16:30:13 UTC
Created attachment 338898 [details] [review]
clutter/evdev: Take over stylus configuration

Stylus configuration (stylus buttons, pressure) was handled
at the very high level, doing the button and pressure translations
right before sending these to wayland clients.

However, it makes more sense to store these settings into the
ClutterInputDeviceTool itself, and have clutter apply the config
at the lower level so 1) the settings actually apply desktop-wide,
not just in clients and 2) X11 and wayland may share similar
configuration paths. The settings are now just applied whenever
the tool enters proximity, in reaction to
ClutterDeviceManager::tool-changed.

This commit moves all handling of these two settings to
the clutter level, and removes the wayland-specific paths
Comment 9 Carlos Garnacho 2016-11-01 16:30:19 UTC
Created attachment 338899 [details] [review]
backends: Remove ToolSettings struct

Its only purpose was caching settings applying to an stylus/tool, this
is now handled through ClutterInputDeviceTool evdev specific API, or
X device properties, so is not needed anymore.
Comment 10 Carlos Garnacho 2016-11-01 16:30:25 UTC
Created attachment 338900 [details] [review]
backends: extend tablet device checks

The Clutter X11 backend can't drop CLUTTER_PEN_DEVICE and
CLUTTER_ERASER_DEVICE in favor of CLUTTER_TABLET_DEVICE without
losing information (as the driver will create one device for each).
So make MetaInputSettings cater for both sets of device types.
Comment 11 Carlos Garnacho 2016-11-01 16:30:30 UTC
Created attachment 338901 [details] [review]
backends/x11: Implement tablet settings based on the Wacom driver

This is a stopgap solution until libinput is the fallback driver
handling tablets and pads.
Comment 12 Carlos Garnacho 2016-11-01 16:36:06 UTC
Created attachment 338902 [details] [review]
clutter/x11: Implement ClutterInputDeviceTool

This is implemented using Wacom-driver specific properties at
the moment, until libinput becomes the fallback driver handling
tablet and pad management.

Whenever a tool becomes in proximity, a new ClutterInputDeviceToolXI2
will be created (if it wasn't created previously) for the given
serial number. This tool will be set in all events send from the
device.
Comment 13 Florian Müllner 2016-11-04 17:34:54 UTC
Review of attachment 338891 [details] [review]:

Sure
Comment 14 Florian Müllner 2016-11-04 17:34:56 UTC
Review of attachment 338892 [details] [review]:

OK
Comment 15 Florian Müllner 2016-11-04 17:34:59 UTC
Review of attachment 338893 [details] [review]:

OK
Comment 16 Florian Müllner 2016-11-04 17:35:00 UTC
Review of attachment 338894 [details] [review]:

Nice
Comment 17 Florian Müllner 2016-11-04 17:35:03 UTC
Review of attachment 338895 [details] [review]:

OK
Comment 18 Florian Müllner 2016-11-04 17:35:05 UTC
Review of attachment 338896 [details] [review]:

OK
Comment 19 Florian Müllner 2016-11-04 17:35:08 UTC
Review of attachment 338897 [details] [review]:

OK
Comment 20 Florian Müllner 2016-11-04 17:35:10 UTC
Review of attachment 338899 [details] [review]:

Yay
Comment 21 Florian Müllner 2016-11-04 17:35:13 UTC
Review of attachment 338900 [details] [review]:

::: src/backends/meta-input-settings.c
@@ +875,3 @@
+      clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE &&
+      clutter_input_device_get_device_type (device) != CLUTTER_ERASER_DEVICE &&
+      clutter_input_device_get_device_type (device) != CLUTTER_PAD_DEVICE)

Is PAD_DEVICE needed? If yes, can it really be omitted from the other conditions?
Comment 22 Florian Müllner 2016-11-04 17:35:18 UTC
Review of attachment 338902 [details] [review]:

::: clutter/clutter/Makefile.am
@@ +414,3 @@
 	x11/clutter-device-manager-xi2.c	\
 	x11/clutter-input-device-xi2.c	\
+	x11/clutter-input-device-tool-xi2.c \

Looks like you forgot to git-add those

::: clutter/clutter/x11/clutter-device-manager-xi2.c
@@ +967,3 @@
+  prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
+  if (prop == None)
+    return FALSE;

IMHO serial_id or 0 would be clearer here
Comment 23 Florian Müllner 2016-11-04 17:35:22 UTC
Review of attachment 338901 [details] [review]:

::: src/backends/x11/meta-input-settings-x11.c
@@ +703,3 @@
+    return;
+
+  /* Grab the puke bucket! */

Again? We already got one from above!!1!
Comment 24 Florian Müllner 2016-11-04 17:35:24 UTC
Review of attachment 338898 [details] [review]:

OK
Comment 25 Carlos Garnacho 2016-11-04 18:06:29 UTC
(In reply to Florian Müllner from comment #22)
> Review of attachment 338902 [details] [review] [review]:
> 
> ::: clutter/clutter/Makefile.am
> @@ +414,3 @@
>  	x11/clutter-device-manager-xi2.c	\
>  	x11/clutter-input-device-xi2.c	\
> +	x11/clutter-input-device-tool-xi2.c \
> 
> Looks like you forgot to git-add those

Darn

> 
> ::: clutter/clutter/x11/clutter-device-manager-xi2.c
> @@ +967,3 @@
> +  prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
> +  if (prop == None)
> +    return FALSE;
> 
> IMHO serial_id or 0 would be clearer here

Indeed, seems a brain fart, a harmless one for a change :).
Comment 26 Carlos Garnacho 2016-11-04 18:06:48 UTC
Created attachment 339134 [details] [review]
clutter/x11: Implement ClutterInputDeviceTool

This is implemented using Wacom-driver specific properties at
the moment, until libinput becomes the fallback driver handling
tablet and pad management.

Whenever a tool becomes in proximity, a new ClutterInputDeviceToolXI2
will be created (if it wasn't created previously) for the given
serial number. This tool will be set in all events send from the
device.
Comment 27 Florian Müllner 2016-11-04 20:13:06 UTC
Review of attachment 339134 [details] [review]:

OK

(Disclaimer: all the patches are untested on my part, not least due to missing hardware)
Comment 28 Carlos Garnacho 2016-11-04 20:36:59 UTC
(In reply to Florian Müllner from comment #21)
> Review of attachment 338900 [details] [review] [review]:
> 
> ::: src/backends/meta-input-settings.c
> @@ +875,3 @@
> +      clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE &&
> +      clutter_input_device_get_device_type (device) !=
> CLUTTER_ERASER_DEVICE &&
> +      clutter_input_device_get_device_type (device) != CLUTTER_PAD_DEVICE)
> 
> Is PAD_DEVICE needed? If yes, can it really be omitted from the other
> conditions?

Yes, and yes. pad is only affected by the left-handed setting here (because buttons change position if you flip the tablet 180º), the other settings are about abs coordinates, so only affect styli. 

(In reply to Florian Müllner from comment #27)
> Review of attachment 339134 [details] [review] [review]:
> 
> OK
> 
> (Disclaimer: all the patches are untested on my part, not least due to
> missing hardware)

I assumed as much :), took good care of that myself. Equally appreciated anyway!
Comment 29 Carlos Garnacho 2016-11-04 20:38:35 UTC
Attachment 338891 [details] pushed as db9d8fc - Revert "backends: Use g-s-d settings for tablet configuration"
Attachment 338892 [details] pushed as 674a483 - clutter/x11: Implement XTest-based ClutterVirtualInputDevice
Attachment 338893 [details] pushed as 9abf689 - clutter/x11: Add minimal support for pad devices
Attachment 338894 [details] pushed as 1831a1d - core: Handle special actions associated to pad buttons in generic code
Attachment 338895 [details] pushed as cea7d62 - backends: Add missing pad button-to-keycombo translation
Attachment 338896 [details] pushed as bd83873 - clutter: Add ClutterDeviceManager::tool-changed signal
Attachment 338897 [details] pushed as 75c3f0f - clutter/evdev: Emit ClutterDeviceManager::tool-changed
Attachment 338898 [details] pushed as b252771 - clutter/evdev: Take over stylus configuration
Attachment 338899 [details] pushed as 6257f11 - backends: Remove ToolSettings struct
Attachment 338900 [details] pushed as b35b531 - backends: extend tablet device checks
Attachment 338901 [details] pushed as ff97536 - backends/x11: Implement tablet settings based on the Wacom driver
Attachment 339134 [details] pushed as ea4dbdd - clutter/x11: Implement ClutterInputDeviceTool
Comment 30 Hussam Al-Tayeb 2016-11-07 11:50:01 UTC
This causes an issue compiling mutter git.
x11/clutter-input-device-tool-xi2.c:30:43: error: no previous declaration for ‘clutter_input_device_tool_xi2_get_type’ [-Werror=missing-declarations]
Editing the makefile to make it wno error makes it compile.
Comment 31 Carlos Garnacho 2016-11-07 14:53:24 UTC
It's now fixed in master, sorry about that. And strange I wasn't getting the error using "jhbuild make", however plain autogen+make got me there.