remove unused variables
[platform/core/uifw/efl-assist.git] / src / lib / efl_assist_screen_reader.c
index 506308f..383f4c0 100644 (file)
@@ -1,6 +1,33 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+
 #include "efl_assist.h"
 #include "efl_assist_private.h"
+
+#include <Ecore.h>
+
+#ifdef HAVE_X11
 #include <Ecore_X.h>
+#endif
+#ifdef HAVE_WAYLAND
+#include <Ecore_Wayland.h>
+#endif
+
 #include <vconf.h>
 #include <tts.h>
 #define UNAVAILABLE_TEXT "Screen reader is unavailable during using this application. You can press home or back key to go back to home screen."
@@ -112,29 +139,47 @@ static void _tts_init(void)
 
 static void _timeout_cb(void *data, Evas_Object *obj, void *event_info)
 {
-   Ecore_X_Window xwin;
+#ifdef HAVE_X11
+   Ecore_X_Window xwin=0;
    unsigned int val;
+#endif
+#ifdef HAVE_WAYLAND
+   Ecore_Wl_Window *wwin=0;
+#endif
 
+#ifdef HAVE_X11
    xwin = elm_win_xwindow_get(data);
-   if (!xwin) return;
-
-   evas_object_del(obj);
-
-   val = 2;
-   ecore_x_window_prop_card32_set
-     (xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1);
+   if (xwin>0) {
+     evas_object_del(obj); obj=0;
+     val = 2;
+     ecore_x_window_prop_card32_set
+       (xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1);
+   } else
+#endif
+     {
+#ifdef HAVE_WAYLAND
+     wwin = elm_win_wl_window_get(data);
+     if (wwin != NULL) {
+       evas_object_del(obj); obj=0;
 
+       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)
 {
-   Ecore_X_Window xwin;
+#ifdef HAVE_X11
+   Ecore_X_Window w=0;
    unsigned int val;
+#elif defined HAVE_WAYLAND
+   Ecore_Wl_Window *w=0;
+#endif
    int tts_val;
-   Evas_Object *base;
-   Evas_Object *body;
    Evas_Object *popup;
 
    if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &tts_val) != 0)
@@ -144,16 +189,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_X11
+   w = elm_win_xwindow_get(win);
+#endif
+
+   if (!w) return EINA_FALSE;
 
    if (support)
      {
-        val = 0;
         elm_config_access_set(EINA_TRUE);
-
+#ifdef HAVE_X11
+        val = 0;
         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
      {