Build in a pure Wayland environment 42/18742/3
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Mon, 31 Mar 2014 07:39:57 +0000 (09:39 +0200)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Mon, 31 Mar 2014 11:59:30 +0000 (13:59 +0200)
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 <kevin.thierry@open.eurogiciel.org>
frontend/CMakeLists.txt
frontend/ui/src/rpm-homeview.c
packaging/rpm-installer.spec

index 54f4ed7..aa20e18 100755 (executable)
@@ -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}\"")
 
index afc80ac..a34e674 100755 (executable)
  */
 
 #include <appcore-efl.h>
-#include <Ecore_X.h>
 #include <pthread.h>
+#if HAVE_X11
+#include <Ecore_X.h>
+#endif
+#if HAVE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#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)
index 8ddb381..2f610b9 100755 (executable)
@@ -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}