diff options
author | Ucan, Emre (ADITG/SW1) <eucan@de.adit-jv.com> | 2016-04-04 08:05:09 +0000 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2016-04-05 11:53:48 +0300 |
commit | 970f831588cf7248430cd10cd1d1774586d202ef (patch) | |
tree | 449e949613049423b18c3b7187697ea0aced0f52 /tests | |
parent | 3750d1b270135cf5b1482034aff2bed9999848c6 (diff) | |
download | weston-970f831588cf7248430cd10cd1d1774586d202ef.tar.gz |
ivi-shell: rework create_surface notification
The add_notification_create_surface API accepts a simple
wl_listener instead of a ivi-shell specific notification
function. Therefore, the API is renamed to
add_listener_create_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_surface
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ivi_layout-internal-test.c | 2 | ||||
-rw-r--r-- | tests/ivi_layout-test-plugin.c | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/ivi_layout-internal-test.c b/tests/ivi_layout-internal-test.c index ed78754a..db318ad2 100644 --- a/tests/ivi_layout-internal-test.c +++ b/tests/ivi_layout-internal-test.c @@ -848,7 +848,7 @@ test_surface_bad_create_notification(struct test_context *ctx) { const struct ivi_layout_interface *lyt = ctx->layout_interface; - iassert(lyt->add_notification_create_surface(NULL, NULL) == IVI_FAILED); + iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED); } static void diff --git a/tests/ivi_layout-test-plugin.c b/tests/ivi_layout-test-plugin.c index aaba7246..37e5cc7f 100644 --- a/tests/ivi_layout-test-plugin.c +++ b/tests/ivi_layout-test-plugin.c @@ -85,6 +85,7 @@ struct test_context { uint32_t user_flags; struct wl_listener surface_property_changed; + struct wl_listener surface_created; }; static struct test_context static_context; @@ -912,11 +913,13 @@ RUNNER_TEST(surface_configure_notification_p3) } static void -test_surface_create_notification_callback(struct ivi_layout_surface *ivisurf, - void *userdata) +test_surface_create_notification_callback(struct wl_listener *listener, void *data) { - struct test_context *ctx = userdata; + struct test_context *ctx = + container_of(listener, struct test_context, + surface_created); const struct ivi_layout_interface *lyt = ctx->layout_interface; + struct ivi_layout_surface *ivisurf = data; runner_assert_or_return(lyt->get_id_of_surface(ivisurf) == IVI_TEST_SURFACE_ID(0)); @@ -927,20 +930,19 @@ RUNNER_TEST(surface_create_notification_p1) { const struct ivi_layout_interface *lyt = ctx->layout_interface; - runner_assert(lyt->add_notification_create_surface( - test_surface_create_notification_callback, ctx) == IVI_SUCCEEDED); + ctx->surface_created.notify = test_surface_create_notification_callback; + runner_assert(lyt->add_listener_create_surface( + &ctx->surface_created) == IVI_SUCCEEDED); ctx->user_flags = 0; } RUNNER_TEST(surface_create_notification_p2) { - const struct ivi_layout_interface *lyt = ctx->layout_interface; - runner_assert(ctx->user_flags == 1); - lyt->remove_notification_create_surface( - test_surface_create_notification_callback, ctx); + // remove surface created listener. + wl_list_remove(&ctx->surface_created.link); ctx->user_flags = 0; } |