Make the model quirk check available on the libinput device

Moves things one level higher to be able to use it from a plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
This commit is contained in:
Peter Hutterer 2025-07-08 17:32:58 +10:00 committed by Marge Bot
parent 14a83ef18b
commit 32c5fde0a8
3 changed files with 19 additions and 9 deletions

View file

@ -392,15 +392,7 @@ evdev_libinput_context(const struct evdev_device *device)
static inline bool
evdev_device_has_model_quirk(struct evdev_device *device, enum quirk model_quirk)
{
assert(quirk_get_name(model_quirk) != NULL);
_unref_(quirks) *q = libinput_device_get_quirks(&device->base);
bool result = false;
if (q)
quirks_get_bool(q, model_quirk, &result);
return result;
return libinput_device_has_model_quirk(&device->base, model_quirk);
}
void

View file

@ -44,6 +44,7 @@
#include "libinput-version.h"
#include "libinput.h"
#include "linux/input.h"
#include "quirks.h"
struct libinput_source;
@ -720,6 +721,9 @@ libinput_seat_init(struct libinput_seat *seat,
void
libinput_device_init(struct libinput_device *device, struct libinput_seat *seat);
bool
libinput_device_has_model_quirk(struct libinput_device *device, enum quirk model_quirk);
struct libinput_device_group *
libinput_device_group_create(struct libinput *libinput, const char *identifier);

View file

@ -2230,6 +2230,20 @@ libinput_device_remove_event_listener(struct libinput_event_listener *listener)
list_remove(&listener->link);
}
bool
libinput_device_has_model_quirk(struct libinput_device *device, enum quirk model_quirk)
{
assert(quirk_get_name(model_quirk) != NULL);
_unref_(quirks) *q = libinput_device_get_quirks(device);
bool result = false;
if (q)
quirks_get_bool(q, model_quirk, &result);
return result;
}
static uint32_t
update_seat_key_count(struct libinput_seat *seat,
keycode_t keycode,