From 3a86573c836fcbe7cb6072e5607b4216c6c5c133 Mon Sep 17 00:00:00 2001 From: "Li,Limin" Date: Wed, 8 Jan 2014 18:01:31 +0800 Subject: init wayland support The display server based on X or Wayland, is now a choice of different profile in Tizen 3.0. Basically and consistently, two macros were used "with wayland" and "with x". Below summarize the combination of the macros: | wayland | x | meaning |--------------------------- | 0 | 1 | pure X11 platform(no wayland) | 1 | 0 | pure wayland platform (no X11) | 1 | 1 | wayland but X compatibility | 0 | 0 | no X and no wayland This method unifies the meaning and usage. Deploy this method to ui-gadget package. Signed-off-by: Li,Limin Change-Id: Iceb95b03f824860b2aac74f35c0945380f6cc22a --- CMakeLists.txt | 11 ++++++++++- client/CMakeLists.txt | 21 +++++++++------------ client/ug-client.c | 15 +++++++++++---- include/ug-manager.h | 6 ++++++ include/ui-gadget.h | 9 +++++++-- packaging/ui-gadget-1.spec | 13 +++++++++++-- src/manager.c | 22 ++++++++++++++++++++++ src/ug.c | 2 ++ ug-efl-engine/CMakeLists.txt | 19 +++++++++++-------- ui-gadget-1.pc.in | 2 +- 10 files changed, 90 insertions(+), 30 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 client/CMakeLists.txt mode change 100755 => 100644 client/ug-client.c mode change 100755 => 100644 include/ug-manager.h mode change 100755 => 100644 include/ui-gadget.h mode change 100755 => 100644 packaging/ui-gadget-1.spec mode change 100755 => 100644 src/manager.c mode change 100755 => 100644 src/ug.c mode change 100755 => 100644 ug-efl-engine/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 1d8dbba..7733cdf --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,16 @@ SET(SRCS src/ug.c ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) -PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager ecore) +SET(PKGS_CHECK_MODULES "glib-2.0 bundle dlog capi-appfw-application appsvc capi-appfw-app-manager ecore") +IF (with_x) + PKG_CHECK_MODULES(PKGS REQUIRED ${PKGS_CHECK_MODULES} utilX x11) +ENDIF(with_x) + +IF (with_wayland) + ADD_DEFINITIONS("-DWAYLAND") + PKG_CHECK_MODULES(PKGS REQUIRED ${PKGS_CHECK_MODULES}) +ENDIF (with_wayland) + FOREACH(flag ${PKGS_CFLAGS}) SET(CFLAGS "${CFLAGS} ${flag}") ENDFOREACH(flag) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt old mode 100755 new mode 100644 index cd31296..35f00af --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -7,18 +7,15 @@ SET(CLIENT_LOCALEDIR /usr/share/locale) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED - capi-appfw-application - capi-system-runtime-info - appcore-efl - appsvc - bundle - ecore-x - edje - dlog - elementary - evas - x11) +SET(CLIENT_PKGS_CHECK_MODULES "capi-appfw-application capi-system-runtime-info appcore-efl appsvc bundle edje dlog elementary evas") + +IF (with_x) + PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${CLIENT_PKGS_CHECK_MODULES} ecore-x x11) +ENDIF(with_x) + +IF (with_wayland) + PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${CLIENT_PKGS_CHECK_MODULES}) +ENDIF(with_wayland) FOREACH(flag ${CLIENT_PKGS_CFLAGS}) SET(CLIENT_CFLAGS "${CLIENT_CFLAGS} ${flag}") diff --git a/client/ug-client.c b/client/ug-client.c old mode 100755 new mode 100644 index cf9819d..46bd4e7 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -22,7 +22,11 @@ #include #include #include + +#ifndef WAYLAND #include +#endif + #include #include #include @@ -31,8 +35,6 @@ #include "ug-client.h" -#include - #ifdef LOG_TAG #undef LOG_TAG #endif @@ -180,6 +182,7 @@ static void profile_changed_cb(void *data, Evas_Object * obj, void *event) static Evas_Object *create_win(const char *name) { + Ecore_Evas *ee; Evas_Object *eo; int w, h; @@ -191,8 +194,8 @@ static Evas_Object *create_win(const char *name) win_del, NULL); /* disable destktop mode evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL); */ - ecore_x_window_size_get(ecore_x_window_root_first_get(), - &w, &h); + ee = ecore_evas_ecore_evas_get(evas_object_evas_get(eo)); + evas_output_size_get(ee, &w, &h); evas_object_resize(eo, w, h); } @@ -247,7 +250,10 @@ static int app_create(void *data) if (win == NULL) return -1; ad->win = win; + +#ifndef WAYLAND UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE); +#endif bg = elm_bg_add(win); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -358,6 +364,7 @@ static int app_reset(bundle *b, void *data) Ecore_X_Window id2 = elm_win_xwindow_get(ad->win); ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test"); + if (ret) LOGD("fail to request transient app: return value(%d)", ret); else diff --git a/include/ug-manager.h b/include/ug-manager.h old mode 100755 new mode 100644 index 0589ac8..f5ac47e --- a/include/ug-manager.h +++ b/include/ug-manager.h @@ -22,7 +22,10 @@ #ifndef __UG_MANAGER_H__ #define __UG_MANAGER_H__ +#ifndef WAYLAND #include +#endif + #include "ug.h" int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug); @@ -34,7 +37,10 @@ ui_gadget_h ugman_ug_load(ui_gadget_h parent, int ugman_ug_del(ui_gadget_h ug); int ugman_ug_del_all(void); +#ifndef WAYLAND int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt); +#endif + int ugman_resume(void); int ugman_pause(void); int ugman_send_event(enum ug_event event); diff --git a/include/ui-gadget.h b/include/ui-gadget.h old mode 100755 new mode 100644 index dfa13b4..fbad11d --- a/include/ui-gadget.h +++ b/include/ui-gadget.h @@ -54,8 +54,10 @@ * @addtogroup UI_Gadget_For_User * @{ */ - +#ifndef WAYLAND #include +#endif + #include #ifdef __cplusplus @@ -161,9 +163,11 @@ struct ug_cbs { * Easy-to-use macro of ug_init() for EFL * @see ug_init() */ +#ifndef WAYLAND #define UG_INIT_EFL(win, opt) \ ug_init((Display *)ecore_x_display_get(), elm_win_xwindow_get(win), \ win, opt) +#endif /** * Easy-to-use macro of ug_init() for GTK @@ -215,8 +219,9 @@ struct ug_cbs { * ... * \endcode */ +#ifndef WAYLAND int ug_init(Display *disp, Window xid, void *win, enum ug_option opt); - +#endif /** * \par Description: * This function creates a UI gadget diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec old mode 100755 new mode 100644 index 6533105..34335b2 --- a/packaging/ui-gadget-1.spec +++ b/packaging/ui-gadget-1.spec @@ -1,3 +1,5 @@ +%bcond_with x +%bcond_with wayland Name: ui-gadget-1 Summary: UI Gadget Library @@ -9,12 +11,14 @@ Source0: %{name}-%{version}.tar.gz Source1001: ui-gadget-1.manifest Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig -BuildRequires: pkgconfig(utilX) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(dlog) +%if %{with x} +BuildRequires: pkgconfig(utilX) BuildRequires: pkgconfig(x11) +%endif BuildRequires: pkgconfig(appsvc) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-system-runtime-info) @@ -37,7 +41,12 @@ Development files for %{name} cp %{SOURCE1001} . %build -%cmake . +%cmake . \ +%if %{with wayland} && !%{with x} +-Dwith_wayland=TRUE +%else +-Dwith_x=TRUE +%endif make %{?jobs:-j%jobs} diff --git a/src/manager.c b/src/manager.c old mode 100755 new mode 100644 index bc3de24..c96d5b2 --- a/src/manager.c +++ b/src/manager.c @@ -24,9 +24,12 @@ #include #include #include + +#ifndef WAYLAND #include #include #include +#endif #include @@ -41,8 +44,12 @@ struct ug_manager { GSList *fv_list; void *win; + +#ifndef WAYLAND Window win_id; Display *disp; +#endif + void *conform; enum ug_option base_opt; @@ -110,6 +117,7 @@ static int ug_fvlist_del(ui_gadget_h c) return 0; } +#ifndef WAYLAND static int __ug_x_get_window_property(Display *dpy, Window win, Atom atom, Atom type, unsigned int *val, unsigned int len) @@ -146,7 +154,9 @@ static int __ug_x_get_window_property(Display *dpy, Window win, Atom atom, return num; } +#endif +#ifndef WAYLAND static enum ug_event __ug_x_rotation_get(Display *dpy, Window win) { Window active_win; @@ -202,6 +212,7 @@ static enum ug_event __ug_x_rotation_get(Display *dpy, Window win) func_out: return func_ret; } +#endif static void ugman_tree_dump(ui_gadget_h ug) { @@ -382,7 +393,11 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event) int enable; int cur_state; +#ifndef WAYLAND cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id); +#else + cur_state = -1; //state is -1 (unknown) +#endif _DBG("indicator update opt(%d) cur_state(%d)", opt, cur_state); @@ -411,7 +426,10 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event) if(cur_state != enable) { _DBG("set indicator as %d", enable); + +#ifndef WAYLAND utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable); +#endif } return 0; } @@ -586,7 +604,9 @@ static int ugman_ug_create(void *data) } if(ug_man.last_rotate_evt == UG_EVENT_NONE) { +#ifndef WAYLAND ug_man.last_rotate_evt = __ug_x_rotation_get(ug_man.disp, ug_man.win_id); +#endif } ugman_ug_event(ug, ug_man.last_rotate_evt); @@ -798,6 +818,7 @@ int ugman_ug_del_all(void) return 0; } +#ifndef WAYLAND int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt) { ug_man.is_initted = 1; @@ -810,6 +831,7 @@ int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt) return 0; } +#endif int ugman_resume(void) { diff --git a/src/ug.c b/src/ug.c old mode 100755 new mode 100644 index 3ee636f..af5bc47 --- a/src/ug.c +++ b/src/ug.c @@ -94,6 +94,7 @@ UG_API ui_gadget_h ug_create(ui_gadget_h parent, return ugman_ug_load(parent, name, mode, service, cbs); } +#ifndef WAYLAND UG_API int ug_init(Display *disp, Window xid, void *win, enum ug_option opt) { if (!win || !xid || !disp) { @@ -108,6 +109,7 @@ UG_API int ug_init(Display *disp, Window xid, void *win, enum ug_option opt) return ugman_init(disp, xid, win, opt); } +#endif UG_API int ug_pause(void) { diff --git a/ug-efl-engine/CMakeLists.txt b/ug-efl-engine/CMakeLists.txt old mode 100755 new mode 100644 index d498e2d..6005fa5 --- a/ug-efl-engine/CMakeLists.txt +++ b/ug-efl-engine/CMakeLists.txt @@ -3,15 +3,18 @@ SET(UG_EFL_ENGINE_SRCS ug-efl-engine.c) SET(UG_ENGINE_EDJ_DIR "${CMAKE_INSTALL_PREFIX}/share/edje") SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.1.0") +SET(UG_EFL_ENGINE_PKGS_CHECK_MODULES "dlog elementary ecore edje capi-appfw-application evas") -PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED - dlog - elementary - ecore - ecore-x - edje - capi-appfw-application - evas) +IF (with_x) + PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED + ${UG_EFL_ENGINE_PKGS_CHECK_MODULES} + ecore-x) +ENDIF(with_x) + +IF (with_wayland) + PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED + ${UG_EFL_ENGINE_PKGS_CHECK_MODULES}) +ENDIF(with_wayland) FOREACH(flag ${UG_EFL_ENGINE_PKGS_CFLAGS}) SET(UG_EFL_ENGINE_CFLAGS "${UG_EFL_ENGINE_CFLAGS} ${flag}") diff --git a/ui-gadget-1.pc.in b/ui-gadget-1.pc.in index e6669a8..f9e884e 100644 --- a/ui-gadget-1.pc.in +++ b/ui-gadget-1.pc.in @@ -6,6 +6,6 @@ includedir=@INCLUDE_INSTALL_DIR@/ug-1/ Name: UI Gadget Description: UI Gadget Library Version: @VERSION@ -Requires: bundle x11 capi-appfw-application +Requires: bundle capi-appfw-application Libs: -L${libdir} -lui-gadget-1 Cflags: -I${includedir} -- cgit v1.2.3