diff options
author | Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com> | 2020-07-08 07:33:40 +0200 |
---|---|---|
committer | Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com> | 2020-07-08 07:33:40 +0200 |
commit | efeaedd6b9e363cec82bf72617bf35269374b7ef (patch) | |
tree | 2d1bf79bcb0892ac93f15ea3e30c259430a7ac5e /ivi-layermanagement-examples | |
parent | cc70d5349a190ef73c5b1b4ad4caf2bf6e39dc8c (diff) | |
download | wayland-ivi-extension-efeaedd6b9e363cec82bf72617bf35269374b7ef.tar.gz |
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 <KarammelJayakumar.Rajendraprasad@in.bosch.com>
Diffstat (limited to 'ivi-layermanagement-examples')
-rw-r--r-- | ivi-layermanagement-examples/layer-add-surfaces/src/layer-add-surfaces.c | 31 |
1 files changed, 31 insertions, 0 deletions
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); |