init wayland support 17/13817/7 accepted/tizen/mobile accepted/tizen/generic/20140114.145758 accepted/tizen/ivi/20140110.224049 accepted/tizen/mobile/20140113.182040 submit/tizen/20140110.215645
authorLi,Limin <liminx.li@intel.com>
Wed, 8 Jan 2014 10:01:31 +0000 (18:01 +0800)
committerLi,Limin <liminx.li@intel.com>
Wed, 8 Jan 2014 10:03:38 +0000 (18:03 +0800)
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 <liminx.li@intel.com>
Change-Id: Iceb95b03f824860b2aac74f35c0945380f6cc22a

CMakeLists.txt [changed mode: 0755->0644]
client/CMakeLists.txt [changed mode: 0755->0644]
client/ug-client.c [changed mode: 0755->0644]
include/ug-manager.h [changed mode: 0755->0644]
include/ui-gadget.h [changed mode: 0755->0644]
packaging/ui-gadget-1.spec [changed mode: 0755->0644]
src/manager.c [changed mode: 0755->0644]
src/ug.c [changed mode: 0755->0644]
ug-efl-engine/CMakeLists.txt [changed mode: 0755->0644]
ui-gadget-1.pc.in

old mode 100755 (executable)
new mode 100644 (file)
index 1d8dbba..7733cdf
@@ -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)
old mode 100755 (executable)
new mode 100644 (file)
index cd31296..35f00af
@@ -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}")
old mode 100755 (executable)
new mode 100644 (file)
index cf9819d..46bd4e7
 #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 <appsvc.h>
@@ -31,8 +35,6 @@
 
 #include "ug-client.h"
 
-#include <Ecore_X.h>
-
 #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
old mode 100755 (executable)
new mode 100644 (file)
index 0589ac8..f5ac47e
 #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);
old mode 100755 (executable)
new mode 100644 (file)
index dfa13b4..fbad11d
  * @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
old mode 100755 (executable)
new mode 100644 (file)
index 6533105..34335b2
@@ -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}
 
old mode 100755 (executable)
new mode 100644 (file)
index bc3de24..c96d5b2
 #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>
 
@@ -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)
 {
old mode 100755 (executable)
new mode 100644 (file)
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)
 {
old mode 100755 (executable)
new mode 100644 (file)
index d498e2d..6005fa5
@@ -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}")
index e6669a8..f9e884e 100644 (file)
@@ -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}