static int init_control(void);
static struct ilm_control_context* sync_and_acquire_instance(void);
+static struct surface_context* get_surface_context(struct wayland_context *, uint32_t);
static void release_instance(void);
{
struct wayland_context *ctx = data;
struct surface_context *ctx_surf = NULL;
- int32_t is_inside = 0;
-
- is_inside = wayland_controller_is_inside_surface_list(
- &ctx->list_surface, id_surface);
- if (is_inside != 0) {
+ ctx_surf = get_surface_context(ctx, id_surface);
+ if (ctx_surf != NULL) {
+ if (ctx_surf-> notification != NULL) {
+ ctx_surf->notification(ctx_surf->id_surface,
+ &ctx_surf->prop,
+ ILM_NOTIFICATION_ALL);
+ }
fprintf(stderr, "invalid id_surface in controller_listener_surface\n");
return;
}
ctx_surf = (struct surface_context*)get_surface_context(
&ctx->wl, (uint32_t)surface);
if (ctx_surf == NULL) {
+ controller_listener_surface(ctx, ctx->wl.controller, (uint32_t)surface);
+ ctx_surf = (struct surface_context*)get_surface_context(
+ &ctx->wl, (uint32_t)surface);
+ }
+
+ if (ctx_surf == NULL) {
returnValue = ILM_ERROR_INVALID_ARGUMENTS;
- } else {
+ }
+ else {
ctx_surf->notification = callback;
returnValue = ILM_SUCCESS;
returnValue = ILM_SUCCESS;
}
- if ((ctx_surf != NULL) && (ctx_surf->notification != NULL)) {
- ctx_surf->notification = NULL;
- returnValue = ILM_SUCCESS;
- }
-
release_instance();
return returnValue;
}