From e37546fcc087f1cbc284b3eeadd3b97d2a87a250 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 20 Jul 2015 19:59:33 +0900 Subject: [PATCH] using tizen-extension wayland protocol instead of including *protocol.c directly Change-Id: I66bba71559bf9d7d94d00a5c124c66c1acf8d37f --- CMakeLists.txt | 5 +- include/tizen-transient-for-client-protocol.h | 76 --------------------------- packaging/aul.spec | 1 + src/app_group.c | 26 ++++----- src/tizen-transient-for-protocol.c | 25 --------- 5 files changed, 15 insertions(+), 118 deletions(-) delete mode 100644 include/tizen-transient-for-client-protocol.h delete mode 100644 src/tizen-transient-for-protocol.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cca957..2b172dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ pkg_check_modules(pkgs REQUIRED ${AUL-1_PKG_CHECK_MODULES} ) SET(AUL-1_LIB_PKG_CHECK_MODULES dlog bundle dbus-glib-1 ail xdgmime app-checker libtzplatform-config pkgmgr-info libsystemd-daemon security-manager) IF (with_wayland) - pkg_check_modules(libpkgs REQUIRED ${AUL-1_LIB_PKG_CHECK_MODULES} wayland-client) + pkg_check_modules(libpkgs REQUIRED ${AUL-1_LIB_PKG_CHECK_MODULES} wayland-client tizen-extension-client) ENDIF (with_wayland) IF (with_x11) pkg_check_modules(libpkgs REQUIRED ${AUL-1_LIB_PKG_CHECK_MODULES}) @@ -82,9 +82,6 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") # aul_mods : modules (static library) SET(SRCS_aul_mods src/app_sock.c src/simple_util.c) -IF (with_wayland) - SET(SRCS_aul_mods ${SRCS_aul_mods} src/tizen-transient-for-protocol.c) -ENDIF (with_wayland) add_library(aul_mods STATIC ${SRCS_aul_mods} ) diff --git a/include/tizen-transient-for-client-protocol.h b/include/tizen-transient-for-client-protocol.h deleted file mode 100644 index 1271fb9..0000000 --- a/include/tizen-transient-for-client-protocol.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef TIZEN_TRANSIENT_FOR_CLIENT_PROTOCOL_H -#define TIZEN_TRANSIENT_FOR_CLIENT_PROTOCOL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include "wayland-client.h" - -struct wl_client; -struct wl_resource; - -struct tizen_transient_for; - -extern const struct wl_interface tizen_transient_for_interface; - -struct tizen_transient_for_listener { - /** - * done - (none) - * @child_id: (none) - */ - void (*done)(void *data, - struct tizen_transient_for *tizen_transient_for, - uint32_t child_id); -}; - -static inline int -tizen_transient_for_add_listener(struct tizen_transient_for *tizen_transient_for, - const struct tizen_transient_for_listener *listener, void *data) -{ - return wl_proxy_add_listener((struct wl_proxy *) tizen_transient_for, - (void (**)(void)) listener, data); -} - -#define TIZEN_TRANSIENT_FOR_SET 0 -#define TIZEN_TRANSIENT_FOR_UNSET 1 - -static inline void -tizen_transient_for_set_user_data(struct tizen_transient_for *tizen_transient_for, void *user_data) -{ - wl_proxy_set_user_data((struct wl_proxy *) tizen_transient_for, user_data); -} - -static inline void * -tizen_transient_for_get_user_data(struct tizen_transient_for *tizen_transient_for) -{ - return wl_proxy_get_user_data((struct wl_proxy *) tizen_transient_for); -} - -static inline void -tizen_transient_for_destroy(struct tizen_transient_for *tizen_transient_for) -{ - wl_proxy_destroy((struct wl_proxy *) tizen_transient_for); -} - -static inline void -tizen_transient_for_set(struct tizen_transient_for *tizen_transient_for, uint32_t child_id, uint32_t parent_id) -{ - wl_proxy_marshal((struct wl_proxy *) tizen_transient_for, - TIZEN_TRANSIENT_FOR_SET, child_id, parent_id); -} - -static inline void -tizen_transient_for_unset(struct tizen_transient_for *tizen_transient_for, uint32_t child_id) -{ - wl_proxy_marshal((struct wl_proxy *) tizen_transient_for, - TIZEN_TRANSIENT_FOR_UNSET, child_id); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/packaging/aul.spec b/packaging/aul.spec index f417ec3..2ce7551 100644 --- a/packaging/aul.spec +++ b/packaging/aul.spec @@ -42,6 +42,7 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libsystemd-daemon) %if %{with wayland} BuildRequires: pkgconfig(wayland-client) +BuildRequires: pkgconfig(tizen-extension-client) %endif %description diff --git a/src/app_group.c b/src/app_group.c index e5b2dbe..99f88e4 100644 --- a/src/app_group.c +++ b/src/app_group.c @@ -13,17 +13,17 @@ #ifdef WAYLAND #include -#include "tizen-transient-for-client-protocol.h" -static struct tizen_transient_for *tz_transient_for = NULL; +#include +static struct tizen_policy *tz_policy = NULL; static void _reg_handle_global(void *data, struct wl_registry *reg, uint32_t id, const char *interface, uint32_t ver) { - if (!strcmp(interface, "tizen_transient_for")) + if (!strcmp(interface, "tizen_policy")) { - tz_transient_for = wl_registry_bind(reg, + tz_policy = wl_registry_bind(reg, id, - &tizen_transient_for_interface, + &tizen_policy_interface, 1); } } @@ -87,18 +87,18 @@ SLPAPI void aul_app_group_attach_window(int parent_wid, int child_wid) wl_registry_add_listener(reg, ®_listener, NULL); wl_display_roundtrip(dpy); - if (!tz_transient_for) + if (!tz_policy) { - _E("ERR: no tizen_surface_extension global interface"); + _E("ERR: no tizen_policy global interface"); wl_registry_destroy(reg); wl_display_disconnect(dpy); return; } - tizen_transient_for_set(tz_transient_for, child_wid, parent_wid); + tizen_policy_set_transient_for(tz_policy, child_wid, parent_wid); wl_display_roundtrip(dpy); - tizen_transient_for_destroy(tz_transient_for); + tizen_policy_destroy(tz_policy); wl_registry_destroy(reg); wl_display_disconnect(dpy); #else @@ -117,18 +117,18 @@ SLPAPI void aul_app_group_detach_window(int child_wid) wl_registry_add_listener(reg, ®_listener, NULL); wl_display_roundtrip(dpy); - if (!tz_transient_for) + if (!tz_policy) { - _E("ERR: no tizen_surface_extension global interface"); + _E("ERR: no tz_policy global interface"); wl_registry_destroy(reg); wl_display_disconnect(dpy); return; } - tizen_transient_for_unset(tz_transient_for, child_wid); + tizen_policy_unset_transient_for(tz_policy, child_wid); wl_display_roundtrip(dpy); - tizen_transient_for_destroy(tz_transient_for); + tizen_policy_destroy(tz_policy); wl_registry_destroy(reg); wl_display_disconnect(dpy); #else diff --git a/src/tizen-transient-for-protocol.c b/src/tizen-transient-for-protocol.c deleted file mode 100644 index 5864df8..0000000 --- a/src/tizen-transient-for-protocol.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include "wayland-util.h" - - -static const struct wl_interface *types[] = { - NULL, - NULL, -}; - -static const struct wl_message tizen_transient_for_requests[] = { - { "set", "uu", types + 0 }, - { "unset", "u", types + 0 }, -}; - -static const struct wl_message tizen_transient_for_events[] = { - { "done", "u", types + 0 }, -}; - -WL_EXPORT const struct wl_interface tizen_transient_for_interface = { - "tizen_transient_for", 1, - 2, tizen_transient_for_requests, - 1, tizen_transient_for_events, -}; - -- 2.7.4