extensions: Add tizen_policy extension for supporting tizen_visibility. 86/69186/1
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 11 May 2016 13:11:54 +0000 (22:11 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Thu, 12 May 2016 05:51:15 +0000 (14:51 +0900)
Added API 'pepper_efl_object_visibility_set' to set the visibility given object.

Change-Id: I415e5209ef8b49c4780af0599379de2e8e6fed4e

configure.ac
src/examples/Makefile.am
src/lib/Makefile.am
src/lib/Pepper_Efl.h
src/lib/compositor.c
src/lib/extensions/tizen_policy.c [new file with mode: 0644]
src/lib/extensions/tizen_policy.h [new file with mode: 0644]
src/lib/object.c
src/lib/object.h
src/lib/private.h

index ba7e23983373c871ddf87039af36e5e255daf5eb..2c7371389973d5240ad70d32bb37cc177e983a71 100644 (file)
@@ -6,7 +6,7 @@ AC_INIT([libpepper-efl], [0.0.1], [shiin.lee@samsung.com])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_HEADERS([config.h])
 
-AM_INIT_AUTOMAKE(1.6)
+AM_INIT_AUTOMAKE(1.6 subdir-objects)
 
 # Checks for programs.
 AC_PROG_CC
index 026081ecdb3fcfcfdc21263daf185cd4bb0cf72c..5fe5987c6e72b9ef7140a0ce2cc2938b015dc61c 100644 (file)
@@ -6,6 +6,13 @@ EXTRA_DIST = $(datafiles_DATA)
 widgets_bindir = $(libexecdir)/libpepper-efl/samples
 widgets_bin_PROGRAMS = touch_sample thread_sample entry_sample
 
+AM_CPPFLAGS =                                \
+       -I$(top_builddir)/src/lib/           \
+       -I$(top_builddir)/src/lib/extensions \
+        -DDATA_PATH=\"$(datafilesdir)\"      \
+        -DSAMPLE_PATH=\"$(widgets_bindir)\"  \
+        @ELEMENTARY_CFLAGS@
+
 touch_sample_SOURCES = touch_sample.c
 touch_sample_CFLAGS = @ELEMENTARY_CFLAGS@
 touch_sample_LDADD = @ELEMENTARY_LIBS@
@@ -22,21 +29,13 @@ entry_sample_LDADD = @ELEMENTARY_LIBS@
 bin_PROGRAMS = pepper_efl_example pepper_efl_simple
 
 pepper_efl_example_SOURCES = pepper_efl_example.c
-pepper_efl_example_CFLAGS =                            \
-       -I$(top_builddir)/src/lib/                      \
-        -DDATA_PATH=\"$(datafilesdir)\"                 \
-        -DSAMPLE_PATH=\"$(widgets_bindir)\"             \
-        @ELEMENTARY_CFLAGS@
+pepper_efl_example_CFLAGS = $(AM_CPPFLAGS)
 pepper_efl_example_LDADD =                             \
        $(top_builddir)/src/lib/libpepper-efl.la        \
        @ELEMENTARY_LIBS@
 
 pepper_efl_simple_SOURCES = pepper_efl_simple.c
-pepper_efl_simple_CFLAGS =                             \
-       -I$(top_builddir)/src/lib/                      \
-        -DDATA_PATH=\"$(datafilesdir)\"                 \
-        -DSAMPLE_PATH=\"$(widgets_bindir)\"             \
-        @ELEMENTARY_CFLAGS@
+pepper_efl_simple_CFLAGS = $(AM_CPPFLAGS)
 pepper_efl_simple_LDADD =                              \
        $(top_builddir)/src/lib/libpepper-efl.la        \
        @ELEMENTARY_LIBS@
index f6392ee2ae94dc915dc58d285272dbe6fa8a9b0a..8d60500c5bdf23d6c59a38e37c556f874ff7b3f8 100644 (file)
@@ -1,7 +1,11 @@
+AM_CPPFLAGS =              \
+         -I./extensions
+
 libpepper_efl_la_LTLIBRARIES = libpepper-efl.la
 libpepper_efl_ladir = $(libdir)
 libpepper_efl_la_LIBADD = @EFL_LIBS@ @WAYLAND_LIBS@ @PEPPER_LIBS@ @WAYLAND_TBM_LIBS@
 libpepper_efl_la_LDFLAGS = ${LDFLAGS}
+libpepper_efl_la_CPPFLAGS = $(AM_CPPFLAGS)
 libpepper_efl_la_CFLAGS = \
     ${CFLAGS} \
     @EFL_CFLAGS@ \
@@ -10,14 +14,20 @@ libpepper_efl_la_CFLAGS = \
     @WAYLAND_TBM_CFLAGS@ \
     -I$(top_srcdir)/src
 
+EXT_SOURCES =              \
+extensions/tizen_policy.h  \
+extensions/tizen_policy.c
+
 libpepper_efl_la_SOURCES = \
-compositor.c           \
-log.c                  \
-output.c               \
-shell.c                        \
-input.c                        \
-object.c
+compositor.c              \
+log.c                     \
+output.c                  \
+shell.c                           \
+input.c                           \
+object.c                   \
+$(EXT_SOURCES)
 
 libpeppereflincludedir = $(includedir)/pepper-efl
 libpeppereflinclude_HEADERS = \
-Pepper_Efl.h
+Pepper_Efl.h \
+extensions/tizen_policy.h
index ea2842432952622d02c354ad89d956dfa257e0ee..cb01e857a9f0b0e2f450392fef59ecafa9a7100c 100644 (file)
@@ -18,7 +18,6 @@ extern "C" {
 #define PEPPER_EFL_OBJ_ADD "add.object"
 #define PEPPER_EFL_OBJ_DEL "del.object"
 
-
 /**
  * @brief Creates the embedding compositor.
  * @since_tizen 3.0
@@ -68,6 +67,8 @@ const char *pepper_efl_object_app_id_get(Evas_Object *obj);
 
 Eina_Bool   pepper_efl_object_touch_cancel(Evas_Object *obj);
 
+#include "tizen_policy.h"
+
 #ifdef __cplusplus
 }
 #endif
index c1de5f7e8c628562bc7fbea0eaf129ef06383ef1..8d6e5c309625047513ec84d8c1b9aed17d3aa9b8 100644 (file)
@@ -168,6 +168,7 @@ pepper_efl_compositor_destroy(const char *name)
    _pepper_efl_compositor_output_all_del(comp);
 
    pepper_efl_shell_shutdown();
+   tizen_policy_shutdown();
 
    PE_FREE_FUNC(comp->input, pepper_efl_input_destroy);
    PE_FREE_FUNC(comp->name, eina_stringshare_del);
@@ -256,6 +257,12 @@ pepper_efl_compositor_create(Evas_Object *win, const char *name)
         goto err_shell;
      }
 
+   if (!tizen_policy_init(comp))
+     {
+        ERR("failed to init extension");
+        goto err_extension;
+     }
+
    /* Can we use wayland_tbm_embedded_server_init() instead of it? */
    comp->tbm_server = wayland_tbm_server_init(pepper_compositor_get_display(comp->pepper.comp),
                                               NULL, -1, 0);
@@ -314,6 +321,9 @@ err_input:
    wayland_tbm_server_deinit(comp->tbm_server);
 
 err_tbm:
+   tizen_policy_shutdown();
+
+err_extension:
    pepper_efl_shell_shutdown();
 
 err_shell:
diff --git a/src/lib/extensions/tizen_policy.c b/src/lib/extensions/tizen_policy.c
new file mode 100644 (file)
index 0000000..bf964bc
--- /dev/null
@@ -0,0 +1,662 @@
+#include "private.h"
+
+#include <tizen-extension-server-protocol.h>
+
+/* tizen policy data for pepper_surface_t */
+typedef struct
+{
+   pepper_surface_t *psurf;
+   pepper_event_listener_t *psurf_destroy_listener;
+   struct wl_list resource_list;
+   Pepper_Efl_Visibility_Type visibility;
+   int references;
+} tzpol_surface_t;
+
+const static char       *tsurf_data_key = "tzpol-surf";
+static struct wl_global *_tzpol_global = NULL;
+static struct wl_list    _tzpol_res_list;
+
+static void
+_tzpol_surface_del(tzpol_surface_t *tsurf)
+{
+   free(tsurf);
+}
+
+static void
+_tzpol_surface_unref(tzpol_surface_t *tsurf, struct wl_resource *unref)
+{
+   int res;
+
+   res = wl_list_empty(&tsurf->resource_list);
+   if (res)
+     {
+        CRI("Couldn't unreference, list is empty");
+        return;
+     }
+
+   wl_list_remove(wl_resource_get_link(unref));
+   wl_resource_set_user_data(unref, NULL);
+
+   res = wl_list_empty(&tsurf->resource_list);
+   if (res)
+     {
+        pepper_event_listener_remove(tsurf->psurf_destroy_listener);
+        pepper_object_set_user_data((pepper_object_t *)tsurf->psurf,
+                                    (const void *)tsurf_data_key, NULL, NULL);
+        _tzpol_surface_del(tsurf);
+     }
+}
+
+static void
+_tzpol_surface_ref(tzpol_surface_t *tsurf, struct wl_resource *ref)
+{
+   wl_list_insert(&tsurf->resource_list, wl_resource_get_link(ref));
+   wl_resource_set_user_data(ref, tsurf);
+}
+
+static void
+_tzpol_surface_pepper_surf_cb_destroy(pepper_event_listener_t *listener, pepper_object_t *object, uint32_t id, void *info, void *data)
+{
+   tzpol_surface_t *tsurf;
+   struct wl_resource *res, *tmp;
+
+   tsurf = data;
+
+   wl_resource_for_each_safe(res, tmp, &tsurf->resource_list)
+        _tzpol_surface_unref(tsurf, res);
+}
+
+static tzpol_surface_t *
+_tzpol_surface_get(pepper_surface_t *psurf)
+{
+   tzpol_surface_t *tsurf;
+
+   tsurf = pepper_object_get_user_data((pepper_object_t *)psurf,
+                                       (const void *)tsurf_data_key);
+   if (!tsurf)
+     {
+        tsurf = calloc(1, sizeof(*tsurf));
+        if (!tsurf)
+          return NULL;
+
+        tsurf->psurf = psurf;
+
+        wl_list_init(&tsurf->resource_list);
+
+        tsurf->psurf_destroy_listener =
+           pepper_object_add_event_listener((pepper_object_t *)psurf,
+                                            PEPPER_EVENT_OBJECT_DESTROY, 0,
+                                            _tzpol_surface_pepper_surf_cb_destroy, tsurf);
+        pepper_object_set_user_data((pepper_object_t *)psurf,
+                                    (const void *)tsurf_data_key, tsurf, NULL);
+     }
+
+   tsurf->references++;
+
+   return tsurf;
+}
+
+// --------------------------------------------------------
+// visibility
+// --------------------------------------------------------
+static void
+_tzvis_iface_cb_destroy(struct wl_client *client, struct wl_resource *res_tzvis)
+{
+   wl_resource_destroy(res_tzvis);
+}
+
+static const struct tizen_visibility_interface _tzvis_iface =
+{
+   _tzvis_iface_cb_destroy
+};
+
+static void
+_tzvis_res_cb_destroy(struct wl_resource *res_tzvis)
+{
+   tzpol_surface_t *tsurf;
+
+   tsurf = wl_resource_get_user_data(res_tzvis);
+   if (!tsurf)
+     return;
+
+   _tzpol_surface_unref(tsurf, res_tzvis);
+}
+
+static void
+_tzpol_iface_cb_vis_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surf)
+{
+   tzpol_surface_t *tsurf;
+   pepper_surface_t *psurf;
+   struct wl_resource *new_res;
+   int ver;
+
+   if (!surf)
+     {
+        wl_resource_post_error(res_tzpol, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "tizen_policy::visibility_get requires surface");
+        return;
+     }
+
+   psurf = wl_resource_get_user_data(surf);
+   if (!psurf)
+     {
+        ERR("failed to get pepper_surface from wl_resource");
+        wl_resource_post_error(res_tzpol, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "tizen_policy::visibility_get invalid surface resource");
+        return;
+     }
+
+   DBG("tizen_policy::visibility_get");
+   tsurf = _tzpol_surface_get(psurf);
+   if (!tsurf)
+     {
+        wl_resource_post_no_memory(res_tzpol);
+        return;
+     }
+
+   ver = wl_resource_get_version(res_tzpol);
+   new_res = wl_resource_create(client, &tizen_visibility_interface, ver, id);
+   if (!new_res)
+     {
+        wl_resource_post_no_memory(res_tzpol);
+        return;
+     }
+
+   wl_resource_set_implementation(new_res, &_tzvis_iface, tsurf, _tzvis_res_cb_destroy);
+   _tzpol_surface_ref(tsurf, new_res);
+}
+
+// --------------------------------------------------------
+// position
+// --------------------------------------------------------
+static void
+_tzpos_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpos)
+{
+   wl_resource_destroy(res_tzpos);
+}
+
+static void
+_tzpos_iface_cb_set(struct wl_client *client, struct wl_resource *res_tzpos, int32_t x, int32_t y)
+{
+   (void)client;
+   (void)res_tzpos;
+   (void)x;
+   (void)y;
+}
+
+static const struct tizen_position_interface _tzpos_iface =
+{
+   _tzpos_iface_cb_destroy,
+   _tzpos_iface_cb_set,
+};
+
+static void
+_tzpos_res_cb_destroy(struct wl_resource *res_tzpos)
+{
+   tzpol_surface_t *tsurf;
+
+   tsurf = wl_resource_get_user_data(res_tzpos);
+   if (!tsurf)
+     return;
+
+   _tzpol_surface_unref(tsurf, res_tzpos);
+}
+
+static void
+_tzpol_iface_cb_pos_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surf)
+{
+   tzpol_surface_t *tsurf;
+   pepper_surface_t *psurf;
+   struct wl_resource *new_res;
+   int ver;
+
+   if (!surf)
+     {
+        wl_resource_post_error(res_tzpol, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "tizen_policy::visibility_get requires surface");
+        return;
+     }
+
+   psurf = wl_resource_get_user_data(surf);
+   if (!psurf)
+     {
+        ERR("failed to get pepper_surface from wl_resource");
+        wl_resource_post_error(res_tzpol, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "tizen_policy::visibility_get invalid surface resource");
+        return;
+     }
+
+   DBG("tizen_policy::visibility_get");
+   tsurf = _tzpol_surface_get(psurf);
+   if (!tsurf)
+     {
+        wl_resource_post_no_memory(res_tzpol);
+        return;
+     }
+
+   ver = wl_resource_get_version(res_tzpol);
+   new_res = wl_resource_create(client, &tizen_position_interface, ver, id);
+   if (!new_res)
+     {
+        wl_resource_post_no_memory(res_tzpol);
+        return;
+     }
+
+   wl_resource_set_implementation(new_res, &_tzpos_iface, tsurf, _tzpos_res_cb_destroy);
+   _tzpol_surface_ref(tsurf, new_res);
+}
+
+// --------------------------------------------------------
+// stack: activate, raise, lower
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_activate(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_activate_below_by_res_id(struct wl_client *client, struct wl_resource *res_tzpol,  uint32_t res_id, uint32_t below_res_id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)res_id;
+   (void)below_res_id;
+}
+
+static void
+_tzpol_iface_cb_raise(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_lower(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_lower_by_res_id(struct wl_client *client, struct wl_resource *res_tzpol,  uint32_t res_id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)res_id;
+}
+
+// --------------------------------------------------------
+// focus
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_focus_skip_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_focus_skip_unset(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+// --------------------------------------------------------
+// role
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_role_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, const char *role)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)role;
+}
+
+static void
+_tzpol_iface_cb_type_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t type)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)type;
+}
+
+// --------------------------------------------------------
+// conformant
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_conformant_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_conformant_unset(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_conformant_get(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+// --------------------------------------------------------
+// notification level
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_notilv_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t lv)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)lv;
+}
+
+// --------------------------------------------------------
+// transient for
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_transient_for_set(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t child_id, uint32_t parent_id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)child_id;
+   (void)parent_id;
+}
+
+static void
+_tzpol_iface_cb_transient_for_unset(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t child_id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)child_id;
+}
+
+// --------------------------------------------------------
+// window screen mode
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_win_scrmode_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t mode)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)mode;
+}
+
+// --------------------------------------------------------
+// subsurface
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_subsurf_place_below_parent(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *subsurf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)subsurf;
+}
+
+static void
+_tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t id, struct wl_resource *surface, uint32_t parent_id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)id;
+   (void)surface;
+   (void)parent_id;
+}
+
+static void
+_tzpol_iface_cb_opaque_state_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surface, int32_t state)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surface;
+   (void)state;
+}
+
+// --------------------------------------------------------
+// iconify
+// --------------------------------------------------------
+static void
+_tzpol_iface_cb_iconify(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_uniconify(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_aux_hint_add(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *name, const char *value)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)id;
+   (void)name;
+   (void)value;
+}
+
+static void
+_tzpol_iface_cb_aux_hint_change(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *value)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)id;
+   (void)value;
+}
+
+static void
+_tzpol_iface_cb_aux_hint_del(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)id;
+}
+
+static void
+_tzpol_iface_cb_supported_aux_hints_get(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_background_state_set(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t pid)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)pid;
+}
+
+static void
+_tzpol_iface_cb_background_state_unset(struct wl_client *client, struct wl_resource *res_tzpol, uint32_t pid)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)pid;
+}
+
+static void
+_tzpol_iface_cb_floating_mode_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_floating_mode_unset(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+}
+
+static void
+_tzpol_iface_cb_stack_mode_set(struct wl_client *client, struct wl_resource *res_tzpol, struct wl_resource *surf, uint32_t mode)
+{
+   (void)client;
+   (void)res_tzpol;
+   (void)surf;
+   (void)mode;
+}
+
+static const struct tizen_policy_interface _tzpol_iface =
+{
+   _tzpol_iface_cb_vis_get,
+   _tzpol_iface_cb_pos_get,
+   _tzpol_iface_cb_activate,
+   _tzpol_iface_cb_activate_below_by_res_id,
+   _tzpol_iface_cb_raise,
+   _tzpol_iface_cb_lower,
+   _tzpol_iface_cb_lower_by_res_id,
+   _tzpol_iface_cb_focus_skip_set,
+   _tzpol_iface_cb_focus_skip_unset,
+   _tzpol_iface_cb_role_set,
+   _tzpol_iface_cb_type_set,
+   _tzpol_iface_cb_conformant_set,
+   _tzpol_iface_cb_conformant_unset,
+   _tzpol_iface_cb_conformant_get,
+   _tzpol_iface_cb_notilv_set,
+   _tzpol_iface_cb_transient_for_set,
+   _tzpol_iface_cb_transient_for_unset,
+   _tzpol_iface_cb_win_scrmode_set,
+   _tzpol_iface_cb_subsurf_place_below_parent,
+   _tzpol_iface_cb_subsurface_get,
+   _tzpol_iface_cb_opaque_state_set,
+   _tzpol_iface_cb_iconify,
+   _tzpol_iface_cb_uniconify,
+   _tzpol_iface_cb_aux_hint_add,
+   _tzpol_iface_cb_aux_hint_change,
+   _tzpol_iface_cb_aux_hint_del,
+   _tzpol_iface_cb_supported_aux_hints_get,
+   _tzpol_iface_cb_background_state_set,
+   _tzpol_iface_cb_background_state_unset,
+   _tzpol_iface_cb_floating_mode_set,
+   _tzpol_iface_cb_floating_mode_unset,
+   _tzpol_iface_cb_stack_mode_set,
+};
+
+static void
+_tzpol_cb_bind(struct wl_client *client, void *data, uint32_t ver, uint32_t id)
+{
+   struct wl_resource *resource;
+
+   DBG("tizen_policy::bind");
+
+   resource = wl_resource_create(client, &tizen_policy_interface, ver, id);
+   if (!resource)
+     {
+        ERR("failed to create resource for tizen_policy");
+        wl_client_post_no_memory(client);
+        return;
+     }
+
+   wl_resource_set_implementation(resource, &_tzpol_iface, NULL, NULL);
+
+   wl_list_insert(&_tzpol_res_list, wl_resource_get_link(resource));
+}
+
+Eina_Bool
+tizen_policy_init(pepper_efl_comp_t *comp)
+{
+   struct wl_display *wl_disp;
+
+   DBG("tizen_policy::init");
+
+   if (_tzpol_global)
+     goto end;
+
+   wl_list_init(&_tzpol_res_list);
+
+   wl_disp = pepper_compositor_get_display(comp->pepper.comp);
+   _tzpol_global = wl_global_create(wl_disp, &tizen_policy_interface, 1, NULL, _tzpol_cb_bind);
+   if (!_tzpol_global)
+     {
+        ERR("failed to create global for tizen policy");
+        return EINA_FALSE;
+     }
+end:
+   return EINA_TRUE;
+}
+
+void
+tizen_policy_shutdown(void)
+{
+   struct wl_resource *res, *tmp;
+
+   DBG("tizen_policy::shutdown");
+
+   wl_resource_for_each_safe(res, tmp, &_tzpol_res_list)
+     {
+        wl_list_remove(wl_resource_get_link(res));
+        wl_resource_destroy(res);
+     }
+
+   wl_global_destroy(_tzpol_global);
+   _tzpol_global = NULL;
+}
+
+Eina_Bool
+pepper_efl_object_visibility_set(Evas_Object *obj, Pepper_Efl_Visibility_Type type)
+{
+   tzpol_surface_t *tsurf;
+   pepper_surface_t *psurf;
+   struct wl_resource *resource;
+   int res;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+
+   psurf = pepper_efl_object_pepper_surface_get(obj);
+   if (!psurf)
+     return EINA_FALSE;
+
+   tsurf = pepper_object_get_user_data((pepper_object_t *)psurf, (const void *)tsurf_data_key);
+   if (!tsurf)
+     {
+        WRN("there is no data for 'tzpol_surface_t' in 'pepper_surface_t'");
+        return EINA_FALSE;
+     }
+
+   if (tsurf->visibility == type)
+     return EINA_TRUE;
+
+   tsurf->visibility = type;
+   wl_resource_for_each(resource, &tsurf->resource_list)
+     {
+        res = wl_resource_instance_of(resource, &tizen_visibility_interface, &_tzvis_iface);
+        if (!res)
+          continue;
+        tizen_visibility_send_notify(resource, type);
+     }
+
+   return EINA_TRUE;
+}
diff --git a/src/lib/extensions/tizen_policy.h b/src/lib/extensions/tizen_policy.h
new file mode 100644 (file)
index 0000000..814b544
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef _PEPPER_EFL_EXTENSION_H_
+#define _PEPPER_EFL_EXTENSION_H_
+
+typedef enum _Pepper_Efl_Visibility_Type
+{
+   PEPPER_EFL_VISIBILITY_TYPE_UNOBSCURED = 0,
+   PEPPER_EFL_VISIBILITY_TYPE_PARTIALLY_OBSCURED,
+   PEPPER_EFL_VISIBILITY_TYPE_FULLY_OBSCURED
+} Pepper_Efl_Visibility_Type;
+
+/**
+ * @brief Set visibility type to given client of Evas_Object.
+ * @since_tizen 3.0
+ * @param[in] obj Evas object which is returned from libpepper-efl
+ * @param[in] type The type of visibility
+ * @return EINA_TRUE on success, @c EINA_FALSE otherwise
+ */
+Eina_Bool   pepper_efl_object_visibility_set(Evas_Object *obj, Pepper_Efl_Visibility_Type type);
+
+#endif
index 874dea4302bd078b20738f8f52a0f0be4d50d3bb..a7234c8bb92ba54fd526557dfc901c8953fed96d 100644 (file)
@@ -772,3 +772,11 @@ pepper_efl_object_touch_cancel(Evas_Object *obj)
 
    return EINA_TRUE;
 }
