[PATCH 08/13] ivi-shell: add new method to remove a callback to get notification of ivi_surface property changes.

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Sun Jun 21 23:31:26 PDT 2015


From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

To get property changes of ivi_surface, callbacks can be registered.
However there was no API to remove a callback rather than remove all
callbacks by using surface_remove_notification.
surface_remove_notification_by_callback can do it.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
Acked-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 ivi-shell/ivi-layout-export.h |  7 +++++++
 ivi-shell/ivi-layout.c        | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 53c4b44..ed8db9d 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -783,6 +783,13 @@ struct ivi_controller_interface {
 				int32_t x, int32_t y,
 				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);
+
 };
 
 #ifdef __cplusplus
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index d7108b6..6dc5723 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -111,6 +111,9 @@ struct ivi_layout_notification_callback {
 	void *data;
 };
 
+static void
+remove_notification(struct wl_list *listener_list, void *callback, void *userdata);
+
 static struct ivi_layout ivilayout = {0};
 
 struct ivi_layout *
@@ -319,6 +322,19 @@ ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf)
 	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
  */
@@ -2964,6 +2980,11 @@ static struct ivi_controller_interface ivi_controller_interface = {
 	 */
 	.surface_get_size		= ivi_layout_surface_get_size,
 	.surface_dump			= ivi_layout_surface_dump,
+
+	/**
+	 * remove notification by callback on property changes of ivi_surface
+	 */
+	.surface_remove_notification_by_callback	= ivi_layout_surface_remove_notification_by_callback
 };
 
 int
-- 
1.8.3.1



More information about the wayland-devel mailing list