ivi-shell: rework create_layer_notification
The add_notification_layer_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_layer_surface.
This change has several advantages:
1. Code cleanup
2. No dynamic memory allocation. Listeners are allocated
by controller plugins
3. Remove API is not needed. Controller plugins can easily
remove the listener link.
The remove API is removed too:
- ivi_layout_remove_notification_create_layer
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 2ea43bb..c2a8c10 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -138,10 +138,6 @@
IVI_LAYOUT_TRANSITION_MAX,
};
-typedef void (*layer_create_notification_func)(
- struct ivi_layout_layer *ivilayer,
- void *userdata);
-
typedef void (*layer_remove_notification_func)(
struct ivi_layout_layer *ivilayer,
void *userdata);
@@ -339,15 +335,14 @@
*/
/**
- * \brief register/unregister for notification when ivi_layer is created
+ * \brief add a listener for notification when ivi_layer is created
+ *
+ * When an ivi_layer is created, a signal is emitted
+ * to the listening controller plugins.
+ * The pointer of the created ivi_layer is sent as the void *data argument
+ * to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_notification_create_layer)(
- layer_create_notification_func callback,
- void *userdata);
-
- void (*remove_notification_create_layer)(
- layer_create_notification_func callback,
- void *userdata);
+ int32_t (*add_listener_create_layer)(struct wl_listener *listener);
/**
* \brief register/unregister for notification when ivi_layer is removed