From 047118c6e24da8bc0581fa3cf206a5d9c7413d06 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 17 May 2017 16:02:53 -0400 Subject: [PATCH] ecore-wl2: add ecore_wl2_display_input_find() for finding seat using hw id @feature --- src/lib/ecore_wl2/Ecore_Wl2.h | 9 +++++++++ src/lib/ecore_wl2/ecore_wl2_display.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index dc5d12cc37..26ebb2c57d 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -521,6 +521,15 @@ EAPI void ecore_wl2_display_screen_size_get(Ecore_Wl2_Display *display, int *w, */ EAPI Eina_Iterator *ecore_wl2_display_inputs_get(Ecore_Wl2_Display *display); +/** + * Find a seat for a given display object using the seat id + * @param display The display + * @param id The seat id + * @return The corresponding Ecore_Wl2_Input object or @c NULL if no match is found + * @since 1.20 + */ +EAPI Ecore_Wl2_Input *ecore_wl2_display_input_find(const Ecore_Wl2_Display *display, unsigned int id); + /** * Find an Ecore_Wl2_Window based on id * diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index ff7506fe96..e6c60fa03e 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -962,6 +962,18 @@ ecore_wl2_display_inputs_get(Ecore_Wl2_Display *display) return eina_inlist_iterator_new(display->inputs); } +EAPI Ecore_Wl2_Input * +ecore_wl2_display_input_find(const Ecore_Wl2_Display *display, unsigned int id) +{ + Ecore_Wl2_Input *input; + + EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(display->pid, NULL); + EINA_INLIST_FOREACH(display->inputs, input) + if (input->id == id) return input; + return NULL; +} + EAPI Eina_Bool ecore_wl2_display_sync_is_done(const Ecore_Wl2_Display *display) {