From f8cf10264938ff19542e52111db62e35b1255455 Mon Sep 17 00:00:00 2001 From: brianjjones Date: Mon, 4 Mar 2013 13:37:36 -0800 Subject: [PATCH] Removing X references and calls --- CMakeLists.txt | 8 +++----- src/appcore-efl.c | 27 +++++++++++++++++++++++++-- src/appcore-rotation.c | 24 +++++++++++++++++++----- src/appcore.c | 2 ++ 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44f491e..5bf46b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,14 +24,12 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE) SET(APPCORE_COMMON "appcore-common") SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c # src/appcore-noti.c src/appcore-pmcontrol.c - src/appcore-rotation.c -# src/appcore-util.c - src/appcore-X.c) + src/appcore-rotation.c) SET(HEADERS_common appcore-common.h) INCLUDE(FindPkgConfig) -#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog x11) -pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog x11 ecore-x) +#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog) +pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog) FOREACH(flag ${pkg_common_CFLAGS}) SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}") ENDFOREACH(flag) diff --git a/src/appcore-efl.c b/src/appcore-efl.c index 162619f..ea43f11 100755 --- a/src/appcore-efl.c +++ b/src/appcore-efl.c @@ -23,10 +23,15 @@ #include #include #include + +#if HAVE_X #include #include #include +#endif + #include +#include #include #include #include @@ -350,11 +355,18 @@ static bool __update_win(unsigned int win, bool bfobscured) } +#if HAVE_X Ecore_X_Atom atom_parent; +#endif static Eina_Bool __show_cb(void *data, int type, void *event) { + +#if HAVE_X + //There is no Wayland equivelent show event yet, this is stubbed out until there is + Ecore_X_Event_Window_Show *ev; + Ecore_Wl_Event_Window_Configure *ev; //there is no Window_Show for wayland int ret; Ecore_X_Window parent; @@ -374,12 +386,17 @@ static Eina_Bool __show_cb(void *data, int type, void *event) else __update_win((unsigned int)ev->win, FALSE); +#endif return ECORE_CALLBACK_RENEW; } static Eina_Bool __hide_cb(void *data, int type, void *event) { + +#if HAVE_X + //There is no Wayland equivelent for hide event yet, this is stubbed out until there is Ecore_X_Event_Window_Hide *ev; + Ecore_Wl_Event_Window_Configure *ev; int bvisibility = 0; ev = event; @@ -397,11 +414,15 @@ static Eina_Bool __hide_cb(void *data, int type, void *event) } } +#endif return ECORE_CALLBACK_RENEW; } static Eina_Bool __visibility_cb(void *data, int type, void *event) { + +#if HAVE_X + //There is no Wayland equivelent for visibility event yet, this is stubbed out until there is Ecore_X_Event_Window_Visibility_Change *ev; int bvisibility = 0; @@ -421,13 +442,15 @@ static Eina_Bool __visibility_cb(void *data, int type, void *event) __do_app(AE_PAUSE, data, NULL); } else _DBG(" No change state \n"); - +#endif return ECORE_CALLBACK_RENEW; } static void __add_climsg_cb(struct ui_priv *ui) { + +#if HAVE_X _ret_if(ui == NULL); atom_parent = ecore_x_atom_get("_E_PARENT_BORDER_WINDOW"); @@ -443,7 +466,7 @@ static void __add_climsg_cb(struct ui_priv *ui) ui->hvchange = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, __visibility_cb, ui); - +#endif } static int __before_loop(struct ui_priv *ui, int *argc, char ***argv) diff --git a/src/appcore-rotation.c b/src/appcore-rotation.c index 78b60ba..1e789e4 100755 --- a/src/appcore-rotation.c +++ b/src/appcore-rotation.c @@ -26,23 +26,33 @@ #include #include + +#if HAVE_X #include #include #include +#endif +#include #include "appcore-internal.h" +#if HAVE_X #define _MAKE_ATOM(a, s) \ do { \ a = ecore_x_atom_get(s); \ if (!a) \ _ERR("##s creation failed.\n"); \ } while(0) +#endif #define STR_ATOM_ROTATION_LOCK "_E_ROTATION_LOCK" -static Ecore_X_Atom ATOM_ROTATION_LOCK = 0; + +static int ATOM_ROTATION_LOCK = 0; + +#if HAVE_X static Ecore_X_Window root; +#endif struct rot_s { int handle; @@ -102,12 +112,12 @@ static enum appcore_rm __get_mode(int event_data) static Eina_Bool __property(void *data, int type, void *event) { - Ecore_X_Event_Window_Property *ev = event; + Ecore_Wl_Event_Window_Configure *ev =event; if (!ev) return ECORE_CALLBACK_PASS_ON; - if (ev->atom == ATOM_ROTATION_LOCK) { + if (ev->event_win == ATOM_ROTATION_LOCK) { _DBG("[APP %d] Rotation: %d -> %d, cb_set : %d", getpid(), rot.mode, changed_m, rot.cb_set); if (rot.cb_set && rot.mode != changed_m) { rot.callback(changed_m, changed_data); @@ -143,6 +153,8 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event, _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m); +#if HAVE_X + //Missing wayland equivelent if (rot.callback) { if (rot.cb_set && rot.mode != m) { ret = ecore_x_window_prop_card32_get(root, ATOM_ROTATION_LOCK, &val, 1); @@ -162,6 +174,7 @@ static void __changed_cb(unsigned int event_type, sensor_event_data_t *event, } changed_m = m; } +#endif } static void __lock_cb(keynode_t *node, void *data) @@ -194,7 +207,7 @@ static void __lock_cb(keynode_t *node, void *data) ecore_event_handler_del(changed_handle); changed_handle = NULL; } - changed_handle = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, __property, NULL); + changed_handle = ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, __property, NULL); } } @@ -277,10 +290,11 @@ EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *), rot.handle = handle; __add_rotlock(data); +#if HAVE_X _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK ); root = ecore_x_window_root_first_get(); XSelectInput(ecore_x_display_get(), root, PropertyChangeMask); - +#endif return 0; } diff --git a/src/appcore.c b/src/appcore.c index fa316b8..da73801 100755 --- a/src/appcore.c +++ b/src/appcore.c @@ -194,7 +194,9 @@ static int __app_reset(void *data, bundle * k) static int __app_resume(void *data) { + #if HAVE_X x_raise_win(getpid()); + #endif return 0; } -- 2.7.4