From 3e42349daafcb3334c59a9c0c5b4c47a13257889 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Sun, 5 Mar 2023 13:26:27 +0300 Subject: [PATCH] libratbag: add API for checking if profile is dirty --- src/libratbag.c | 6 ++++++ src/libratbag.h | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/libratbag.c b/src/libratbag.c index 3c6f4c7e..1ee7d421 100644 --- a/src/libratbag.c +++ b/src/libratbag.c @@ -825,6 +825,12 @@ ratbag_profile_is_active(struct ratbag_profile *profile) return !!profile->is_active; } +LIBRATBAG_EXPORT bool +ratbag_profile_is_dirty(const struct ratbag_profile *profile) +{ + return !!profile->dirty; +} + LIBRATBAG_EXPORT bool ratbag_profile_is_enabled(const struct ratbag_profile *profile) { diff --git a/src/libratbag.h b/src/libratbag.h index 08566380..53cf5316 100644 --- a/src/libratbag.h +++ b/src/libratbag.h @@ -702,6 +702,19 @@ ratbag_device_get_profile(struct ratbag_device *device, unsigned int index); bool ratbag_profile_is_active(struct ratbag_profile *profile); +/** + * @ingroup profile + * + * Check if the given profile is dirty, that is, the device needs committing + * after having configuration changes. + * + * @param profile A previously initialized ratbag profile + * + * @return non-zero if the profile is dirty, zero otherwise + */ +bool +ratbag_profile_is_dirty(const struct ratbag_profile *profile); + /** * @ingroup profile *