From: Li,Limin Date: Mon, 6 Jan 2014 09:53:54 +0000 (+0800) Subject: init wayland support X-Git-Tag: submit/tizen/20140110.215426^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8b5f507cb937305d20ecc7fed769683279184d1;p=platform%2Fcore%2Fbase%2Fsyspopup.git init wayland support 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 Change-Id: Id3f61e652e22115d47c7ef8d50dd5cb70b64c112 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9657830..c3ebbad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,10 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") # 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}) diff --git a/include/syspopup.h b/include/syspopup.h index 6897c5d..794ac7a 100755 --- a/include/syspopup.h +++ b/include/syspopup.h @@ -24,7 +24,10 @@ #ifndef __SYSPOPUP_H__ #define __SYSPOPUP_H__ +#ifndef WAYLAND #include +#endif + #include #include diff --git a/packaging/syspopup.spec b/packaging/syspopup.spec index 9f3130d..35c8e10 100755 --- a/packaging/syspopup.spec +++ b/packaging/syspopup.spec @@ -1,3 +1,6 @@ +%bcond_with x +%bcond_with wayland + Name: syspopup Summary: syspopup package Version: 0.0.92 @@ -13,9 +16,11 @@ BuildRequires: cmake 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) @@ -57,7 +62,11 @@ syspopup-caller development package for popup 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} diff --git a/syspopup-app/syspopup-app.c b/syspopup-app/syspopup-app.c index e5d9543..2390a89 100755 --- a/syspopup-app/syspopup-app.c +++ b/syspopup-app/syspopup-app.c @@ -23,7 +23,10 @@ #include #include + +#ifndef WAYLAND #include +#endif #include "syspopup.h" #include "syspopup-app.h" @@ -163,6 +166,7 @@ static int rotate(enum appcore_rm m, void *data) static Evas_Object *__create_win(const char *name) { + Ecore_Evas *ee; Evas_Object *eo; int w; int h; @@ -176,8 +180,9 @@ static Evas_Object *__create_win(const char *name) 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); } diff --git a/syspopup/CMakeLists.txt b/syspopup/CMakeLists.txt index f9caa16..615b884 100644 --- a/syspopup/CMakeLists.txt +++ b/syspopup/CMakeLists.txt @@ -19,7 +19,13 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") # 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}") @@ -58,7 +64,11 @@ SET_TARGET_PROPERTIES(syspopup PROPERTIES SOVERSION 0.1.0) # 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) diff --git a/syspopup/syspopup-wayland.pc.in b/syspopup/syspopup-wayland.pc.in new file mode 100644 index 0000000..68c122a --- /dev/null +++ b/syspopup/syspopup-wayland.pc.in @@ -0,0 +1,13 @@ +# 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} diff --git a/syspopup/syspopup.pc.in b/syspopup/syspopup-x.pc.in similarity index 100% rename from syspopup/syspopup.pc.in rename to syspopup/syspopup-x.pc.in diff --git a/syspopup/syspopup.c b/syspopup/syspopup.c index a8d5f2d..07de01e 100755 --- a/syspopup/syspopup.c +++ b/syspopup/syspopup.c @@ -25,9 +25,13 @@ #include "syspopup.h" #include "syspopup_api.h" #include "simple_util.h" + +#ifndef WAYLAND #include #include +#endif +#ifndef WAYLAND static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom, Atom type, unsigned int *val, unsigned int len) @@ -64,6 +68,7 @@ static int __utilx_ss_get_window_property(Display *dpy, Window win, Atom atom, return num; } +#endif /* static Window get_active_win(Display *dpy, Window win, Atom property) @@ -88,6 +93,7 @@ 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; @@ -124,17 +130,18 @@ static void __X_syspopup_term_handler(void *data) 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); @@ -149,10 +156,12 @@ static gboolean __X_syspopup_timeout_handler(void *user_data) } XCloseDisplay(d); +#endif return 0; } +#ifndef WAYLAND static int __X_syspopup_change_xwin_type(Display *dpy, Window win) { Atom win_type_atom; @@ -166,7 +175,9 @@ static int __X_syspopup_change_xwin_type(Display *dpy, Window win) return 0; } +#endif +#ifndef WAYLAND static int __X_syspopup_disable_focus(Display *dpy, Window win) { XWMHints *hints; @@ -183,7 +194,9 @@ static int __X_syspopup_disable_focus(Display *dpy, Window win) return 0; } +#endif +#ifndef WAYLAND int X_syspopup_rotation_get(Display *dpy, Window win) { Window active_win; @@ -222,9 +235,11 @@ int X_syspopup_rotation_get(Display *dpy, Window win) return -1; } +#endif int X_syspopup_process_keydown(int id, const char *keyname) { +#ifndef WAYLAND Display *d; Window win; syspopup *sp = NULL; @@ -255,12 +270,14 @@ int X_syspopup_process_keydown(int id, const char *keyname) XCloseDisplay(d); } +#endif return 0; } int X_syspopup_process_rotate(int id) { +#ifndef WAYLAND Display *d; Window win; syspopup *sp = NULL; @@ -275,10 +292,12 @@ int X_syspopup_process_rotate(int id) 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) @@ -350,6 +369,7 @@ int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win, return sp->id; } +#endif /** * @brief This API reset created the system popup's properties @@ -367,6 +387,7 @@ int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win, */ int X_syspopup_reset(bundle *b) { +#ifndef WAYLAND const char *popup_name; syspopup_info_t *info; syspopup *sp = NULL; @@ -408,6 +429,8 @@ int X_syspopup_reset(bundle *b) _syspopup_info_free(info); } +#endif + return 0; } diff --git a/syspopup/syspopup_efl.c b/syspopup/syspopup_efl.c index 38db1f0..852eb3e 100755 --- a/syspopup/syspopup_efl.c +++ b/syspopup/syspopup_efl.c @@ -28,7 +28,10 @@ #include #include #include + +#ifndef WAYLAND #include +#endif static void __elm_popupwin_del_cb(void *data, Evas * e, Evas_Object * obj, void *event_info) @@ -57,6 +60,8 @@ static Eina_Bool __x_keydown_cb(void *data, int type, void *event) 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) @@ -64,10 +69,12 @@ static Eina_Bool __x_rotate_cb(void *data, int type, void *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; @@ -83,10 +90,12 @@ static int __efl_rotate(Display *dpy, Window win, syspopup *sp) 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; @@ -133,6 +142,7 @@ API int syspopup_create(bundle *b, syspopup_handler *handler, ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __x_rotate_cb, (void *)id); } +#endif return 0; }