init wayland support 21/13421/14 accepted/tizen/ivi/20140117.181904 accepted/tizen/mobile/20140116.011814 submit/tizen/20140116.012548
authorLi,Limin <liminx.li@intel.com>
Wed, 8 Jan 2014 06:34:40 +0000 (14:34 +0800)
committerLi,Limin <liminx.li@intel.com>
Wed, 8 Jan 2014 06:37:08 +0000 (14:37 +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 app-core package.

Signed-off-by: Li,Limin <liminx.li@intel.com>
Change-Id: I5bbb83cf2e4769bed0e0c33bb646467ec77566f1

CMakeLists.txt
appcore-common-wayland.pc.in [new file with mode: 0644]
appcore-common-x.pc.in [new file with mode: 0644]
appcore-common.pc.in [deleted file]
packaging/app-core.spec
src/appcore-efl.c [changed mode: 0755->0644]
src/appcore-rotation.c [changed mode: 0755->0644]
src/appcore.c [changed mode: 0755->0644]

index bf8ee182282f38b8222a23b7057251420ce8c55e..b4dba814d6c1788ad909d484c1eb773b6905f97f 100644 (file)
@@ -23,16 +23,25 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE)
 # Build appcore-common Library
 # ------------------------------
 SET(APPCORE_COMMON "appcore-common")
-SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c
-#              src/appcore-noti.c src/appcore-pmcontrol.c 
-               src/appcore-rotation.c
-#              src/appcore-util.c
-               src/appcore-X.c)
+SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c src/appcore-rotation.c)
+
+IF (with_wayland)
+       ADD_DEFINITIONS("-DWAYLAND")
+ELSE (with_wayland)
+       SET(SRCS_common ${SRCS_common} src/appcore-X.c)
+ENDIF (with_wayland)
+
 SET(HEADERS_common appcore-common.h)
 
 INCLUDE(FindPkgConfig)
-#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog x11)
-pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog x11 ecore-x)
+SET(APPCORE_PKG_CHECK_MODULES "vconf sensor aul dlog")
+
+IF (with_wayland)
+       pkg_check_modules(pkg_common REQUIRED ${APPCORE_PKG_CHECK_MODULES} ecore)
+ELSE (with_wayland)
+       pkg_check_modules(pkg_common REQUIRED "${APPCORE_PKG_CHECK_MODULES} x11 ecore-x")
+ENDIF (with_wayland)
+
 FOREACH(flag ${pkg_common_CFLAGS})
        SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}")
 ENDFOREACH(flag)
