summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>2014-05-16 21:32:10 +0200
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>2014-05-28 19:52:59 +0900
commit2163411de835dc931bd5bc34677663af49906c92 (patch)
tree00f37dcb95d56076ef2cdeb3e0618456c531f6ce
parente41625f37d8810861080b512a245ea1d3910216a (diff)
downloadweston-2163411de835dc931bd5bc34677663af49906c92.tar.gz
added surface content observer to ivi-layout
this is used by other weston modules, that are interested in content state of surfaces. Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
-rw-r--r--ivi-shell/ivi-layout-export.h15
-rw-r--r--ivi-shell/ivi-layout.c31
2 files changed, 45 insertions, 1 deletions
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 9784cf3e..016c4396 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -146,6 +146,10 @@ typedef void(*surfaceRemoveNotificationFunc)(struct ivi_layout_surface *ivisurf,
typedef void(*surfaceConfigureNotificationFunc)(struct ivi_layout_surface *ivisurf,
void *userdata);
+typedef void(*ivi_controller_surface_content_callback)(struct ivi_layout_surface *ivisurf,
+ int32_t content,
+ void *userdata);
+
/**
* \brief to be called by ivi-shell in order to set initail view of
* weston_surface.
@@ -326,6 +330,17 @@ ivi_layout_surfaceSetNativeContent(struct weston_surface *wl_surface,
*/
/**
+ * \brief Set an observer callback for surface content status change.
+ *
+ * \return 0 if the method call was successful
+ * \return -1 if the method call was failed
+ */
+int32_t
+ivi_layout_surfaceSetContentObserver(struct ivi_layout_surface *ivisurf,
+ ivi_controller_surface_content_callback callback,
+ void* userdata);
+
+/**
* \brief initialize ivi_layout_surface dest/source width and height
*/
/*
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 41b2b3bb..ae947c65 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -163,6 +163,11 @@ struct ivi_layout_surface {
struct wl_list link;
struct wl_list list_layer;
} order;
+
+ struct {
+ ivi_controller_surface_content_callback callback;
+ void* userdata;
+ } content_observer;
};
struct ivi_layout_layer {
@@ -2631,8 +2636,13 @@ ivi_layout_surfaceSetNativeContent(struct weston_surface *surface,
ivisurf->view = NULL;
}
- if (surface == NULL)
+ if (surface == NULL) {
+ if (ivisurf->content_observer.callback) {
+ (*(ivisurf->content_observer.callback))(ivisurf,
+ 0, ivisurf->content_observer.userdata);
+ }
return 0;
+ }
ivisurf->surface = surface;
ivisurf->surface_destroy_listener.notify =
@@ -2656,9 +2666,28 @@ ivi_layout_surfaceSetNativeContent(struct weston_surface *surface,
}
}
+ if (ivisurf->content_observer.callback) {
+ (*(ivisurf->content_observer.callback))(ivisurf,
+ 1, ivisurf->content_observer.userdata);
+ }
+
return 0;
}
+WL_EXPORT int32_t
+ivi_layout_surfaceSetContentObserver(struct ivi_layout_surface *ivisurf,
+ ivi_controller_surface_content_callback callback,
+ void* userdata)
+{
+ int32_t ret = -1;
+ if (ivisurf != NULL) {
+ ivisurf->content_observer.callback = callback;
+ ivisurf->content_observer.userdata = userdata;
+ ret = 0;
+ }
+ return ret;
+}
+
static struct ivi_layout_surface*
ivi_layout_surfaceCreate(struct weston_surface *wl_surface,
uint32_t id_surface)