Fix build of capi system-setting in pure Wayland.
authorRonan Le Martret <ronan@fridu.net>
Mon, 17 Feb 2014 15:56:48 +0000 (16:56 +0100)
committerPhilippe Coval <philippe.coval@open.eurogiciel.org>
Thu, 6 Mar 2014 13:50:50 +0000 (14:50 +0100)
Replace ecore-x by ecore-wayland in Pure Wayland.
No font change notification on wayland, I don't know
if it's possible.

Change-Id: Ia9cccb44babc3aeaaeaa82586c0a51a31cb05ed3
Signed-off-by: Ronan Le Martret <ronan@fridu.net>
CMakeLists.txt
TC_gui/main.c
TC_gui/main.h
packaging/capi-system-system-settings.spec
src/system_setting_platform.c

index 761010a..d340457 100755 (executable)
@@ -10,7 +10,12 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
+IF(X11_SUPPORT)
 SET(requires "elementary ecore ecore-x ecore-file dlog vconf appcore-efl capi-base-common glib-2.0 gobject-2.0 fontconfig libxml-2.0")
+ELSE(WAYLAND_SUPPORT)
+SET(requires "elementary ecore ecore-wayland ecore-file dlog vconf appcore-efl capi-base-common glib-2.0 gobject-2.0 fontconfig libxml-2.0")
+ENDIF(X11_SUPPORT)
+
 SET(pc_requires "capi-base-common")
 
 
@@ -57,7 +62,20 @@ SET_TARGET_PROPERTIES(${fw_name}
 ADD_EXECUTABLE(test_gui TC_gui/main.c)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(test_gui REQUIRED "elementary appcore-efl ecore-imf ecore-x ecore-x eina ecore ecore-evas ecore-input")
+
+IF(X11_SUPPORT)
+    ADD_DEFINITIONS("-DUSE_X11")
+ENDIF(X11_SUPPORT)
+IF(WAYLAND_SUPPORT)
+    ADD_DEFINITIONS("-DUSE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+
+IF(X11_SUPPORT)
+pkg_check_modules(test_gui REQUIRED "elementary appcore-efl eina ecore-imf ecore-x ecore ecore-evas ecore-input")
+ELSE(WAYLAND_SUPPORT)
+pkg_check_modules(test_gui REQUIRED "elementary appcore-efl eina ecore-imf ecore ecore-wayland ecore-evas ecore-input")
+ENDIF(X11_SUPPORT)
+
 FOREACH(flag ${test_gui_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
@@ -94,10 +112,10 @@ IF(UNIX)
 
 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
 ADD_CUSTOM_COMMAND(
-        DEPENDS clean 
+        DEPENDS clean
         COMMENT "distribution clean"
         COMMAND find
-        ARGS    . 
+        ARGS    .
         -not -name config.cmake -and \(
         -name tester.c -or
         -name Testing -or
index 7b08f6d..3a9d4f1 100644 (file)
@@ -35,7 +35,25 @@ static Evas_Object* create_win(const char *name)
     elm_win_borderless_set(eo, EINA_TRUE);
     elm_win_autodel_set(eo, EINA_TRUE);
     evas_object_smart_callback_add(eo, "delete,request", _quit_cb, NULL);
-    ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+
+#ifdef USE_X11
+       Ecore_X_Window *xwin;
+       xwin = elm_win_xwindow_get(eo);
+       if (xwin != NULL){
+         ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+       }
+       else {
+#endif
+#ifdef USE_WAYLAND
+         Ecore_Wl_Window *wlwin;
+         wlwin = elm_win_wl_window_get(eo);
+         if (wlwin != NULL)
+           ecore_wl_screen_size_get(&w, &h);
+#endif
+#ifdef USE_X11
+       }
+#endif
+
     evas_object_resize(eo, w, h);
 
     return eo;
index c9db973..7110d4c 100644 (file)
 #include <stdio.h>
 #include <Elementary.h>
 #include <appcore-efl.h>
-#include <Ecore_X.h>
 
+#ifdef USE_X11
+#include <Ecore_X.h>
+#endif
+#ifdef USE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
 
 #define PACKAGE "com.samsung.appcore-mini"
 
index 03e6d09..c3e7496 100755 (executable)
@@ -1,3 +1,6 @@
+%bcond_with x
+%bcond_with wayland
+
 Name:       capi-system-system-settings
 Summary:    A System Settings library in Tizen Native API
 Version:    0.0.2
@@ -13,7 +16,12 @@ BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(ecore)
-BuildRequires:  pkgconfig(ecore-x)
+%if %{with x}
+BuildRequires: pkgconfig(ecore-x)
+%endif
+%if %{with wayland}
+BuildRequires: pkgconfig(ecore-wayland)
+%endif
 BuildRequires:  pkgconfig(ecore-file)
 BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(capi-base-common)
@@ -44,7 +52,17 @@ cp %{SOURCE1001} %{SOURCE1002} .
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+%if %{with x}
+        -DX11_SUPPORT=On \
+%else
+        -DX11_SUPPORT=Off \
+%endif
+%if %{with wayland}
+        -DWAYLAND_SUPPORT=On
+%else
+        -DWAYLAND_SUPPORT=Off
+%endif
 
 make %{?jobs:-j%jobs}
 
index e53c5c1..9e5ec4e 100755 (executable)
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 
+#ifdef USE_X11
 #include <Ecore_X.h>
+#endif
+#ifdef USE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
+
 #include <Elementary.h>
 
 #include <system_settings.h>
@@ -214,7 +221,7 @@ int _is_file_accessible(const char * path)
     int ret = access(path ,R_OK);
     if (ret == 0)
        {
-               SETTING_TRACE("found the file  %s", path); 
+               SETTING_TRACE("found the file  %s", path);
         return 0;
        }
     else
@@ -603,10 +610,21 @@ static char* _get_cur_font()
 
 static void font_config_set_notification()
 {
-    /* notification */
-       Ecore_X_Window ecore_win = ecore_x_window_root_first_get();
-       Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
-       ecore_x_window_prop_string_set(ecore_win, atom, "tizen");
+#ifdef USE_X11
+         /* notification */
+         Ecore_X_Window ecore_xwin = ecore_x_window_root_first_get();
+         if (ecore_xwin != NULL)        {
+         Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
+         ecore_x_window_prop_string_set(ecore_xwin, atom, "tizen");
+         }
+         else {
+#endif
+#ifdef USE_WAYLAND
+        //No font change notification on Wayland.(yet?)
+#endif
+#ifdef USE_X11
+       }
+#endif
 }
 
 static void font_config_set(char *font_name)