summaryrefslogtreecommitdiff
path: root/ivi-shell
diff options
context:
space:
mode:
Diffstat (limited to 'ivi-shell')
-rw-r--r--ivi-shell/ivi-layout-export.h30
-rw-r--r--ivi-shell/ivi-layout.c80
2 files changed, 14 insertions, 96 deletions
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index b6ece2ca..05f3668f 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -144,12 +144,6 @@ typedef void (*layer_property_notification_func)(
enum ivi_layout_notification_mask mask,
void *userdata);
-typedef void (*surface_property_notification_func)(
- struct ivi_layout_surface *ivisurf,
- const struct ivi_layout_surface_properties *,
- enum ivi_layout_notification_mask mask,
- void *userdata);
-
typedef void (*layer_create_notification_func)(
struct ivi_layout_layer *ivilayer,
void *userdata);
@@ -318,19 +312,18 @@ struct ivi_layout_interface {
enum wl_output_transform orientation);
/**
- * \brief register for notification on property changes of ivi_surface
+ * \brief add a listener to listen property changes of ivi_surface
+ *
+ * When a property of the ivi_surface is changed, the property_changed
+ * signal is emitted to the listening controller plugins.
+ * The pointer of the ivi_surface is sent as the void *data argument
+ * to the wl_listener::notify callback function of the listener.
*
* \return IVI_SUCCEEDED if the method call was successful
* \return IVI_FAILED if the method call was failed
*/
- int32_t (*surface_add_notification)(struct ivi_layout_surface *ivisurf,
- surface_property_notification_func callback,
- void *userdata);
-
- /**
- * \brief remove notification on property changes of ivi_surface
- */
- void (*surface_remove_notification)(struct ivi_layout_surface *ivisurf);
+ int32_t (*surface_add_listener)(struct ivi_layout_surface *ivisurf,
+ struct wl_listener *listener);
/**
* \brief get weston_surface of ivi_surface
@@ -605,13 +598,6 @@ struct ivi_layout_interface {
int32_t width, int32_t height);
/**
- * remove notification by callback on property changes of ivi_surface
- */
- void (*surface_remove_notification_by_callback)(struct ivi_layout_surface *ivisurf,
- surface_property_notification_func callback,
- void *userdata);
-
- /**
* \brief remove notification by callback on property changes of ivi_layer
*/
void (*layer_remove_notification_by_callback)(struct ivi_layout_layer *ivilayer,
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 5c0e8f4f..013e0968 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -201,30 +201,6 @@ remove_all_notification(struct wl_list *listener_list)
}
}
-static void
-ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf)
-{
- if (ivisurf == NULL) {
- weston_log("ivi_layout_surface_remove_notification: invalid argument\n");
- return;
- }
-
- remove_all_notification(&ivisurf->property_changed.listener_list);
-}
-
-static void
-ivi_layout_surface_remove_notification_by_callback(struct ivi_layout_surface *ivisurf,
- surface_property_notification_func callback,
- void *userdata)
-{
- if (ivisurf == NULL) {
- weston_log("ivi_layout_surface_remove_notification_by_callback: invalid argument\n");
- return;
- }
-
- remove_notification(&ivisurf->property_changed.listener_list, callback, userdata);
-}
-
/**
* Called at destruction of wl_surface/ivi_surface
*/
@@ -247,8 +223,6 @@ ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
ivi_layout_remove_all_surface_transitions(ivisurf);
- ivi_layout_surface_remove_notification(ivisurf);
-
free(ivisurf);
}
@@ -1062,23 +1036,6 @@ surface_removed(struct wl_listener *listener, void *data)
}
static void
-surface_prop_changed(struct wl_listener *listener, void *data)
-{
- struct ivi_layout_surface *ivisurf = data;
-
- struct listener_layout_notification *layout_listener =
- container_of(listener,
- struct listener_layout_notification,
- listener);
-
- struct ivi_layout_notification_callback *prop_callback =
- layout_listener->userdata;
-
- ((surface_property_notification_func)prop_callback->callback)
- (ivisurf, &ivisurf->prop, ivisurf->prop.event_mask, prop_callback->data);
-}
-
-static void
surface_configure_changed(struct wl_listener *listener,
void *data)
{
@@ -1360,38 +1317,15 @@ ivi_layout_get_surface_from_id(uint32_t id_surface)
}
static int32_t
-ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf,
- surface_property_notification_func callback,
- void *userdata)
+ivi_layout_surface_add_listener(struct ivi_layout_surface *ivisurf,
+ struct wl_listener *listener)
{
- struct listener_layout_notification* notification = NULL;
- struct ivi_layout_notification_callback *prop_callback = NULL;
-
- if (ivisurf == NULL || callback == NULL) {
- weston_log("ivi_layout_surface_add_notification: invalid argument\n");
- return IVI_FAILED;
- }
-
- notification = malloc(sizeof *notification);
- if (notification == NULL) {
- weston_log("fails to allocate memory\n");
- return IVI_FAILED;
- }
-
- prop_callback = malloc(sizeof *prop_callback);
- if (prop_callback == NULL) {
- weston_log("fails to allocate memory\n");
- free(notification);
+ if (ivisurf == NULL || listener == NULL) {
+ weston_log("ivi_layout_surface_add_listener: invalid argument\n");
return IVI_FAILED;
}
- prop_callback->callback = callback;
- prop_callback->data = userdata;
-
- notification->listener.notify = surface_prop_changed;
- notification->userdata = prop_callback;
-
- wl_signal_add(&ivisurf->property_changed, &notification->listener);
+ wl_signal_add(&ivisurf->property_changed, listener);
return IVI_SUCCEEDED;
}
@@ -2386,8 +2320,7 @@ static struct ivi_layout_interface ivi_layout_interface = {
.surface_set_source_rectangle = ivi_layout_surface_set_source_rectangle,
.surface_set_destination_rectangle = ivi_layout_surface_set_destination_rectangle,
.surface_set_orientation = ivi_layout_surface_set_orientation,
- .surface_add_notification = ivi_layout_surface_add_notification,
- .surface_remove_notification = ivi_layout_surface_remove_notification,
+ .surface_add_listener = ivi_layout_surface_add_listener,
.surface_get_weston_surface = ivi_layout_surface_get_weston_surface,
.surface_set_transition = ivi_layout_surface_set_transition,
.surface_set_transition_duration = ivi_layout_surface_set_transition_duration,
@@ -2441,7 +2374,6 @@ static struct ivi_layout_interface ivi_layout_interface = {
/**
* remove notification by callback on property changes of ivi_surface/layer
*/
- .surface_remove_notification_by_callback = ivi_layout_surface_remove_notification_by_callback,
.layer_remove_notification_by_callback = ivi_layout_layer_remove_notification_by_callback
};