From c8c9b24d4dc2022b9a4d4e072ccc498d4aa677a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Mon, 31 Mar 2014 09:39:57 +0200 Subject: [PATCH] Build in a pure Wayland environment MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Note that this change only allow the package to build in a pure wayland environment but doesn't make it functionnal since some X11 -> Wayland equivalents doesn't exist yet. The changes that remain to be made in order to get it working in a pure Wayland environment are marked by the comment "TO_DO_WAYLAND". Bug report regarding this issue: PTREL-770. Change-Id: I8378bc856c0932f40e2ea7c67e9ddc653339fdfa Signed-off-by: Kévin THIERRY --- frontend/CMakeLists.txt | 17 ++++++++++++++++- frontend/ui/src/rpm-homeview.c | 31 ++++++++++++++++++++++--------- packaging/rpm-installer.spec | 20 ++++++++++++++++---- 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index 54f4ed7..aa20e18 100755 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -30,7 +30,13 @@ pkg_check_modules(COMMCLIENT pkgmgr-installer-client) link_directories (${COMMCLIENT_LIBRARY_DIRS}) include_directories (${COMMCLIENT_INCLUDE_DIRS}) -pkg_check_modules(APPCODEEFL appcore-efl evas ecore edje ecore-input ecore-x) +IF(X11_SUPPORT) + SET(WIN_PKG "ecore-x") +ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + SET(WIN_PKG "${WIN_PKG} ecore-wayland") +ENDIF(WAYLAND_SUPPORT) +pkg_check_modules(APPCODEEFL appcore-efl evas ecore edje ecore-input ${WIN_PKG}) link_directories (${APPCODEEFL_LIBRARY_DIRS}) include_directories (${APPCODEEFL_INCLUDE_DIRS}) @@ -39,6 +45,15 @@ link_directories (${SECURITYSERVER_LIBRARY_DIRS}) include_directories (${SECURITYSERVER_INCLUDE_DIRS}) ## DEFINITIONS + +IF(WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") +ENDIF(WAYLAND_SUPPORT) + +IF(X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") +ENDIF(X11_SUPPORT) + ADD_DEFINITIONS("-DAPP_DIR=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DPACKAGE=\"${PROJECT_NAME}\"") diff --git a/frontend/ui/src/rpm-homeview.c b/frontend/ui/src/rpm-homeview.c index afc80ac..a34e674 100755 --- a/frontend/ui/src/rpm-homeview.c +++ b/frontend/ui/src/rpm-homeview.c @@ -21,8 +21,15 @@ */ #include -#include #include +#if HAVE_X11 +#include +#endif +#if HAVE_WAYLAND +#include +#include +#endif + #include "rpm-frontend.h" #include "rpm-installer-util.h" #include "rpm-homeview.h" @@ -158,6 +165,7 @@ Eina_Bool _ri_init_appdata(struct appdata *user_data) int x; int y; int count = 0; + int ret = 0; user_data->win_main = elm_win_add(NULL, PACKAGE, ELM_WIN_DIALOG_BASIC); if (!user_data->win_main) return EINA_FALSE; @@ -166,15 +174,20 @@ Eina_Bool _ri_init_appdata(struct appdata *user_data) elm_win_alpha_set(user_data->win_main, EINA_TRUE); elm_win_borderless_set(user_data->win_main, EINA_TRUE); elm_win_raise(user_data->win_main); +#if HAVE_X11 ecore_x_window_geometry_get(ecore_x_window_root_get - (ecore_x_window_focus_get()), &x, &y, &w, - &h); - int ret = - ecore_x_window_prop_property_get(ecore_x_window_root_get - (ecore_x_window_focus_get()), - ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, - &prop_data, &count); + (ecore_x_window_focus_get()), &x, &y, &w, + &h); + ret = ecore_x_window_prop_property_get(ecore_x_window_root_get + (ecore_x_window_focus_get()), + ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, + &prop_data, &count); +#elseif HAVE_WAYLAND /* TO_DO_WAYLAND */ + _d_msg(DEBUG_INFO, "Operation not supported in a pure Wayland\ + environment. To do: replace the X11 dependant functions with\ + Wayland compatible ones.\n"); +#endif if (ret && prop_data) memcpy(&rotation, prop_data, sizeof(int)); if (prop_data) diff --git a/packaging/rpm-installer.spec b/packaging/rpm-installer.spec index 8ddb381..2f610b9 100755 --- a/packaging/rpm-installer.spec +++ b/packaging/rpm-installer.spec @@ -1,3 +1,4 @@ +%bcond_with wayland %bcond_with x Name: rpm-installer @@ -36,9 +37,10 @@ BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: gettext-tools %if %{with x} -BuildRequires: pkgconfig(ecore-x) -%else -ExclusiveArch: +BuildRequires: pkgconfig(ecore-x) +%endif +%if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) %endif Requires: cpio @@ -51,7 +53,17 @@ cp %{SOURCE1001} . %build CFLAGS+=" -fpic" -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ +%if %{with wayland} + -DWAYLAND_SUPPORT=On \ +%else + -DWAYLAND_SUPPORT=Off \ +%endif +%if %{with x} + -DX11_SUPPORT=On +%else + -DX11_SUPPORT=Off +%endif make %{?jobs:-j%jobs} -- 2.7.4