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)
+%bcond_with x
+%bcond_with wayland
Name: capi-system-info
Version: 0.2.0
Release: 0
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
%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}
#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>
/* 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;
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");
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)