From: Manuel Bachmann Date: Wed, 3 Sep 2014 16:10:38 +0000 (+0200) Subject: Support Wayland and X11 profiles at the same time X-Git-Tag: accepted/tizen/common/20140909.100249^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_3.0.2014.q3_common;p=platform%2Fcore%2Fappfw%2Fapp-core.git Support Wayland and X11 profiles at the same time The previous logic of both the packaging and the source code were exclusive ; if you had wayland features, you couldn't have x11, and so was the reverse case. We now try to handle these cases more gracefully. Change-Id: I48eccffbd83c17314377b66c83fce4452d143e60 Signed-off-by: Manuel Bachmann --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8271a..fd053b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,20 +27,21 @@ SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c src/appco IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") -ELSE (with_wayland) +ENDIF (with_wayland) +IF (with_x11) + ADD_DEFINITIONS("-DX11") SET(SRCS_common ${SRCS_common} src/appcore-X.c) ENDIF (with_wayland) SET(HEADERS_common appcore-common.h) INCLUDE(FindPkgConfig) -SET(APPCORE_PKG_CHECK_MODULES "vconf sensor aul dlog libtzplatform-config") +SET(APPCORE_PKG_CHECK_MODULES "vconf sensor aul dlog libtzplatform-config ecore") +IF (with_x11) + SET(APPCORE_PKG_CHECK_MODULES "${APPCORE_PKG_CHECK_MODULES} x11 ecore-x") +ENDIF (with_x11) -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) +pkg_check_modules(pkg_common REQUIRED ${APPCORE_PKG_CHECK_MODULES}) FOREACH(flag ${pkg_common_CFLAGS}) SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}") @@ -54,9 +55,10 @@ TARGET_LINK_LIBRARIES(${APPCORE_COMMON} ${pkg_common_LDFLAGS} "-ldl") 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) +IF (with_x11) + CONFIGURE_FILE(${APPCORE_COMMON}-x.pc.in ${APPCORE_COMMON}.pc @ONLY) +ENDIF (with_x11) INSTALL(TARGETS ${APPCORE_COMMON} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_COMMON}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) @@ -74,12 +76,11 @@ SET(HEADERS_efl appcore-efl.h) INCLUDE(FindPkgConfig) SET(APPCORE_PKG_CHECK_MODULES2 "elementary dlog ecore gobject-2.0 glib-2.0 aul") +IF (with_x11) + SET(APPCORE_PKG_CHECK_MODULES2 "${APPCORE_PKG_CHECK_MODULES2} ecore-x") +ENDIF (with_x11) -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) +pkg_check_modules(pkg_efl REQUIRED ${APPCORE_PKG_CHECK_MODULES2}) FOREACH(flag ${pkg_efl_CFLAGS}) SET(EXTRA_CFLAGS_efl "${EXTRA_CFLAGS_efl} ${flag}") diff --git a/packaging/app-core.spec b/packaging/app-core.spec index 4dcd3a7..8c24e65 100644 --- a/packaging/app-core.spec +++ b/packaging/app-core.spec @@ -8,10 +8,12 @@ Release: 0 Group: Application Framework/Libraries License: Apache-2.0 Source0: app-core-%{version}.tar.gz -%if %{with wayland} && !%{with x} +%if %{with wayland} Source101: packaging/core-efl-wayland.target %else Source101: packaging/core-efl-x.target +%endif +%if %{with x} BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(ecore-x) %endif @@ -71,7 +73,7 @@ Requires: pkgconfig(vconf) Requires: pkgconfig(elementary) Requires: pkgconfig(aul) %if %{with x} -Requires: pkgconfig(x11) +Requires: pkgconfig(x11) %endif %description common-devel @@ -94,9 +96,12 @@ cp %{SOURCE1001} . %build %cmake . \ -%if %{with wayland} && !%{with x} +%if %{with wayland} -Dwith_wayland=TRUE\ %endif +%if %{with x} +-Dwith_x11=TRUE\ +%endif -DENABLE_GTK=OFF make %{?jobs:-j%jobs} diff --git a/src/appcore-efl.c b/src/appcore-efl.c index 9d9ca68..9ef5f96 100644 --- a/src/appcore-efl.c +++ b/src/appcore-efl.c @@ -30,9 +30,10 @@ #include #ifdef WAYLAND -#include #include -#else +#endif + +#ifdef X11 #include #include #include @@ -542,7 +543,7 @@ static bool __update_win(unsigned int win, bool bfobscured) } /* WM_ROTATE */ -#ifndef WAYLAND +#ifdef X11 static Ecore_X_Atom _WM_WINDOW_ROTATION_SUPPORTED = 0; static Ecore_X_Atom _WM_WINDOW_ROTATION_CHANGE_REQUEST = 0; @@ -735,7 +736,7 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event) } -#ifndef WAYLAND +#ifdef X11 /* WM_ROTATE */ static Eina_Bool __cmsg_cb(void *data, int type, void *event) { diff --git a/src/appcore-rotation.c b/src/appcore-rotation.c index 9906dd6..bfb33af 100644 --- a/src/appcore-rotation.c +++ b/src/appcore-rotation.c @@ -29,12 +29,10 @@ #include #include "appcore-internal.h" -#ifndef WAYLAND +#ifdef X11 #include #include -#endif -#ifndef WAYLAND /*Fixme: to be added for wayland works*/ #define _MAKE_ATOM(a, s) \ do { \ @@ -245,7 +243,7 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *), rot.handle = handle; __add_rotlock(data); -#ifndef WAYLAND +#ifdef X11 _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK ); root = ecore_x_window_root_first_get(); XSelectInput(ecore_x_display_get(), root, PropertyChangeMask); diff --git a/src/appcore.c b/src/appcore.c index c5dc1e1..841eb08 100644 --- a/src/appcore.c +++ b/src/appcore.c @@ -205,8 +205,8 @@ static int __app_resume(void *data) _retv_if(ac->ops->cb_app == NULL, 0); ac->ops->cb_app(AE_RESUME, ac->ops->data, NULL); - -#else +#endif +#ifdef X11 x_raise_win(getpid()); #endif return 0;