diff options
author | Ucan, Emre (ADITG/SW1) <eucan@de.adit-jv.com> | 2016-04-04 08:05:18 +0000 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-04-05 11:53:48 +0300 |
commit | 67f0aa87674c573fbf68a1aaa1e0b75a2f4c7c62 (patch) | |
tree | 77ff8818ddd5b843a23686fd4a6d1fcda337813f /ivi-shell/hmi-controller.c | |
parent | 562f2ecb0cb49aba1c26b3c01d406752165c279e (diff) | |
download | weston-67f0aa87674c573fbf68a1aaa1e0b75a2f4c7c62.tar.gz |
ivi-shell: rework remove_surface notification
The add_notification_remove_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to add_listener_remove_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_remove_surface
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'ivi-shell/hmi-controller.c')
-rw-r--r-- | ivi-shell/hmi-controller.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c index b6716f3f..b27f87b2 100644 --- a/ivi-shell/hmi-controller.c +++ b/ivi-shell/hmi-controller.c @@ -128,6 +128,7 @@ struct hmi_controller { struct wl_listener destroy_listener; struct wl_listener surface_created; + struct wl_listener surface_removed; struct wl_client *user_interface; struct ui_setting ui_setting; @@ -600,10 +601,12 @@ set_notification_create_surface(struct wl_listener *listener, void *data) } static void -set_notification_remove_surface(struct ivi_layout_surface *ivisurf, - void *userdata) +set_notification_remove_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_removed); + (void)data; switch_mode(hmi_ctrl, hmi_ctrl->layout_mode); } @@ -840,8 +843,9 @@ hmi_controller_create(struct weston_compositor *ec) hmi_ctrl->surface_created.notify = set_notification_create_surface; ivi_layout_interface->add_listener_create_surface(&hmi_ctrl->surface_created); - ivi_layout_interface->add_notification_remove_surface( - set_notification_remove_surface, hmi_ctrl); + + 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); |