Support Wayland and X11 profiles at the same time 55/27055/1 accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi tizen_3.0.2014.q3_common tizen_3.0.2014.q4_common tizen_3.0.2015.q1_common tizen_3.0.m14.3_ivi tizen_3.0_ivi accepted/tizen/common/20140909.100249 accepted/tizen/ivi/20140912.193606 submit/tizen_common/20140909.092918 submit/tizen_ivi/20140912.000000 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m14.3_ivi_release tizen_3.0_ivi_release
authorManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Wed, 3 Sep 2014 16:10:38 +0000 (18:10 +0200)
committerManuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Wed, 3 Sep 2014 16:10:38 +0000 (18:10 +0200)
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 <manuel.bachmann@open.eurogiciel.org>
CMakeLists.txt
packaging/app-core.spec
src/appcore-efl.c
src/appcore-rotation.c
src/appcore.c

index ed8271a..fd053b7 100644 (file)
@@ -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}")
index 4dcd3a7..8c24e65 100644 (file)
@@ -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}
index 9d9ca68..9ef5f96 100644 (file)
 #include <stdlib.h>
 
 #ifdef WAYLAND
-#include <Ecore.h>
 #include <Ecore_Wayland.h>
-#else
+#endif
+
+#ifdef X11
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
 #include <Ecore_X.h>
@@ -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)
 {
index 9906dd6..bfb33af 100644 (file)
 #include <Ecore.h>
 #include "appcore-internal.h"
 
-#ifndef WAYLAND
+#ifdef X11
 #include <Ecore_X.h>
 #include <X11/Xlib.h>
-#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);
index c5dc1e1..841eb08 100644 (file)
@@ -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;