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 syspopup package.
fix the bug:https://bugs.tizen.org/jira/browse/PTREL-531
Signed-off-by: Li,Limin <liminx.li@intel.com>
Change-Id: Id3f61e652e22115d47c7ef8d50dd5cb70b64c112
# Set required packages
INCLUDE(FindPkgConfig)
+IF (with_wayland)
+ ADD_DEFINITIONS("-DWAYLAND")
+ENDIF(with_wayland)
+
pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 dbus-glib-1)
FOREACH(flag ${libpkgs_CFLAGS})
#ifndef __SYSPOPUP_H__
#define __SYSPOPUP_H__
+#ifndef WAYLAND
#include <utilX.h>
+#endif
+
#include <bundle.h>
#include <Elementary.h>
+%bcond_with x
+%bcond_with wayland
+
Name: syspopup
Summary: syspopup package
Version: 0.0.92
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(dbus-glib-1)
+%if %{with x}
+BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(x11)
+%endif
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(appcore-efl)
cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} .
%build
-%cmake . -DEXTRA_CFLAGS=-fPIC
+%cmake . \
+%if %{with wayland} && !%{with x}
+-Dwith_wayland=TRUE\
+%endif
+-DEXTRA_CFLAGS=-fPIC
make %{?jobs:-j%jobs}
#include <stdio.h>
#include <appcore-efl.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
+#endif
#include "syspopup.h"
#include "syspopup-app.h"
static Evas_Object *__create_win(const char *name)
{
+ Ecore_Evas *ee;
Evas_Object *eo;
int w;
int h;
evas_object_smart_callback_add(eo, "delete,request",
__win_del, 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);
}
# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(sppkgs REQUIRED dlog bundle sqlite3 glib-2.0 evas elementary utilX ecore-x x11 ecore ecore-input dbus-glib-1)
+SET(APPSVC_SPPPGS_CHECK_MODULES "dlog bundle sqlite3 glib-2.0 evas elementary ecore ecore-input dbus-glib-1")
+
+IF (with_wayland)
+ pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES})
+ELSE (with_wayland)
+ pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES} utilX ecore-x x11)
+ENDIF (with_wayland)
FOREACH(flag ${sppkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
# pkgconfig file
#CONFIGURE_FILE(syspopup.pc.in syspopup/syspopup.pc @ONLY)
-CONFIGURE_FILE(syspopup.pc.in ${CMAKE_CURRENT_BINARY_DIR}/syspopup.pc @ONLY)
+IF (with_wayland)
+ CONFIGURE_FILE(syspopup-wayland.pc.in ${CMAKE_CURRENT_BINARY_DIR}/syspopup.pc @ONLY)
+ELSE (with_wayland)
+ CONFIGURE_FILE(syspopup-x.pc.in ${CMAKE_CURRENT_BINARY_DIR}/syspopup.pc @ONLY)
+ENDIF (with_wayland)
### Install ###
INSTALL(TARGETS syspopup DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
--- /dev/null
+# Package Information for pkg-config
+
+prefix=/usr
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDEDIR@
+
+Name: libsyspopup
+Description: system popup library for ui
+Version: @VERSION@
+Requires: dlog bundle sqlite3 glib-2.0 elementary dbus-glib-1
+Libs: -L${libdir} -lsyspopup
+Cflags: -I${includedir}
#include "syspopup.h"
#include "syspopup_api.h"
#include "simple_util.h"
+
+#ifndef WAYLAND
#include <X11/Xatom.h>
#include <X11/Xutil.h>
+#endif
+#ifndef WAYLAND
static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom,
Atom type, unsigned int *val,
unsigned int len)
return num;
}
+#endif
/*
static Window get_active_win(Display *dpy, Window win, Atom property)
static void __X_syspopup_term_handler(void *data)
{
+#ifndef WAYLAND
syspopup *tmp;
Display *d;
Window win;
XCloseDisplay(d);
/*TODO : if there is no popup window, kill client*/
+#endif
}
static gboolean __X_syspopup_timeout_handler(void *user_data)
{
+#ifndef WAYLAND
syspopup *sp = NULL;
Display *d;
int id;
Window win;
id = (int)user_data;
-
d = XOpenDisplay(NULL);
sp = _syspopup_find_by_id(id);
}
XCloseDisplay(d);
+#endif
return 0;
}
+#ifndef WAYLAND
static int __X_syspopup_change_xwin_type(Display *dpy, Window win)
{
Atom win_type_atom;
return 0;
}
+#endif
+#ifndef WAYLAND
static int __X_syspopup_disable_focus(Display *dpy, Window win)
{
XWMHints *hints;
return 0;
}
+#endif
+#ifndef WAYLAND
int X_syspopup_rotation_get(Display *dpy, Window win)
{
Window active_win;
return -1;
}
+#endif
int X_syspopup_process_keydown(int id, const char *keyname)
{
+#ifndef WAYLAND
Display *d;
Window win;
syspopup *sp = NULL;
XCloseDisplay(d);
}
+#endif
return 0;
}
int X_syspopup_process_rotate(int id)
{
+#ifndef WAYLAND
Display *d;
Window win;
syspopup *sp = NULL;
d = XOpenDisplay(NULL);
sp->rotate_cb(d, win, sp);
XCloseDisplay(d);
+#endif
return 0;
}
+#ifndef WAYLAND
int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win,
int (*rotate_func) (Display*, Window, syspopup*),
syspopup_handler *handler, void *user_data)
return sp->id;
}
+#endif
/**
* @brief This API reset created the system popup's properties
*/
int X_syspopup_reset(bundle *b)
{
+#ifndef WAYLAND
const char *popup_name;
syspopup_info_t *info;
syspopup *sp = NULL;
_syspopup_info_free(info);
}
+#endif
+
return 0;
}
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Input.h>
+
+#ifndef WAYLAND
#include <Ecore_X.h>
+#endif
static void __elm_popupwin_del_cb(void *data, Evas * e, Evas_Object * obj,
void *event_info)
static Eina_Bool __x_rotate_cb(void *data, int type, void *event)
{
int id = (int)data;
+
+#ifndef WAYLAND
Ecore_X_Event_Client_Message *ev = event;
if (!event)
if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
X_syspopup_process_rotate(id);
+#endif
return ECORE_CALLBACK_RENEW;
}
+#ifndef WAYLAND
static int __efl_rotate(Display *dpy, Window win, syspopup *sp)
{
int rotation;
return 0;
}
+#endif
API int syspopup_create(bundle *b, syspopup_handler *handler,
Evas_Object *parent, void *user_data)
{
+#ifndef WAYLAND
Ecore_X_Window xwin;
Display *dpy;
const char *popup_name;
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
__x_rotate_cb, (void *)id);
}
+#endif
return 0;
}