@@ -43,7 +52,11 @@ SET_TARGET_PROPERTIES(${APPCORE_COMMON} PROPERTIES VERSION ${VERSION})
 SET_TARGET_PROPERTIES(${APPCORE_COMMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
 TARGET_LINK_LIBRARIES(${APPCORE_COMMON} ${pkg_common_LDFLAGS} "-ldl")
 
-CONFIGURE_FILE(${APPCORE_COMMON}.pc.in ${APPCORE_COMMON}.pc @ONLY)
+IF (with_wayland)
+       CONFIGURE_FILE(${APPCORE_COMMON}-wayland.pc.in ${APPCORE_COMMON}.pc @ONLY)
+ELSE (with_wayland)
+       CONFIGURE_FILE(${APPCORE_COMMON}-x.pc.in ${APPCORE_COMMON}.pc @ONLY)
+ENDIF (with_wayland)
 
 INSTALL(TARGETS ${APPCORE_COMMON} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_COMMON}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
@@ -60,7 +73,14 @@ SET(SRCS_efl src/appcore-efl.c)
 SET(HEADERS_efl appcore-efl.h)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkg_efl REQUIRED elementary dlog ecore ecore-x gobject-2.0 glib-2.0 aul)
+SET(APPCORE_PKG_CHECK_MODULES2 "elementary dlog ecore gobject-2.0 glib-2.0 aul")
+
+IF (with_wayland)
+        pkg_check_modules(pkg_efl REQUIRED ${APPCORE_PKG_CHECK_MODULES2})
+ELSE (with_wayland)
+        pkg_check_modules(pkg_efl REQUIRED "${APPCORE_PKG_CHECK_MODULES2} ecore-x")
+ENDIF (with_wayland)
+
 FOREACH(flag ${pkg_efl_CFLAGS})
        SET(EXTRA_CFLAGS_efl "${EXTRA_CFLAGS_efl} ${flag}")
 ENDFOREACH(flag)
diff --git a/appcore-common-wayland.pc.in b/appcore-common-wayland.pc.in
new file mode 100644 (file)
index 0000000..1b9e47d
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDEDIR@
+
+Name: app-core-common
+Description: SAMSUNG Linux platform application library
+Version: @VERSION@
+Requires: sensor vconf aul dlog
+Libs: -L${libdir} -lappcore-common
+Cflags: -I${includedir} -I${includedir}/appcore
diff --git a/appcore-common-x.pc.in b/appcore-common-x.pc.in
new file mode 100644 (file)
index 0000000..f9b1519
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDEDIR@
+
+Name: app-core-common
+Description: SAMSUNG Linux platform application library
+Version: @VERSION@
+Requires: sensor vconf aul dlog x11
+Libs: -L${libdir} -lappcore-common
+Cflags: -I${includedir} -I${includedir}/appcore
diff --git a/appcore-common.pc.in b/appcore-common.pc.in
deleted file mode 100644 (file)
index f9b1519..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDEDIR@
-
-Name: app-core-common
-Description: SAMSUNG Linux platform application library
-Version: @VERSION@
-Requires: sensor vconf aul dlog x11
-Libs: -L${libdir} -lappcore-common
-Cflags: -I${includedir} -I${includedir}/appcore
index c6bd884c2645e500cdd7b5f38c8c0c9297858bce..a878ca0f27f814a55d4ad01182cca768095cf9b0 100644 (file)
@@ -1,3 +1,4 @@
+%bcond_with x
 %bcond_with wayland
 
 Name:       app-core
@@ -7,10 +8,12 @@ Release:    48
 Group:      Application Framework
 License:    Apache License, Version 2.0
 Source0:    app-core-%{version}.tar.gz
-%if %{with wayland}
+%if %{with wayland} && !%{with x}
 Source101:  packaging/core-efl-wayland.target
 %else
 Source101:  packaging/core-efl-x.target
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(ecore-x)
 %endif
 Source1001:    app-core.manifest
 BuildRequires:  pkgconfig(sensor)
@@ -18,10 +21,8 @@ BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(rua)
 BuildRequires:  pkgconfig(dlog)
-BuildRequires:  pkgconfig(x11)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(ecore)
-BuildRequires:  pkgconfig(ecore-x)
 BuildRequires:  pkgconfig(gobject-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  cmake
@@ -84,8 +85,11 @@ Application basics template
 cp %{SOURCE1001} .
 
 %build
-%cmake . -DENABLE_GTK=OFF
-
+%cmake . \
+%if %{with wayland} && !%{with x}
+-Dwith_wayland=TRUE\
+%endif
+-DENABLE_GTK=OFF
 
 make %{?jobs:-j%jobs}
 
old mode 100755 (executable)
new mode 100644 (file)
index 8329f21..8f3d9f3
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
+
+#ifndef WAYLAND
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
 #include <Ecore_X.h>
+#endif
+
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 #include <Ecore_Input_Evas.h>
@@ -534,6 +538,7 @@ static bool __update_win(unsigned int win, bool bfobscured)
 }
 
 /* WM_ROTATE */
+#ifndef WAYLAND
 static Ecore_X_Atom _WM_WINDOW_ROTATION_SUPPORTED = 0;
 static Ecore_X_Atom _WM_WINDOW_ROTATION_CHANGE_REQUEST = 0;
 
@@ -595,9 +600,11 @@ static void __set_wm_rotation_support(unsigned int win, unsigned int set)
 }
 
 Ecore_X_Atom atom_parent;
+#endif
 
 static Eina_Bool __show_cb(void *data, int type, void *event)
 {
+#ifndef WAYLAND
        Ecore_X_Event_Window_Show *ev;
        int ret;
        Ecore_X_Window parent;
@@ -622,12 +629,14 @@ static Eina_Bool __show_cb(void *data, int type, void *event)
        }
        else
                __update_win((unsigned int)ev->win, FALSE);
+#endif
 
        return ECORE_CALLBACK_RENEW;
 }
 
 static Eina_Bool __hide_cb(void *data, int type, void *event)
 {
+#ifndef WAYLAND
        Ecore_X_Event_Window_Hide *ev;
        int bvisibility = 0;
 
@@ -645,12 +654,14 @@ static Eina_Bool __hide_cb(void *data, int type, void *event)
                        __do_app(AE_PAUSE, data, NULL);
                }
        }
