backends/x11: Fix access to WacomDevice

At some point we crossed the streams... In a short timespan we had
1f00aba92c merged, pushing WacomDevice to a common parent object,
and dcaa45fc0c implementing device grouping for X11.

The latter did not rely on the former, and just happened to
merge/compile without issues, but would promptly trigger a crash
whenever the API would be used.

Drop all traces of the WacomDevice internal to MetaInputDeviceX11.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1183


(cherry picked from commit f0718c7d95)
This commit is contained in:
Carlos Garnacho 2020-04-07 16:57:59 +00:00 committed by Jonas Ådahl
parent bc47f0a1ac
commit 3b2f6ae93d

View File

@ -38,7 +38,6 @@ struct _MetaInputDeviceX11
float current_y;
#ifdef HAVE_LIBWACOM
WacomDevice *wacom_device;
GArray *group_modes;
#endif
};
@ -93,13 +92,16 @@ meta_input_device_x11_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
#ifdef HAVE_LIBWACOM
MetaInputDeviceX11 *device_x11 = META_INPUT_DEVICE_X11 (device);
MetaInputDeviceX11 *other_device_x11 = META_INPUT_DEVICE_X11 (other_device);
WacomDevice *wacom_device, *other_wacom_device;
if (device_x11->wacom_device &&
other_device_x11->wacom_device &&
libwacom_compare (device_x11->wacom_device,
other_device_x11->wacom_device,
wacom_device =
meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
other_wacom_device =
meta_input_device_get_wacom_device (META_INPUT_DEVICE (other_device));
if (wacom_device && other_wacom_device &&
libwacom_compare (wacom_device,
other_wacom_device,
WCOMPARE_NORMAL) == 0)
return TRUE;
#endif
@ -413,9 +415,12 @@ pad_switch_mode (ClutterInputDevice *device,
{
MetaInputDeviceX11 *device_x11 = META_INPUT_DEVICE_X11 (device);
uint32_t n_buttons, n_modes, button_group, next_mode, i;
WacomDevice *wacom_device;
GList *switch_buttons = NULL;
n_buttons = libwacom_get_num_buttons (device_x11->wacom_device);
wacom_device =
meta_input_device_get_wacom_device (META_INPUT_DEVICE (device));
n_buttons = libwacom_get_num_buttons (wacom_device);
for (i = 0; i < n_buttons; i++)
{