From 8afe0a7a6ccee6352d6f67b89a616f189cb0284e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 12 May 2017 12:08:32 -0400 Subject: [PATCH] ecore-wl2: store names for inputs and add api for retrieving name @feature --- src/lib/ecore_wl2/Ecore_Wl2.h | 8 ++++++++ src/lib/ecore_wl2/ecore_wl2_input.c | 9 +++++++++ src/lib/ecore_wl2/ecore_wl2_private.h | 1 + 3 files changed, 18 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index e51c7a2..e607f7f 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -944,6 +944,14 @@ EAPI Ecore_Wl2_Seat_Capabilities ecore_wl2_input_seat_capabilities_get(Ecore_Wl2 EAPI unsigned int ecore_wl2_input_seat_id_get(Ecore_Wl2_Input *input); /** + * Get the name of an input + * @param input The input + * @return The name + * @since 1.20 + */ +EAPI Eina_Stringshare *ecore_wl2_input_name_get(Ecore_Wl2_Input *input); + +/** * @defgroup Ecore_Wl2_Dnd_Group Wayland Library Drag-n-Drop Functions * @ingroup Ecore_Wl2_Group * diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index b95fbd6..29b53a9 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -1281,6 +1281,7 @@ _seat_cb_name(void *data, struct wl_seat *seat EINA_UNUSED, const char *name) Ecore_Wl2_Input *input; input = data; + eina_stringshare_replace(&input->name, name); ev = calloc(1, sizeof(Ecore_Wl2_Event_Seat_Name)); EINA_SAFETY_ON_NULL_RETURN(ev); @@ -1518,6 +1519,7 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input) EINA_INLIST_FOREACH(display->windows, window) if (window->input == input) window->input = NULL; + eina_stringshare_replace(&input->name, NULL); free(input); } @@ -1593,6 +1595,13 @@ ecore_wl2_input_seat_capabilities_get(Ecore_Wl2_Input *input) return cap; } +EAPI Eina_Stringshare * +ecore_wl2_input_name_get(Ecore_Wl2_Input *input) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(input, NULL); + return input->name; +} + EAPI unsigned int ecore_wl2_input_seat_id_get(Ecore_Wl2_Input *input) { diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 90fa3a5..4e420b5 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -419,6 +419,7 @@ struct _Ecore_Wl2_Input unsigned int seat_version; unsigned int id; + Eina_Stringshare *name; Ecore_Event_Handler *dev_add_handler; Ecore_Event_Handler *dev_remove_handler; -- 2.7.4