init wayland support. 92/13292/8 accepted/tizen/ivi/release accepted/tizen/ivi/stable accepted/tizen/generic/20140106.141754 accepted/tizen/generic/20140110.150327 accepted/tizen/ivi/20131231.184141 accepted/tizen/ivi/release/20140108.212106 accepted/tizen/mobile/20140107.212758 submit/tizen/20131231.041855 submit/tizen/20140108.022351 submit/tizen_ivi_release/20140108.030040
authorwangfei <feix.w.wang@intel.com>
Fri, 20 Dec 2013 08:10:33 +0000 (03:10 -0500)
committerwangfei <feix.w.wang@intel.com>
Fri, 20 Dec 2013 08:38:54 +0000 (03:38 -0500)
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 <feix.w.wang@intel.com>
CMakeLists.txt
packaging/capi-system-info.spec
src/system_info_screen.c

index 1a651c3..2cc7e4e 100644 (file)
@@ -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)
index 837c2fe..c6a55e0 100644 (file)
@@ -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}
 
index 9bb5f0f..9af9f81 100644 (file)
 
 #include <dlog.h>
 
+#ifndef WAYLAND_PLATFORM
 #include <X11/Xlib.h>
 #include <X11/extensions/Xrandr.h>
+#endif
 
 #include <system_info.h>
 #include <system_info_private.h>
@@ -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)