+
+pepper_surface_t *
+pepper_efl_object_pepper_surface_get(Evas_Object *obj)
+{
+   OBJ_DATA_GET NULL;
+
+   return po->surface;
+}
index 954417cd7d10a629c9a480b74f107e6d42f518c3..38b3e74f1fa3f2de9c73ac3e820df3e377e5a649 100644 (file)
@@ -27,8 +27,9 @@ struct pepper_efl_object
    } input;
 };
 
-Evas_Object *pepper_efl_object_get(pepper_efl_output_t *output, pepper_surface_t *surface);
-Eina_Bool    pepper_efl_object_buffer_attach(Evas_Object *obj, int *w, int *h);
-void         pepper_efl_object_render(Evas_Object *obj);
+Evas_Object       *pepper_efl_object_get(pepper_efl_output_t *output, pepper_surface_t *surface);
+Eina_Bool          pepper_efl_object_buffer_attach(Evas_Object *obj, int *w, int *h);
+void               pepper_efl_object_render(Evas_Object *obj);
+pepper_surface_t  *pepper_efl_object_pepper_surface_get(Evas_Object *obj);
 
 #endif
index 3633c485b25bba36ed019cfa8ccbc12e5b4bbb62..25a4fde60e175f6adb06189aa9e8b07ae5f332dd 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef _PEPPER_EFL_PRIVATE_H_
+#define _PEPPER_EFL_PRIVATE_H_
+
 #include <stdio.h>
 
 #include <Eina.h>
@@ -75,3 +78,8 @@ struct pepper_efl_comp
 # define PE_CHECK(x)             EINA_SAFETY_ON_NULL_RETURN(x)
 # define PE_CHECK_RET(x, ret)    EINA_SAFETY_ON_NULL_RETURN_VAL(x, ret)
 #endif
+
+Eina_Bool   tizen_policy_init(pepper_efl_comp_t *comp);
+void        tizen_policy_shutdown(void);
+
+#endif