From 4f7a20c501a8f892f64ac8aaa41a1c91dda3cce6 Mon Sep 17 00:00:00 2001 From: Ronan Le Martret Date: Mon, 17 Feb 2014 16:56:48 +0100 Subject: [PATCH] Fix build of capi system-setting in pure Wayland. Replace ecore-x by ecore-wayland in Pure Wayland. No font change notification on wayland, I don't know if it's possible. Also support X11+wayland configuration (else FTBFS) Bug-Tizen: PTREL-653/part Change-Id: Ia9cccb44babc3aeaaeaa82586c0a51a31cb05ed3 Signed-off-by: Ronan Le Martret Signed-off-by: Philippe Coval --- CMakeLists.txt | 31 ++++++++++++++++++++++++++---- TC_gui/main.c | 17 +++++++++++++++- TC_gui/main.h | 8 +++++++- packaging/capi-system-system-settings.spec | 22 +++++++++++++++++++-- src/system_setting_platform.c | 26 +++++++++++++++++++++---- 5 files changed, 92 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 761010a..1970779 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,21 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -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") +IF(X11_SUPPORT) +SET(ecore "ecore ecore-x") +ENDIF(X11_SUPPORT) + +IF(WAYLAND_SUPPORT) +SET(ecore "ecore ecore-wayland") +ENDIF(WAYLAND_SUPPORT) + +SET(requires + dlog vconf + elementary ${ecore} ecore-file appcore-efl + capi-base-common + glib-2.0 gobject-2.0 fontconfig libxml-2.0 +) + SET(pc_requires "capi-base-common") @@ -57,7 +71,16 @@ 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) + +pkg_check_modules(test_gui REQUIRED ${ecore} "elementary appcore-efl eina ecore-imf ecore-evas ecore-input") + FOREACH(flag ${test_gui_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -94,10 +117,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 diff --git a/TC_gui/main.c b/TC_gui/main.c index 7b08f6d..79daa7b 100644 --- a/TC_gui/main.c +++ b/TC_gui/main.c @@ -35,7 +35,22 @@ 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 = 0; + xwin = elm_win_xwindow_get(eo); + if (xwin > 0) ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + else { +#endif +#ifdef USE_WAYLAND + Ecore_Wl_Window *wlwin = NULL; + 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; diff --git a/TC_gui/main.h b/TC_gui/main.h index c9db973..7110d4c 100644 --- a/TC_gui/main.h +++ b/TC_gui/main.h @@ -19,8 +19,14 @@ #include #include #include -#include +#ifdef USE_X11 +#include +#endif +#ifdef USE_WAYLAND +#include +#include +#endif #define PACKAGE "com.samsung.appcore-mini" diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec index 03e6d09..c3e7496 100755 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -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} diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index e53c5c1..ef3843a 100755 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -32,7 +32,14 @@ #include #include +#ifdef USE_X11 #include +#endif +#ifdef USE_WAYLAND +#include +#include +#endif + #include #include @@ -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() { +#ifdef USE_X11 /* 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"); + Ecore_X_Window ecore_xwin = ecore_x_window_root_first_get(); + if (ecore_xwin != 0) { + 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) -- 2.7.4