From: wangfei Date: Fri, 20 Dec 2013 08:10:33 +0000 (-0500) Subject: init wayland support. X-Git-Tag: submit/tizen/20131231.041855^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c5c7dc94b75350e7ecd82c5b248e8f8ea3e6fbb;p=platform%2Fcore%2Fapi%2Fsystem-info.git init wayland support. The display server based on X or Wayland, is now a choice of different profile in Tizen 3.0. Basically and consistently, two macros were used "with wayland" and "with x". Below summarize the combination of the macros: | wayland | x | meaning |--------------------------- | 0 | 1 | pure X11 platform(no wayland) | 1 | 0 | pure wayland platform (no X11) | 1 | 1 | wayland but X compatibility | 0 | 0 | no X and no wayland This method unifies the meaning and usage. Deploy this method to capi-system-info package. Currently we need "pure wayland platform (no X11)" status,so "with wayland" and "with x" are defined into "1" and "0" in build.conf file.If you need other status of above illustration, please change values of "with x" and "with wayland" in your build.conf file. Change-Id: If8c3b9e099d60fc892140fe480fe6b52e8a66d6a Signed-off-by: wangfei --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a651c3..2cc7e4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,12 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) +IF(ENABLE_WAYLAND) + ADD_DEFINITIONS("-DWAYLAND_PLATFORM") +SET(requires "dlog capi-base-common iniparser libxml-2.0") +ELSE(ENABLE_WAYLAND) SET(requires "dlog capi-base-common xi xrandr iniparser libxml-2.0") +ENDIF(ENABLE_WAYLAND) SET(pc_requires "capi-base-common") INCLUDE(FindPkgConfig) diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec index 837c2fe..c6a55e0 100644 --- a/packaging/capi-system-info.spec +++ b/packaging/capi-system-info.spec @@ -1,3 +1,5 @@ +%bcond_with x +%bcond_with wayland Name: capi-system-info Version: 0.2.0 Release: 0 @@ -13,9 +15,14 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(vconf) +%if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) +%endif +%if %{with x} BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xi) BuildRequires: pkgconfig(xrandr) +%endif %description A System Information library in SLP C API @@ -34,7 +41,11 @@ cp %{SOURCE1001} . %build MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%if !%{with x} && %{with wayland} +%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DENABLE_WAYLAND=TRUE +%else %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%endif make %{?_smp_mflags} diff --git a/src/system_info_screen.c b/src/system_info_screen.c index 9bb5f0f..9af9f81 100644 --- a/src/system_info_screen.c +++ b/src/system_info_screen.c @@ -21,8 +21,10 @@ #include +#ifndef WAYLAND_PLATFORM #include #include +#endif #include #include @@ -37,7 +39,16 @@ typedef struct _progInfo ProgInfo; /* globals */ ProgInfo g_pinfo; - +#ifdef WAYLAND_PLATFORM +struct _progInfo { + int *dpy; + int root; + int screen; + int event_base, error_base; + int major, minor; + int *res; +}; +#else struct _progInfo { Display *dpy; Window root; @@ -46,17 +57,22 @@ struct _progInfo { int major, minor; XRRScreenResources *res; }; - +#endif static int PHYSICAL_SCREEN_WIDTH; static int PHYSICAL_SCREEN_HEIGHT; int system_info_screen_initialized; int system_info_screen_init() { - int i; memset(&g_pinfo, 0x0, sizeof(ProgInfo)); - + #ifdef WAYLAND_PLATFORM + //In wayland environment, noting to do in this function, FIXME if necessary. + LOGE("In wayland environment, system_info_screen_init Failed"); + system_info_screen_initialized = 1; + return -1; + #else + int i; g_pinfo.dpy = XOpenDisplay(NULL); if (NULL == g_pinfo.dpy) { LOGE("XOpenDisplay Failed"); @@ -110,6 +126,7 @@ int system_info_screen_init() system_info_screen_initialized = 1; return 0; + #endif } int system_info_get_screen_width(system_info_key_e key, system_info_data_type_e data_type, void **value)