+#endif
 
        return ECORE_CALLBACK_RENEW;
 }
 
 static Eina_Bool __visibility_cb(void *data, int type, void *event)
 {
+#ifndef WAYLAND
        Ecore_X_Event_Window_Visibility_Change *ev;
        int bvisibility = 0;
 
@@ -670,11 +681,13 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event)
                __do_app(AE_PAUSE, data, NULL);
        } else
                _DBG(" No change state \n");
+#endif
 
        return ECORE_CALLBACK_RENEW;
 
 }
 
+#ifndef WAYLAND
 /* WM_ROTATE */
 static Eina_Bool __cmsg_cb(void *data, int type, void *event)
 {
@@ -709,11 +722,12 @@ static Eina_Bool __cmsg_cb(void *data, int type, void *event)
 
        return ECORE_CALLBACK_PASS_ON;
 }
+#endif
 
 static void __add_climsg_cb(struct ui_priv *ui)
 {
        _ret_if(ui == NULL);
-
+#ifndef WAYLAND
        atom_parent = ecore_x_atom_get("_E_PARENT_BORDER_WINDOW");
        if (!atom_parent)
        {
@@ -736,6 +750,7 @@ static void __add_climsg_cb(struct ui_priv *ui)
                ui->wm_rot_supported = 1;
                appcore_set_wm_rotation(&wm_rotate);
        }
+#endif
 }
 
 static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
@@ -757,11 +772,21 @@ static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
        if(hwacc == NULL) {
                _DBG("elm_config_preferred_engine_set is not called");
        } else if(strcmp(hwacc, "USE") == 0) {
+#ifdef WAYLAND
+               elm_config_preferred_engine_set("wayland_egl");
+               _DBG("elm_config_preferred_engine_set : wayland_egl");
+#else
                elm_config_preferred_engine_set("opengl_x11");
                _DBG("elm_config_preferred_engine_set : opengl_x11");
+#endif
        } else if(strcmp(hwacc, "NOT_USE") == 0) {
+#ifdef WAYLAND
+               elm_config_preferred_engine_set("wayland_shm");
+               _DBG("elm_config_preferred_engine_set : wayland_shm");
+#else
                elm_config_preferred_engine_set("software_x11");
                _DBG("elm_config_preferred_engine_set : software_x11");
+#endif
        } else {
                _DBG("elm_config_preferred_engine_set is not called");
        }
old mode 100755 (executable)
new mode 100644 (file)
index 4fb934d..9906dd6
 
 #include <sensor.h>
 #include <vconf.h>
-#include <Ecore_X.h>
 #include <Ecore.h>
-#include <X11/Xlib.h>
-
 #include "appcore-internal.h"
 
+#ifndef WAYLAND
+#include <Ecore_X.h>
+#include <X11/Xlib.h>
+#endif
+
+#ifndef WAYLAND
+/*Fixme: to be added for wayland works*/
 #define _MAKE_ATOM(a, s)                              \
    do {                                               \
         a = ecore_x_atom_get(s);                      \
@@ -43,6 +47,7 @@
 
 static Ecore_X_Atom ATOM_ROTATION_LOCK = 0;
 static Ecore_X_Window root;
+#endif
 
 struct rot_s {
        int handle;
@@ -240,9 +245,11 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
                rot.handle = handle;
                __add_rotlock(data);
 
+#ifndef WAYLAND
                _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK );
                root =  ecore_x_window_root_first_get();
                XSelectInput(ecore_x_display_get(), root, PropertyChangeMask);
+#endif
        }
        return 0;
 }
old mode 100755 (executable)
new mode 100644 (file)
index da03942..5d46048
@@ -195,7 +195,17 @@ static int __app_reset(void *data, bundle * k)
 
 static int __app_resume(void *data)
 {
+#ifdef WAYLAND
+       struct appcore *ac = data;
+
+       _retv_if(ac == NULL || ac->ops == NULL, -1);
+       _retv_if(ac->ops->cb_app == NULL, 0);
+
+       ac->ops->cb_app(AE_RESUME, ac->ops->data, NULL);
+
+#else
        x_raise_win(getpid());
+#endif
        return 0;
 }