1
0
Fork 0

x11/input-device: Stop using deprecated libwacom API

libwacom_has_ring/ring2 was deprecated. Switch to the replacement
function where it is available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3974>
This commit is contained in:
Florian Müllner 2024-08-22 19:25:44 +02:00 committed by Marge Bot
parent 98e7197511
commit da828c2fcc
3 changed files with 24 additions and 2 deletions

View file

@ -48,6 +48,9 @@
/* Building with libwacom for advanced tablet management */
#mesondefine HAVE_LIBWACOM
/* libwacom has get_num_rings() */
#mesondefine HAVE_LIBWACOM_GET_NUM_RINGS
/* Building with libsystemd */
#mesondefine HAVE_LIBSYSTEMD

View file

@ -298,6 +298,10 @@ endif
have_libwacom = get_option('libwacom')
if have_libwacom
libwacom_dep = dependency('libwacom', version: libwacom_req)
have_libwacom_get_num_rings = cc.has_function('libwacom_get_num_rings',
dependencies: libwacom_dep)
else
have_libwacom_get_num_rings = false
endif
have_pango_ft2 = get_option('pango_ft2')
@ -553,6 +557,7 @@ cdata.set('HAVE_EGL_DEVICE', have_egl_device)
cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream)
cdata.set('HAVE_LIBGUDEV', have_libgudev)
cdata.set('HAVE_LIBWACOM', have_libwacom)
cdata.set('HAVE_LIBWACOM_GET_NUM_RINGS', have_libwacom_get_num_rings)
cdata.set('HAVE_SM', have_sm)
cdata.set('HAVE_STARTUP_NOTIFICATION', have_startup_notification)
cdata.set('HAVE_INTROSPECTION', have_introspection)

View file

@ -195,6 +195,20 @@ meta_input_device_x11_get_property (GObject *object,
}
}
#ifndef HAVE_LIBWACOM_GET_NUM_RINGS
static int
libwacom_get_num_rings (WacomDevice *device)
{
if (libwacom_has_ring2 (device))
return 2;
if (libwacom_has_ring (device))
return 1;
return 0;
}
#endif
static int
meta_input_device_x11_get_group_n_modes (ClutterInputDevice *device,
int group)
@ -208,14 +222,14 @@ meta_input_device_x11_get_group_n_modes (ClutterInputDevice *device,
{
if (group == 0)
{
if (libwacom_has_ring (wacom_device))
if (libwacom_get_num_rings (wacom_device) >= 1)
return libwacom_get_ring_num_modes (wacom_device);
else if (libwacom_get_num_strips (wacom_device) >= 1)
return libwacom_get_strips_num_modes (wacom_device);
}
else if (group == 1)
{
if (libwacom_has_ring2 (wacom_device))
if (libwacom_get_num_rings (wacom_device) >= 2)
return libwacom_get_ring2_num_modes (wacom_device);
else if (libwacom_get_num_strips (wacom_device) >= 2)
return libwacom_get_strips_num_modes (wacom_device);