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
# 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)
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)
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)
--- /dev/null
+# 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
--- /dev/null
+# 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
+++ /dev/null
-# 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
+%bcond_with x
%bcond_with wayland
Name: app-core
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)
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
cp %{SOURCE1001} .
%build
-%cmake . -DENABLE_GTK=OFF
-
+%cmake . \
+%if %{with wayland} && !%{with x}
+-Dwith_wayland=TRUE\
+%endif
+-DENABLE_GTK=OFF
make %{?jobs:-j%jobs}
#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>
}
/* WM_ROTATE */
+#ifndef WAYLAND
static Ecore_X_Atom _WM_WINDOW_ROTATION_SUPPORTED = 0;
static Ecore_X_Atom _WM_WINDOW_ROTATION_CHANGE_REQUEST = 0;
}
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;
}
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;
__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;
__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)
{
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)
{
ui->wm_rot_supported = 1;
appcore_set_wm_rotation(&wm_rotate);
}
+#endif
}
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");
}
#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); \
static Ecore_X_Atom ATOM_ROTATION_LOCK = 0;
static Ecore_X_Window root;
+#endif
struct rot_s {
int handle;
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;
}
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;
}