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 starter package.
Signed-off-by: Li,Limin <liminx.li@intel.com>
Change-Id: Idcdda548d545720c7649c10afba209be48fa33c9
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
- ail
- aul
- capi-system-media-key
- db-util
- dlog
- ecore
- ecore-evas
- ecore-input
- ecore-x
- eet
- eina
- elementary
- evas
- heynoti
- sysman
- syspopup-caller
- utilX
- vconf
- x11
- xcomposite
- xext
- appcore-efl
- glib-2.0
- ui-gadget-1
- bundle
- capi-appfw-application
- capi-system-info
- pkgmgr-info
-)
+SET(PKGS_CHECK_MODULES
+ ail
+ aul
+ capi-system-media-key
+ db-util
+ dlog
+ ecore
+ ecore-evas
+ ecore-input
+ eet
+ eina
+ elementary
+ evas
+ heynoti
+ sysman
+ syspopup-caller
+ vconf
+ appcore-efl
+ glib-2.0
+ ui-gadget-1
+ bundle
+ capi-appfw-application
+ capi-system-info
+ pkgmgr-info)
+
+IF (with_x)
+ pkg_check_modules(pkgs REQUIRED ${PKGS_CHECK_MODULES} ecore-x utilX x11 xcomposite xext)
+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(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+%bcond_with x
+%bcond_with wayland
+
Name: starter
Summary: starter
Version: 0.4.62
BuildRequires: pkgconfig(syspopup-caller)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(ui-gadget-1)
+%if %{with x}
BuildRequires: pkgconfig(utilX)
-BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcomposite)
BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(ecore-x)
+%endif
+BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: cmake
%setup -q
cp %{SOURCE1001} .
-%cmake .
-
%build
+%cmake . \
+%if %{with wayland} && !%{with x}
+-Dwith_wayland=TRUE
+%else
+-Dwith_x=TRUE
+%endif
make -j1
%install
#include <ail.h>
#include <bundle.h>
#include <Elementary.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
+#include <utilX.h>
+#endif
+
#include <Ecore_Input.h>
#include <sysman.h>
#include <syspopup_caller.h>
-#include <utilX.h>
#include <vconf.h>
#include <system/media_key.h>
return ECORE_CALLBACK_RENEW;
}
+#ifndef WAYLAND
if (!strcmp(ev->keyname, KEY_END)) {
} else if (!strcmp(ev->keyname, KEY_CONFIG)) {
} else if (!strcmp(ev->keyname, KEY_SEND)) {
} else if (!strcmp(ev->keyname, KEY_MEDIA)) {
_release_multimedia_key("KEY_PLAYCD");
}
+#endif
return ECORE_CALLBACK_RENEW;
}
return ECORE_CALLBACK_RENEW;
}
+#ifndef WAYLAND
if (!strcmp(ev->keyname, KEY_SEND)) {
_D("Launch calllog");
if (menu_daemon_open_app(CALLLOG_PKG_NAME) < 0)
} else if (!strcmp(ev->keyname, KEY_MEDIA)) {
_D("Media key is pressed");
}
+#endif
return ECORE_CALLBACK_RENEW;
}
void create_key_window(void)
{
+#ifndef WAYLAND
key_info.win = ecore_x_window_input_new(0, 0, 0, 1, 1);
if (!key_info.win) {
_D("Failed to create hidden window");
_D("Failed to register a key down event handler");
media_key_reserve(_media_key_event_cb, NULL);
+#endif
}
void destroy_key_window(void)
{
+#ifndef WAYLAND
utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_HOME);
utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEDOWN);
utilx_ungrab_key(ecore_x_display_get(), key_info.win, KEY_VOLUMEUP);
key_info.win = 0x0;
media_key_release();
+#endif
}
#include <Elementary.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
#include <utilX.h>
+#endif
+
#include <ui-gadget.h>
#include <vconf.h>
#include <bundle.h>
return ECORE_CALLBACK_PASS_ON;
}
+#ifndef WAYLAND
static int
_lockd_window_check_validate_rect(Ecore_X_Display * dpy, Ecore_X_Window window)
{
return ret;
}
+#endif
+#ifndef WAYLAND
static Window get_user_created_window(Window win)
{
Atom type_ret = 0;
return xid;
}
+#endif
Eina_Bool
lockd_window_set_window_property(lockw_data * data, int lock_app_pid,
void *event)
{
+#ifndef WAYLAND
Ecore_X_Event_Window_Create *e = event;
Ecore_X_Window user_window = 0;
lockw_data *lockw = (lockw_data *) data;
return EINA_TRUE;
}
}
+#endif
+
return EINA_FALSE;
}
Eina_Bool
lockd_window_set_window_effect(lockw_data * data, int lock_app_pid, void *event)
{
+#ifndef WAYLAND
Ecore_X_Event_Window_Create *e = event;
Ecore_X_Window user_window = 0;
int pid = 0;
return EINA_TRUE;
}
}
+#endif
+
return EINA_FALSE;
}
LOCKD_ERR("lockw is NULL.");
return;
}
+#ifndef WAYLAND
lockw->h_wincreate =
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE, create_cb,
data);
lockw->h_keydown =
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
_lockd_window_key_down_cb, lockw);
+#endif
}
void lockd_window_mgr_finish_lock(lockw_data * lockw)
{
+#ifndef WAYLAND
Ecore_X_Window xwin;
if (lockw == NULL) {
ecore_event_handler_del(lockw->h_keydown);
lockw->h_keydown = NULL;
}
+#endif
}
lockw_data *lockd_window_init(void)
#include <stdio.h>
#include <stdlib.h>
+#ifndef WAYLAND
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#endif
#define DEFAULT_WINDOW_H 1280
void prop_string_set(const char *name, const char *value)
{
+#ifndef WAYLAND
Display *d;
Atom a_name;
Atom a_UTF8;
exit:
XCloseDisplay(d);
+#endif
}
void prop_int_set(const char *name, unsigned int val)
{
+#ifndef WAYLAND
Display *d;
Atom a_name;
exit:
XCloseDisplay(d);
+#endif
}
void set_window_scale(void)
{
+#ifndef WAYLAND
double root_width = 0.0, root_height = 0.0;
char buf[128] = { 0, };
Display *disp;
setenv("ELM_SCALE", buf, 1);
setenv("SCALE_FACTOR", buf, 1);
+#endif
}
#include <aul.h>
#include <dlog.h>
#include <Ecore.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
+#endif
+
#include <Evas.h>
#include <errno.h>
#include <stdbool.h>
int errno;
-
+#ifndef WAYLAND
static inline int _get_pid(Ecore_X_Window win)
{
int pid;
return pid;
}
-
+#endif
bool _set_idlescreen_top(void)
{
+#ifndef WAYLAND
Ecore_X_Window win;
int is_top;
xmonitor_info.is_top = is_top;
_D("set the key of idlescreen_is_top as %d", is_top);
}
+#endif
return true;
}
static Eina_Bool _create_cb(void *data, int type, void *event)
{
+#ifndef WAYLAND
Ecore_X_Event_Window_Create *info = event;
_D("Create a window[%x]", info->win);
ecore_x_window_client_sniff(info->win);
+#endif
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool _focus_in_cb(void *data, int type, void *event)
{
+#ifndef WAYLAND
Ecore_X_Event_Window_Focus_In *info = event;
_D("Focus in a window[%x]", info->win);
retv_if(false == _set_idlescreen_top(), ECORE_CALLBACK_PASS_ON);
+#endif
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool _focus_out_cb(void *data, int type, void *event)
{
+#ifndef WAYLAND
Ecore_X_Event_Window_Focus_Out *info = event;
_D("Focus out a window[%x]", info->win);
+#endif
return ECORE_CALLBACK_PASS_ON;
}
static inline void _sniff_all_windows(void)
{
+#ifndef WAYLAND
Ecore_X_Window root;
Ecore_X_Window ret;
struct stack_item *new_item;
free(item->wins);
free(item);
}
+#endif
return;
}
int xmonitor_init(void)
{
+#ifndef WAYLAND
if (ecore_x_composite_query() == EINA_FALSE)
_D("====> COMPOSITOR IS NOT ENABLED");
ecore_event_handler_del(xmonitor_info.focus_out_handler);
xmonitor_info.focus_out_handler = NULL;
} else return -EFAULT;
+#endif
return -EFAULT;
}
void xmonitor_fini(void)
{
+#ifndef WAYLAND
ecore_event_handler_del(xmonitor_info.create_handler);
xmonitor_info.create_handler = NULL;
ecore_event_handler_del(xmonitor_info.focus_out_handler);
xmonitor_info.focus_out_handler = NULL;
+#endif
}