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
This commit is contained in:
Carlos Garnacho 2020-04-07 18:57:59 +02:00 committed by Carlos Garnacho
parent e74c2e42cf
commit f0718c7d95

View File

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