From efeaedd6b9e363cec82bf72617bf35269374b7ef Mon Sep 17 00:00:00 2001 From: Rajendraprasad K J Date: Wed, 8 Jul 2020 07:33:40 +0200 Subject: layer-add-surfaces: Register for ilm shutdown notification Register for ilm shutdown notification so that we would be notified when some unrecoverable error occurs in ilmControl. Signed-off-by: Rajendraprasad K J --- .../layer-add-surfaces/src/layer-add-surfaces.c | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ivi-layermanagement-examples/layer-add-surfaces/src/layer-add-surfaces.c b/ivi-layermanagement-examples/layer-add-surfaces/src/layer-add-surfaces.c index 5a31fa3..a271da2 100644 --- a/ivi-layermanagement-examples/layer-add-surfaces/src/layer-add-surfaces.c +++ b/ivi-layermanagement-examples/layer-add-surfaces/src/layer-add-surfaces.c @@ -96,6 +96,35 @@ static void callbackFunction(ilmObjectType object, t_ilm_uint id, t_ilm_bool cre } } +static void shutdownCallbackFunction(t_ilm_shutdown_error_type error_type, + int errornum, + void *user_data) +{ + (void) user_data; + + switch (error_type) { + case ILM_ERROR_WAYLAND: + { + printf("layer-add-surfaces: exit, ilm shutdown due to wayland error: %s\n", + strerror(errornum)); + break; + } + case ILM_ERROR_POLL: + { + printf("layer-add-surfaces: exit, ilm shutdown due to poll error: %s\n", + strerror(errornum)); + break; + } + default: + { + printf("layer-add-surfaces: exit, ilm shutdown due to unknown reason: %s\n", + strerror(errornum)); + } + } + + exit(1); +} + /* Choose the display with the largest resolution.*/ static t_ilm_uint choose_screen(void) { @@ -235,6 +264,8 @@ int main (int argc, char *argv[]) return -1; } + ilm_registerShutdownNotification(shutdownCallbackFunction, NULL); + screen_ID = choose_screen(); ilm_layerCreateWithDimension(&layer, screenWidth, screenHeight); printf("layer-add-surfaces: layer (%d) destination region: x:0 y:0 w:%u h:%u\n", layer, screenWidth, screenHeight); -- cgit v1.2.1