summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoram Park <boram1288.park@samsung.com>2015-04-24 12:54:08 +0900
committerBoram Park <boram1288.park@samsung.com>2015-04-27 13:46:45 +0900
commitb012c78fb5989c106e58131a5501e6a5bc0cc1d0 (patch)
tree6295699438825380dad9a82189d67f82487c16fd
parent79cca758391b55e4ca6a8c73b661ac11a261c327 (diff)
downloadefl-b012c78fb5989c106e58131a5501e6a5bc0cc1d0.tar.gz
ecore_wayland: implementation for tizen-policy protocol
Change-Id: I7a8450876a6b50f75e1ab762d81f44f444bc80e7
-rw-r--r--src/Makefile_Ecore_Wayland.am4
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h9
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c10
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h4
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c41
-rw-r--r--src/lib/ecore_wayland/tizen-policy-client-protocol.h106
-rw-r--r--src/lib/ecore_wayland/tizen-policy-protocol.c37
7 files changed, 210 insertions, 1 deletions
diff --git a/src/Makefile_Ecore_Wayland.am b/src/Makefile_Ecore_Wayland.am
index f9bb3621d2..4032b40da3 100644
--- a/src/Makefile_Ecore_Wayland.am
+++ b/src/Makefile_Ecore_Wayland.am
@@ -21,7 +21,9 @@ lib/ecore_wayland/subsurface-client-protocol.h \
lib/ecore_wayland/ivi-application-protocol.c \
lib/ecore_wayland/ivi-application-client-protocol.h \
lib/ecore_wayland/xdg-shell-client-protocol.h \
-lib/ecore_wayland/xdg-shell-protocol.c
+lib/ecore_wayland/xdg-shell-protocol.c \
+lib/ecore_wayland/tizen-policy-client-protocol.h \
+lib/ecore_wayland/tizen-policy-protocol.c
lib_ecore_wayland_libecore_wayland_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WAYLAND_CFLAGS@
lib_ecore_wayland_libecore_wayland_la_LIBADD = @ECORE_WAYLAND_LIBS@
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index 1f3ba1977e..dc2ba48eea 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -56,6 +56,7 @@ typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out;
typedef struct _Ecore_Wl_Event_Window_Configure Ecore_Wl_Event_Window_Configure;
typedef struct _Ecore_Wl_Event_Window_Activate Ecore_Wl_Event_Window_Activate;
typedef struct _Ecore_Wl_Event_Window_Deactivate Ecore_Wl_Event_Window_Deactivate;
+typedef struct _Ecore_Wl_Event_Window_Visibility_Change Ecore_Wl_Event_Window_Visibility_Change;
typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter;
typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
@@ -162,6 +163,12 @@ struct _Ecore_Wl_Event_Window_Deactivate
Eina_Bool fobscured;
};
+struct _Ecore_Wl_Event_Window_Visibility_Change
+{
+ unsigned int win;
+ int fully_obscured;
+};
+
struct _Ecore_Wl_Event_Dnd_Enter
{
unsigned int win, source;
@@ -239,6 +246,7 @@ struct _Ecore_Wl_Event_Interfaces_Bound
Eina_Bool seat : 1;
Eina_Bool data_device_manager : 1;
Eina_Bool subcompositor : 1;
+ Eina_Bool policy : 1;
};
/**
@@ -268,6 +276,7 @@ EAPI extern int ECORE_WL_EVENT_FOCUS_OUT;
EAPI extern int ECORE_WL_EVENT_WINDOW_CONFIGURE;
EAPI extern int ECORE_WL_EVENT_WINDOW_ACTIVATE;
EAPI extern int ECORE_WL_EVENT_WINDOW_DEACTIVATE;
+EAPI extern int ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE;
EAPI extern int ECORE_WL_EVENT_DND_ENTER;
EAPI extern int ECORE_WL_EVENT_DND_POSITION;
EAPI extern int ECORE_WL_EVENT_DND_LEAVE;
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index d228f2a1d6..7caa7ed605 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -86,6 +86,7 @@ EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0;
EAPI int ECORE_WL_EVENT_WINDOW_CONFIGURE = 0;
EAPI int ECORE_WL_EVENT_WINDOW_ACTIVATE = 0;
EAPI int ECORE_WL_EVENT_WINDOW_DEACTIVATE = 0;
+EAPI int ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE = 0;
EAPI int ECORE_WL_EVENT_DND_ENTER = 0;
EAPI int ECORE_WL_EVENT_DND_POSITION = 0;
EAPI int ECORE_WL_EVENT_DND_LEAVE = 0;
@@ -153,6 +154,7 @@ ecore_wl_init(const char *name)
ECORE_WL_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
ECORE_WL_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
ECORE_WL_EVENT_WINDOW_DEACTIVATE = ecore_event_type_new();
+ ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
ECORE_WL_EVENT_DND_ENTER = ecore_event_type_new();
ECORE_WL_EVENT_DND_POSITION = ecore_event_type_new();
ECORE_WL_EVENT_DND_LEAVE = ecore_event_type_new();
@@ -504,6 +506,8 @@ _ecore_wl_shutdown(Eina_Bool close)
if (_ecore_wl_disp->wl.shm) wl_shm_destroy(_ecore_wl_disp->wl.shm);
if (_ecore_wl_disp->wl.data_device_manager)
wl_data_device_manager_destroy(_ecore_wl_disp->wl.data_device_manager);
+ if (_ecore_wl_disp->wl.tz_policy)
+ tizen_policy_destroy(_ecore_wl_disp->wl.tz_policy);
if (_ecore_wl_disp->wl.compositor)
wl_compositor_destroy(_ecore_wl_disp->wl.compositor);
if (_ecore_wl_disp->wl.subcompositor)
@@ -682,6 +686,11 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
ewd->wl.data_device_manager =
wl_registry_bind(registry, id, &wl_data_device_manager_interface, 1);
}
+ else if (!strcmp(interface, "tizen_policy"))
+ {
+ ewd->wl.tz_policy =
+ wl_registry_bind(registry, id, &tizen_policy_interface, 1);
+ }
if ((ewd->wl.compositor) && (ewd->wl.shm) &&
((ewd->wl.shell) || (ewd->wl.xdg_shell)))
@@ -697,6 +706,7 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
ev->output = (ewd->output != NULL);
ev->seat = (ewd->input != NULL);
ev->data_device_manager = (ewd->wl.data_device_manager != NULL);
+ ev->policy = (ewd->wl.tz_policy != NULL);
ev->subcompositor = (ewd->wl.subcompositor != NULL);
ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL);
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 52b7a9b509..f45b77141f 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -12,6 +12,8 @@
# define IVI_SURFACE_ID 6000
# endif
+# include "tizen-policy-client-protocol.h"
+
//# define LOGFNS 1
# ifdef LOGFNS
@@ -76,6 +78,7 @@ struct _Ecore_Wl_Display
# endif
struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
+ struct tizen_policy *tz_policy;
} wl;
int fd;
@@ -116,6 +119,7 @@ struct _Ecore_Wl_Window
struct ivi_surface *ivi_surface;
int ivi_surface_id;
# endif
+ struct tizen_visibility *tz_visibility;
struct wl_region *opaque_region;
struct wl_region *input_region;
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 6c0f51f6ba..e9f0f4af51 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -4,6 +4,7 @@
#include "ecore_wl_private.h"
#include "xdg-shell-client-protocol.h"
+#include "tizen-policy-client-protocol.h"
/* local function prototypes */
static void _ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell_surface, unsigned int serial);
@@ -16,6 +17,7 @@ static char *_ecore_wl_window_id_str_get(unsigned int win_id);
static void _ecore_xdg_handle_surface_configure(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height,struct wl_array *states, uint32_t serial);
static void _ecore_xdg_handle_surface_delete(void *data, struct xdg_surface *xdg_surface);
static void _ecore_xdg_handle_popup_done(void *data, struct xdg_popup *xdg_popup, unsigned int serial);
+static void _ecore_wl_window_cb_visibility_change(void *data, struct tizen_visibility *tizen_visibility, uint32_t visibility);
/* local variables */
static Eina_Hash *_windows = NULL;
@@ -45,6 +47,11 @@ static const struct xdg_popup_listener _ecore_xdg_popup_listener =
_ecore_xdg_handle_popup_done,
};
+static const struct tizen_visibility_listener _ecore_tizen_visibility_listener =
+{
+ _ecore_wl_window_cb_visibility_change,
+};
+
/* internal functions */
void
_ecore_wl_window_init(void)
@@ -149,6 +156,9 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
if (win->ivi_surface) ivi_surface_destroy(win->ivi_surface);
win->ivi_surface = NULL;
#endif
+ if (win->tz_visibility) tizen_visibility_destroy(win->tz_visibility);
+ win->tz_visibility = NULL;
+
if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface);
win->xdg_surface = NULL;
if (win->xdg_popup) xdg_popup_destroy(win->xdg_popup);
@@ -368,6 +378,15 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
#ifdef USE_IVI_SHELL
}
#endif
+ if (!win->tz_visibility)
+ {
+ win->tz_visibility =
+ tizen_policy_get_visibility(_ecore_wl_disp->wl.tz_policy,
+ win->surface);
+ if (!win->tz_visibility) return;
+ tizen_visibility_add_listener(win->tz_visibility,
+ &_ecore_tizen_visibility_listener, win);
+ }
}
/* trap for valid shell surface */
@@ -1089,6 +1108,28 @@ _ecore_wl_window_cb_xdg_surface_deactivate(void *data, struct xdg_surface *xdg_s
}
static void
+_ecore_wl_window_cb_visibility_change(void *data,
+ struct tizen_visibility *tizen_visibility,
+ uint32_t visibility)
+{
+ Ecore_Wl_Window *win;
+ Ecore_Wl_Event_Window_Visibility_Change *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(win = data)) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Window_Visibility_Change)))) return;
+
+ ev->win = win->id;
+ if (visibility == TIZEN_VISIBILITY_VISIBILITY_FULLY_OBSCURED)
+ ev->fully_obscured = 1;
+ else
+ ev->fully_obscured = 0;
+
+ ecore_event_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE, ev, NULL, NULL);
+}
+
+static void
_ecore_wl_window_cb_xdg_surface_delete(void *data EINA_UNUSED, struct xdg_surface *xdg_surface EINA_UNUSED)
{
}
diff --git a/src/lib/ecore_wayland/tizen-policy-client-protocol.h b/src/lib/ecore_wayland/tizen-policy-client-protocol.h
new file mode 100644
index 0000000000..77e1f0357c
--- /dev/null
+++ b/src/lib/ecore_wayland/tizen-policy-client-protocol.h
@@ -0,0 +1,106 @@
+#ifndef TIZEN_POLICY_CLIENT_PROTOCOL_H
+#define TIZEN_POLICY_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct tizen_policy;
+struct tizen_visibility;
+
+extern const struct wl_interface tizen_policy_interface;
+extern const struct wl_interface tizen_visibility_interface;
+
+#define TIZEN_POLICY_GET_VISIBILITY 0
+
+static inline void
+tizen_policy_set_user_data(struct tizen_policy *tizen_policy, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) tizen_policy, user_data);
+}
+
+static inline void *
+tizen_policy_get_user_data(struct tizen_policy *tizen_policy)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) tizen_policy);
+}
+
+static inline void
+tizen_policy_destroy(struct tizen_policy *tizen_policy)
+{
+ wl_proxy_destroy((struct wl_proxy *) tizen_policy);
+}
+
+static inline struct tizen_visibility *
+tizen_policy_get_visibility(struct tizen_policy *tizen_policy, struct wl_surface *surface)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_marshal_constructor((struct wl_proxy *) tizen_policy,
+ TIZEN_POLICY_GET_VISIBILITY, &tizen_visibility_interface, NULL, surface);
+
+ return (struct tizen_visibility *) id;
+}
+
+#ifndef TIZEN_VISIBILITY_VISIBILITY_ENUM
+#define TIZEN_VISIBILITY_VISIBILITY_ENUM
+enum tizen_visibility_visibility {
+ TIZEN_VISIBILITY_VISIBILITY_UNOBSCURED = 0,
+ TIZEN_VISIBILITY_VISIBILITY_PARTIALLY_OBSCURED = 1,
+ TIZEN_VISIBILITY_VISIBILITY_FULLY_OBSCURED = 2,
+};
+#endif /* TIZEN_VISIBILITY_VISIBILITY_ENUM */
+
+struct tizen_visibility_listener {
+ /**
+ * notify - (none)
+ * @visibility: (none)
+ */
+ void (*notify)(void *data,
+ struct tizen_visibility *tizen_visibility,
+ uint32_t visibility);
+};
+
+static inline int
+tizen_visibility_add_listener(struct tizen_visibility *tizen_visibility,
+ const struct tizen_visibility_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) tizen_visibility,
+ (void (**)(void)) listener, data);
+}
+
+#define TIZEN_VISIBILITY_DESTROY 0
+
+static inline void
+tizen_visibility_set_user_data(struct tizen_visibility *tizen_visibility, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) tizen_visibility, user_data);
+}
+
+static inline void *
+tizen_visibility_get_user_data(struct tizen_visibility *tizen_visibility)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) tizen_visibility);
+}
+
+static inline void
+tizen_visibility_destroy(struct tizen_visibility *tizen_visibility)
+{
+ wl_proxy_marshal((struct wl_proxy *) tizen_visibility,
+ TIZEN_VISIBILITY_DESTROY);
+
+ wl_proxy_destroy((struct wl_proxy *) tizen_visibility);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/lib/ecore_wayland/tizen-policy-protocol.c b/src/lib/ecore_wayland/tizen-policy-protocol.c
new file mode 100644
index 0000000000..fad29b1e1a
--- /dev/null
+++ b/src/lib/ecore_wayland/tizen-policy-protocol.c
@@ -0,0 +1,37 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface tizen_visibility_interface;
+extern const struct wl_interface wl_surface_interface;
+
+static const struct wl_interface *types[] = {
+ NULL,
+ &tizen_visibility_interface,
+ &wl_surface_interface,
+};
+
+static const struct wl_message tizen_policy_requests[] = {
+ { "get_visibility", "no", types + 1 },
+};
+
+WL_EXPORT const struct wl_interface tizen_policy_interface = {
+ "tizen_policy", 1,
+ 1, tizen_policy_requests,
+ 0, NULL,
+};
+
+static const struct wl_message tizen_visibility_requests[] = {
+ { "destroy", "", types + 0 },
+};
+
+static const struct wl_message tizen_visibility_events[] = {
+ { "notify", "u", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface tizen_visibility_interface = {
+ "tizen_visibility", 1,
+ 1, tizen_visibility_requests,
+ 1, tizen_visibility_events,
+};
+