ivi-shell: rework configure_surface notification
The add_notification_configure_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_configure_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_configure_surface
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index b27f87b..97f78af 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -129,6 +129,7 @@
struct wl_listener surface_created;
struct wl_listener surface_removed;
+ struct wl_listener surface_configured;
struct wl_client *user_interface;
struct ui_setting ui_setting;
@@ -612,10 +613,12 @@
}
static void
-set_notification_configure_surface(struct ivi_layout_surface *ivisurf,
- void *userdata)
+set_notification_configure_surface(struct wl_listener *listener, void *data)
{
- struct hmi_controller *hmi_ctrl = userdata;
+ struct hmi_controller *hmi_ctrl =
+ wl_container_of(listener, hmi_ctrl,
+ surface_configured);
+ struct ivi_layout_surface *ivisurf = data;
struct hmi_controller_layer *layer_link = NULL;
struct ivi_layout_layer *application_layer = NULL;
struct weston_surface *surface;
@@ -846,8 +849,9 @@
hmi_ctrl->surface_removed.notify = set_notification_remove_surface;
ivi_layout_interface->add_listener_remove_surface(&hmi_ctrl->surface_removed);
- ivi_layout_interface->add_notification_configure_surface(
- set_notification_configure_surface, hmi_ctrl);
+
+ hmi_ctrl->surface_configured.notify = set_notification_configure_surface;
+ ivi_layout_interface->add_listener_configure_surface(&hmi_ctrl->surface_configured);
hmi_ctrl->destroy_listener.notify = hmi_controller_destroy;
wl_signal_add(&hmi_ctrl->compositor->destroy_signal,