From 3e44206d9a0e7a72ad56b6059aaadfd0863346e7 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Tue, 4 Mar 2014 15:36:30 +0100 Subject: fix: ea_screen_reader_support_set support wayland Change-Id: Id38c66dc7a2f6c10975779523a76205c4d11d687 Signed-off-by: Philippe Coval --- CMakeLists.txt | 3 ++ packaging/efl-assist.spec | 8 ++++++ src/lib/efl_assist_screen_reader.c | 58 +++++++++++++++++++++++++++----------- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe0bcb5..25a48c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,9 @@ ADD_DEFINITIONS("-DPLUGINDIR=\"${PLUGINDIR}\"") IF(X11_SUPPORT) ADD_DEFINITIONS("-DHAVE_X11") ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") +ENDIF(WAYLAND_SUPPORT) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall") INCLUDE(FindPkgConfig) diff --git a/packaging/efl-assist.spec b/packaging/efl-assist.spec index 7cdcda1..98ec03a 100644 --- a/packaging/efl-assist.spec +++ b/packaging/efl-assist.spec @@ -1,4 +1,5 @@ %bcond_with x +%bcond_with wayland Name: efl-assist Summary: EFL assist library @@ -49,6 +50,13 @@ export LDFLAGS+=" -fvisibility=hidden" -DCMAKE_INSTALL_PREFIX=/usr \ %if %{with x} -DX11_SUPPORT=On \ +%else + -DX11_SUPPORT=Off \ +%endif +%if %{with wayland} + -DWAYLAND_SUPPORT=On \ +%else + -DWAYLAND_SUPPORT=Off \ %endif #eol diff --git a/src/lib/efl_assist_screen_reader.c b/src/lib/efl_assist_screen_reader.c index be7bd84..e5636c6 100644 --- a/src/lib/efl_assist_screen_reader.c +++ b/src/lib/efl_assist_screen_reader.c @@ -1,9 +1,14 @@ #include "efl_assist.h" #include "efl_assist_private.h" +#include + #ifdef HAVE_X #include #endif +#ifdef HAVE_WAYLAND +#include +#endif #include #include @@ -116,30 +121,43 @@ static void _tts_init(void) static void _timeout_cb(void *data, Evas_Object *obj, void *event_info) { -#ifdef HAVE_X - Ecore_X_Window xwin; +#ifdef HAVE_WAYLAND + Ecore_Wl_Window *w; +#elif HAVE_X + Ecore_X_Window w; +#endif + unsigned int val; - xwin = elm_win_xwindow_get(data); - if (!xwin) return; +#ifdef HAVE_WAYLAND + w = elm_win_wl_window_get(data); +#elif HAVE_X + w = elm_win_xwindow_get(data); +#endif + if (!w) return; evas_object_del(obj); +#ifdef HAVE_X val = 2; ecore_x_window_prop_card32_set - (xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1); - - _tts_shutdown(); + (xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1); #else - fprintf(stderr, "TODO: workaround: disabled code from " __FILE__ ); + fprintf(stderr, "TODO: workaround: disabled code from " + __FILE__ ":%d:", __LINE__); #endif + _tts_shutdown(); + } EAPI Eina_Bool ea_screen_reader_support_set(Evas_Object *win, Eina_Bool support) { -#ifdef HAVE_X - Ecore_X_Window xwin; +#ifdef HAVE_WAYLAND + Ecore_Wl_Window *w; +#elif HAVE_X + Ecore_X_Window w; +#endif unsigned int val; int tts_val; Evas_Object *base; @@ -153,16 +171,25 @@ ea_screen_reader_support_set(Evas_Object *win, Eina_Bool support) if (!win) return EINA_FALSE; - xwin = elm_win_xwindow_get(win); - if (!xwin) return EINA_FALSE; +#ifdef HAVE_WAYLAND + w = elm_win_wl_window_get(win); +#elif HAVE_X + w = elm_win_xwindow_get(win); +#endif + + if (!w) return EINA_FALSE; if (support) { val = 0; elm_config_access_set(EINA_TRUE); - +#ifdef HAVE_X ecore_x_window_prop_card32_set - (xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1); + (w, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1); +#else + fprintf(stderr, "TODO: workaround: disabled code from " + __FILE__ ":%d:", __LINE__); +#endif } else { @@ -179,9 +206,6 @@ ea_screen_reader_support_set(Evas_Object *win, Eina_Bool support) } return EINA_TRUE; -#else - fprintf(stderr, "TODO: workaround: disabled code from " __FILE__ ); -#endif } EAPI Eina_Bool -- cgit v1.2.3