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 ui-gadget package.
Signed-off-by: Li,Limin <liminx.li@intel.com>
Change-Id: Iceb95b03f824860b2aac74f35c0945380f6cc22a
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-PKG_CHECK_MODULES(PKGS REQUIRED glib-2.0 utilX bundle dlog x11 capi-appfw-application appsvc capi-appfw-app-manager ecore)
+SET(PKGS_CHECK_MODULES "glib-2.0 bundle dlog capi-appfw-application appsvc capi-appfw-app-manager ecore")
+IF (with_x)
+ PKG_CHECK_MODULES(PKGS REQUIRED ${PKGS_CHECK_MODULES} utilX x11)
+ENDIF(with_x)
+
+IF (with_wayland)
+ ADD_DEFINITIONS("-DWAYLAND")
+ PKG_CHECK_MODULES(PKGS REQUIRED ${PKGS_CHECK_MODULES})
+ENDIF (with_wayland)
+
FOREACH(flag ${PKGS_CFLAGS})
SET(CFLAGS "${CFLAGS} ${flag}")
ENDFOREACH(flag)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED
- capi-appfw-application
- capi-system-runtime-info
- appcore-efl
- appsvc
- bundle
- ecore-x
- edje
- dlog
- elementary
- evas
- x11)
+SET(CLIENT_PKGS_CHECK_MODULES "capi-appfw-application capi-system-runtime-info appcore-efl appsvc bundle edje dlog elementary evas")
+
+IF (with_x)
+ PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${CLIENT_PKGS_CHECK_MODULES} ecore-x x11)
+ENDIF(with_x)
+
+IF (with_wayland)
+ PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${CLIENT_PKGS_CHECK_MODULES})
+ENDIF(with_wayland)
FOREACH(flag ${CLIENT_PKGS_CFLAGS})
SET(CLIENT_CFLAGS "${CLIENT_CFLAGS} ${flag}")
#include <stdio.h>
#include <appcore-efl.h>
#include <ui-gadget.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
+#endif
+
#include <dlog.h>
#include <aul.h>
#include <appsvc.h>
#include "ug-client.h"
-#include <Ecore_X.h>
-
#ifdef LOG_TAG
#undef LOG_TAG
#endif
static Evas_Object *create_win(const char *name)
{
+ Ecore_Evas *ee;
Evas_Object *eo;
int w, h;
win_del, NULL);
/* disable destktop mode
evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL); */
- ecore_x_window_size_get(ecore_x_window_root_first_get(),
- &w, &h);
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(eo));
+ evas_output_size_get(ee, &w, &h);
evas_object_resize(eo, w, h);
}
if (win == NULL)
return -1;
ad->win = win;
+
+#ifndef WAYLAND
UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
+#endif
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
Ecore_X_Window id2 = elm_win_xwindow_get(ad->win);
ret = appsvc_request_transient_app(b, id2, svc_cb, "svc test");
+
if (ret)
LOGD("fail to request transient app: return value(%d)", ret);
else
#ifndef __UG_MANAGER_H__
#define __UG_MANAGER_H__
+#ifndef WAYLAND
#include <utilX.h>
+#endif
+
#include "ug.h"
int ugman_ug_add(ui_gadget_h parent, ui_gadget_h ug);
int ugman_ug_del(ui_gadget_h ug);
int ugman_ug_del_all(void);
+#ifndef WAYLAND
int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt);
+#endif
+
int ugman_resume(void);
int ugman_pause(void);
int ugman_send_event(enum ug_event event);
* @addtogroup UI_Gadget_For_User
* @{
*/
-
+#ifndef WAYLAND
#include <X11/Xlib.h>
+#endif
+
#include <app.h>
#ifdef __cplusplus
* Easy-to-use macro of ug_init() for EFL
* @see ug_init()
*/
+#ifndef WAYLAND
#define UG_INIT_EFL(win, opt) \
ug_init((Display *)ecore_x_display_get(), elm_win_xwindow_get(win), \
win, opt)
+#endif
/**
* Easy-to-use macro of ug_init() for GTK
* ...
* \endcode
*/
+#ifndef WAYLAND
int ug_init(Display *disp, Window xid, void *win, enum ug_option opt);
-
+#endif
/**
* \par Description:
* This function creates a UI gadget
+%bcond_with x
+%bcond_with wayland
Name: ui-gadget-1
Summary: UI Gadget Library
Source1001: ui-gadget-1.manifest
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
-BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(dlog)
+%if %{with x}
+BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(x11)
+%endif
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-system-runtime-info)
cp %{SOURCE1001} .
%build
-%cmake .
+%cmake . \
+%if %{with wayland} && !%{with x}
+-Dwith_wayland=TRUE
+%else
+-Dwith_x=TRUE
+%endif
make %{?jobs:-j%jobs}
#include <string.h>
#include <errno.h>
#include <glib.h>
+
+#ifndef WAYLAND
#include <utilX.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#endif
#include <Ecore.h>
GSList *fv_list;
void *win;
+
+#ifndef WAYLAND
Window win_id;
Display *disp;
+#endif
+
void *conform;
enum ug_option base_opt;
return 0;
}
+#ifndef WAYLAND
static int __ug_x_get_window_property(Display *dpy, Window win, Atom atom,
Atom type, unsigned int *val,
unsigned int len)
return num;
}
+#endif
+#ifndef WAYLAND
static enum ug_event __ug_x_rotation_get(Display *dpy, Window win)
{
Window active_win;
func_out:
return func_ret;
}
+#endif
static void ugman_tree_dump(ui_gadget_h ug)
{
int enable;
int cur_state;
+#ifndef WAYLAND
cur_state = utilx_get_indicator_state(ug_man.disp, ug_man.win_id);
+#else
+ cur_state = -1; //state is -1 (unknown)
+#endif
_DBG("indicator update opt(%d) cur_state(%d)", opt, cur_state);
if(cur_state != enable) {
_DBG("set indicator as %d", enable);
+
+#ifndef WAYLAND
utilx_enable_indicator(ug_man.disp, ug_man.win_id, enable);
+#endif
}
return 0;
}
}
if(ug_man.last_rotate_evt == UG_EVENT_NONE) {
+#ifndef WAYLAND
ug_man.last_rotate_evt = __ug_x_rotation_get(ug_man.disp, ug_man.win_id);
+#endif
}
ugman_ug_event(ug, ug_man.last_rotate_evt);
return 0;
}
+#ifndef WAYLAND
int ugman_init(Display *disp, Window xid, void *win, enum ug_option opt)
{
ug_man.is_initted = 1;
return 0;
}
+#endif
int ugman_resume(void)
{
return ugman_ug_load(parent, name, mode, service, cbs);
}
+#ifndef WAYLAND
UG_API int ug_init(Display *disp, Window xid, void *win, enum ug_option opt)
{
if (!win || !xid || !disp) {
return ugman_init(disp, xid, win, opt);
}
+#endif
UG_API int ug_pause(void)
{
SET(UG_ENGINE_EDJ_DIR "${CMAKE_INSTALL_PREFIX}/share/edje")
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.1.0")
+SET(UG_EFL_ENGINE_PKGS_CHECK_MODULES "dlog elementary ecore edje capi-appfw-application evas")
-PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED
- dlog
- elementary
- ecore
- ecore-x
- edje
- capi-appfw-application
- evas)
+IF (with_x)
+ PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED
+ ${UG_EFL_ENGINE_PKGS_CHECK_MODULES}
+ ecore-x)
+ENDIF(with_x)
+
+IF (with_wayland)
+ PKG_CHECK_MODULES(UG_EFL_ENGINE_PKGS REQUIRED
+ ${UG_EFL_ENGINE_PKGS_CHECK_MODULES})
+ENDIF(with_wayland)
FOREACH(flag ${UG_EFL_ENGINE_PKGS_CFLAGS})
SET(UG_EFL_ENGINE_CFLAGS "${UG_EFL_ENGINE_CFLAGS} ${flag}")
Name: UI Gadget
Description: UI Gadget Library
Version: @VERSION@
-Requires: bundle x11 capi-appfw-application
+Requires: bundle capi-appfw-application
Libs: -L${libdir} -lui-gadget-1
Cflags: -I${includedir}