diff options
-rw-r--r--[-rwxr-xr-x] | CMakeLists.txt | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | client/CMakeLists.txt | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | client/ug-client.c | 22 | ||||
-rw-r--r--[-rwxr-xr-x] | include/ug-manager.h | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | include/ui-gadget.h | 9 | ||||
-rw-r--r-- | packaging/ui-gadget-1.manifest | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | packaging/ui-gadget-1.spec | 29 | ||||
-rw-r--r--[-rwxr-xr-x] | src/manager.c | 23 | ||||
-rw-r--r-- | src/module.c | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | src/ug.c | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | ug-efl-engine/CMakeLists.txt | 19 | ||||
-rw-r--r-- | ui-gadget-1.manifest | 14 | ||||
-rw-r--r-- | ui-gadget-1.pc.in | 2 |
13 files changed, 120 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bcb15f..c665300 100755..100644 --- 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 dlog x11 capi-appfw-application capi-appfw-app-manager ecore) +SET(PKGS_CHECK_MODULES "glib-2.0 bundle dlog capi-appfw-application appsvc capi-appfw-app-manager ecore libtzplatform-config") +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) @@ -45,7 +54,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-module.h DESTINATION INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget-engine.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ui-gadget.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_UI_Gadget_PG.h DESTINATION ${INCLUDE_INSTALL_DIR}/ug-1) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/ui-gadget-1.rule DESTINATION /opt/etc/smack/accesses.d) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/ui-gadget-1.rule DESTINATION ${TZ_SYS_ETC}/smack/accesses.d) ADD_SUBDIRECTORY(ug-efl-engine) ADD_SUBDIRECTORY(client) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 5100421..3bb2d21 100755..100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,24 +1,21 @@ SET(CLIENT ug-client) SET(CLIENT_SRCS ug-client.c) SET(CLIENT_VENDOR samsung) -SET(CLIENT_DIR /usr/bin) +SET(CLIENT_DIR ${TZ_SYS_BIN}) SET(CLIENT_LOCALEDIR /usr/share/locale) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED - capi-appfw-application - appcore-efl - appsvc - bundle - ecore-x - edje - dlog - elementary - evas - x11 - vconf) +SET(CLIENT_PKGS_CHECK_MODULES "capi-appfw-application capi-system-runtime-info appcore-efl appsvc bundle edje dlog elementary evas vconf") + +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 index 18adf88..0c79d1e 100755..100644 --- a/client/ug-client.c +++ b/client/ug-client.c @@ -22,7 +22,11 @@ #include <stdio.h> #include <appcore-efl.h> #include <ui-gadget.h> + +#ifndef WAYLAND #include <Ecore_X.h> +#endif + #include <dlog.h> #include <aul.h> #include <app.h> @@ -30,13 +34,14 @@ #include "ug-client.h" -#include <Ecore_X.h> -#include <utilX.h> +#include <tzplatform_config.h> #ifdef LOG_TAG #undef LOG_TAG #endif +#define PATH_UG_LAUNCHER tzplatform_mkpath(TZ_SYS_BIN,"ug-launcher") + #define LOG_TAG "UI_GADGET_CLIENT" static void prt_usage(const char *cmd) @@ -215,6 +220,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; @@ -226,8 +232,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); elm_win_indicator_mode_set(eo,ELM_WIN_INDICATOR_SHOW); @@ -314,7 +320,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); @@ -348,12 +357,14 @@ static int app_create(void *data) } else { LOGE("elm win rotation get error"); } + /* if(elm_win_wm_rotation_supported_get(win)) { int rots[4] = { 0, 90, 180, 270 }; elm_win_wm_rotation_available_rotations_set(win, (const int*)&rots, 4); } else { LOGW("wm rotation supported get error"); } + */ evas_object_smart_callback_add(win, "wm,rotation,changed", rotate, data); appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, low_memory, ad); @@ -435,6 +446,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); if(vconf_notify_key_changed(VCONFKEY_IDLE_SCREEN_TOP, _home_screen_top_cb, ad) != 0) { @@ -513,7 +525,7 @@ int main(int argc, char *argv[]) cmdlen = strlen(argv[0]); if (strncmp(argv[0], "ug-launcher", cmdlen) == 0 - || strncmp(argv[0], "/usr/bin/ug-launcher", cmdlen) == 0) { + || strncmp(argv[0], PATH_UG_LAUNCHER , cmdlen) == 0) { while ((opt = getopt(argc, argv, "n:d:")) != -1) { switch (opt) { case 'n': diff --git a/include/ug-manager.h b/include/ug-manager.h index 0589ac8..f5ac47e 100755..100644 --- 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 <utilX.h> +#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 index 7ff338d..41f5637 100755..100644 --- a/include/ui-gadget.h +++ b/include/ui-gadget.h @@ -54,8 +54,10 @@ * @addtogroup UI_Gadget_For_User * @{ */ - +#ifndef WAYLAND #include <X11/Xlib.h> +#endif + #include <app.h> #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.manifest b/packaging/ui-gadget-1.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/ui-gadget-1.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/packaging/ui-gadget-1.spec b/packaging/ui-gadget-1.spec index f124dcf..3c084a9 100755..100644 --- 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 @@ -6,20 +8,24 @@ Release: 1 Group: System/Libraries License: Apache License, Version 2.0 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-appfw-app-manager) BuildRequires: pkgconfig(vconf) BuildRequires: cmake BuildRequires: edje-bin +BuildRequires: pkgconfig(libtzplatform-config) %description UI gadget library (development headers) @@ -28,14 +34,25 @@ UI gadget library (development headers) Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} +%if %{with x} +Requires: pkgconfig(x11) +%endif + %description devel Development files for %{name} %prep %setup -q +cp %{SOURCE1001} . %build -%cmake . +%cmake . \ +-DTZ_SYS_ETC=%TZ_SYS_ETC \ +%if %{with wayland} && !%{with x} +-Dwith_wayland=TRUE +%else +-Dwith_x=TRUE +%endif make %{?jobs:-j%jobs} @@ -45,23 +62,25 @@ rm -rf %{buildroot} mkdir -p %{buildroot}/usr/share/license install LICENSE %{buildroot}/usr/share/license/%{name} -%post +%post /sbin/ldconfig +ln -sf %{TZ_SYS_BIN}/ug-client %{TZ_SYS_BIN}/ug-launcher %postun -p /sbin/ldconfig %files -%manifest ui-gadget-1.manifest +%manifest %{name}.manifest %defattr(-,root,root,-) %{_libdir}/*.so.* %{_libdir}/lib%{name}-efl-engine.so /usr/share/edje/ug_effect.edj %{_bindir}/ug-client /usr/share/edje/ug-client/*.edj -/opt/etc/smack/accesses.d/ui-gadget-1.rule +%{TZ_SYS_ETC}/smack/accesses.d/ui-gadget-1.rule /usr/share/license/%{name} %files devel +%manifest %{name}.manifest %defattr(-,root,root,-) %{_includedir}/ug-1/*.h %{_libdir}/libui-gadget-1.so diff --git a/src/manager.c b/src/manager.c index c0a13a3..015e1eb 100755..100644 --- a/src/manager.c +++ b/src/manager.c @@ -24,9 +24,12 @@ #include <string.h> #include <errno.h> #include <glib.h> + +#ifndef WAYLAND #include <utilX.h> #include <X11/Xatom.h> #include <X11/Xutil.h> +#endif #include <Ecore.h> @@ -46,8 +49,12 @@ struct ug_manager { GSList *fv_list; void *win; + +#ifndef WAYLAND Window win_id; Display *disp; +#endif + void *conform; enum ug_option base_opt; @@ -122,6 +129,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) @@ -158,7 +166,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; @@ -214,6 +224,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) { @@ -397,7 +408,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); @@ -429,8 +444,10 @@ static int ugman_indicator_update(enum ug_option opt, enum ug_event event) #endif if(cur_state != enable) { - _DBG("set indicator status as %d", enable); + _DBG("set indicator as %d", enable); +#ifndef WAYLAND utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable); +#endif } return 0; @@ -621,7 +638,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); @@ -872,6 +891,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.win = win; @@ -888,6 +908,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/module.c b/src/module.c index ddc34bd..e07291e 100644 --- a/src/module.c +++ b/src/module.c @@ -33,6 +33,8 @@ #include "ug-module.h" #include "ug-dbg.h" +#include <tzplatform_config.h> + #define UG_MODULE_INIT_SYM "UG_MODULE_INIT" #define UG_MODULE_EXIT_SYM "UG_MODULE_EXIT" @@ -129,10 +131,10 @@ struct ug_module *ug_module_load(const char *name) do { if (pkg_name) { - snprintf(ug_file, PATH_MAX, "/usr/apps/%s/lib/libug-%s.so", pkg_name, name); + snprintf(ug_file, PATH_MAX, "%s/%s/lib/libug-%s.so", tzplatform_getenv(TZ_SYS_RO_APP), pkg_name, name); if (file_exist(ug_file)) break; - snprintf(ug_file, PATH_MAX, "/opt/apps/%s/lib/libug-%s.so", pkg_name, name); + snprintf(ug_file, PATH_MAX, "%s/%s/lib/libug-%s.so", tzplatform_getenv(TZ_SYS_RO_APP), pkg_name, name); if (file_exist(ug_file)) break; } @@ -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 index d498e2d..6005fa5 100755..100644 --- 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.manifest b/ui-gadget-1.manifest deleted file mode 100644 index 95b3ff3..0000000 --- a/ui-gadget-1.manifest +++ /dev/null @@ -1,14 +0,0 @@ -<manifest> - <define> - <domain name="ui-gadget"/> - <provide> - <label name="ui-gadget::client"/> - </provide> - </define> - <assign> - <filesystem path="/usr/bin/ug-client" label="ui-gadget::client" exec_label="ui-gadget::client"/> - </assign> - <request> - <domain name="_"/> - </request> -</manifest> 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} |