backends/kms/update: Add ability to remove result listeners

We may need to remove a result listener once we've added it, and before
that it ha been processed, so add support for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
This commit is contained in:
Marco Trevisan (Treviño) 2021-10-05 22:21:31 +02:00 committed by Marge Bot
parent fd1f6094c9
commit 4b0a10c562
2 changed files with 26 additions and 0 deletions

View File

@ -539,6 +539,28 @@ meta_kms_update_add_result_listener (MetaKmsUpdate *update,
listener); listener);
} }
void
meta_kms_update_remove_result_listeners (MetaKmsUpdate *update,
MetaKmsResultListenerFunc func,
gpointer user_data)
{
GList *l;
for (l = update->result_listeners; l;)
{
MetaKmsResultListener *listener = l->data;
GList *next = l->next;
if (listener->user_data == func && listener->user_data == user_data)
{
update->result_listeners =
g_list_delete_link (update->result_listeners, l);
}
l = next;
}
}
GList * GList *
meta_kms_update_take_result_listeners (MetaKmsUpdate *update) meta_kms_update_take_result_listeners (MetaKmsUpdate *update)
{ {

View File

@ -150,6 +150,10 @@ void meta_kms_update_add_result_listener (MetaKmsUpdate *update,
MetaKmsResultListenerFunc func, MetaKmsResultListenerFunc func,
gpointer user_data); gpointer user_data);
void meta_kms_update_remove_result_listeners (MetaKmsUpdate *update,
MetaKmsResultListenerFunc func,
gpointer user_data);
static inline MetaFixed16 static inline MetaFixed16
meta_fixed_16_from_int (int16_t d) meta_fixed_16_from_int (int16_t d)
{ {