wacom: Pair only builtin pads with tablets

Pad and tablet grouping has become more irrelevant to the
Settings UI since commit 39402f21ba, as the EKR is the only
known case of an additional pad with distinct vendor/product
that is tied to another device.

But we preserved the grouping of pads (for the tablet EKRs
get paired with), thus possibly still requesting the pad OSD
to be shown on one of these arbitrarily.

In order to ensure that each "Map Buttons..." button in the
UI goes to the right pad being mapped, drop this grouping of
tablets, and make a CcWacomPage only observe a stylus/pad
pair in the same group (i.e. belonging to the same device, if
multiple similar ones are plugged) and with the same vendor+product
(i.e. coming from the same device).

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2876
This commit is contained in:
Carlos Garnacho 2024-02-01 13:14:59 +01:00
parent cc7aff9cb2
commit d4d0c60fc7

View file

@ -715,12 +715,21 @@ check_add_pad (CcWacomPage *page,
GsdDevice *gsd_device)
{
g_autoptr(CcWacomDevice) wacom_device = NULL;
const gchar *stylus_vendor, *stylus_product;
const gchar *pad_vendor, *pad_product;
GsdDevice *stylus_device;
if ((gsd_device_get_device_type (gsd_device) & GSD_DEVICE_TYPE_PAD) == 0)
return;
if (!gsd_device_shares_group (cc_wacom_device_get_device (page->stylus),
gsd_device))
stylus_device = cc_wacom_device_get_device (page->stylus);
gsd_device_get_device_ids (cc_wacom_device_get_device (page->stylus),
&stylus_vendor, &stylus_product);
gsd_device_get_device_ids (gsd_device, &pad_vendor, &pad_product);
if (!gsd_device_shares_group (stylus_device, gsd_device) ||
g_strcmp0 (stylus_vendor, pad_vendor) != 0 ||
g_strcmp0 (stylus_product, pad_product) != 0)
return;
wacom_device = cc_wacom_device_new (gsd_device);