ENDIF()
IF("${X11_ENABLED}" STREQUAL "1")
- MESSSAGE("X11 is enabled")
+ MESSAGE(STATUS "X11 is enabled")
SET(CONDITIONAL_PACKAGES ${CONDITIONAL_PACKAGES} "ecore-x")
ADD_DEFINITIONS("-DX11_ENABLED")
+ELSE()
+ MESSAGE(STATUS "X11 is disabled - using wayland")
+ SET(CONDITIONAL_PACKAGES ${CONDITIONAL_PACKAGES} "ecore-wayland")
ENDIF()
INCLUDE(FindPkgConfig)
#ifndef ELM_ACCESS_KEYBOARD_ADAPTER_H_
#define ELM_ACCESS_KEYBOARD_ADAPTER_H_
-#include <Ecore.h>
+#ifdef X11_ENABLED
#include <Ecore_X.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
/**
* @brief Send ecore x message with elm access read action
* @param y y coordinate of gesture relative to X root window
*
*/
+#ifdef X11_ENABLED
void elm_access_adaptor_emit_read(Ecore_X_Window win, int x, int y);
+#else
+void elm_access_adaptor_emit_read(Ecore_Wl_Window *win, int x, int y);
+#endif
/**
* @brief Send ecore x message with elm access activate action
* @param y y coordinate of gesture relative to X root window
*
*/
+#ifdef X11_ENABLED
void elm_access_adaptor_emit_activate(Ecore_X_Window win, int x, int y);
+#else
+void elm_access_adaptor_emit_activate(Ecore_Wl_Window *win, int x, int y);
+#endif
#endif
#define SCREEN_READER_GESTURES_H_
#include <Ecore.h>
+#ifdef X11_ENABLED
#include <Ecore_X.h>
-
+#else
+#include <Ecore_Wayland.h>
+#endif
/**
* @brief Accessibility gestures
*/
* @brief Shutdown gesture navigation profile.
*/
void screen_reader_gestures_shutdown(void);
-
+#ifdef X11_ENABLED
Eina_Bool screen_reader_gesture_x_grab_touch_devices(Ecore_X_Window win);
+#else
+Eina_Bool screen_reader_gesture_wl_grab_touch_devices(Ecore_Wl_Window win);
+#endif
typedef void (*GestureCB)(void *data, Gesture_Info *info);
*
* @return Ecore_X_Window Object which represents top window on which gesture occure
*/
+#ifdef X11_ENABLED
Ecore_X_Window top_window_get (int x, int y);
+#else
+Ecore_Wl_Window *top_window_get (int x, int y);
+#endif
+
#endif
%define AppInstallPath /usr/apps/%{name}
%define Exec screen-reader
-
+%bcond_with x
+%bcond_with wayland
Name: org.tizen.screen-reader
Summary: Screen Reader Assistive Technology
%if %{with x}
BuildRequires: pkgconfig(ecore-x)
%endif
+%if %{with wayland}
+BuildRequires: pkgconfig(ecore-wayland)
+%endif
BuildRequires: pkgconfig(eina)
BuildRequires: pkgconfig(eldbus)
BuildRequires: pkgconfig(elementary)
#include "elm_access_adapter.h"
#include "logger.h"
+#ifdef X11_ENABLED
static void _get_root_coords(Ecore_X_Window win, int *x, int *y)
{
Ecore_X_Window root = ecore_x_window_root_first_get();
parent = ecore_x_window_parent_get(parent);
}
}
-
static void _send_ecore_x_client_msg(Ecore_X_Window win, int x, int y, Eina_Bool activate)
{
int x_win, y_win;
{
_send_ecore_x_client_msg(win, x, y, EINA_FALSE);
}
+#else
+void elm_access_adaptor_emit_activate(Ecore_Wl_Window *win, int x, int y)
+{
+
+}
+
+void elm_access_adaptor_emit_read(Ecore_Wl_Window *win, int x, int y)
+{
+
+}
+#endif
\ No newline at end of file
#include <string.h>
#include <atspi/atspi.h>
#include <Ecore.h>
+#ifdef X11_ENABLED
#include <Ecore_X.h>
+#endif
#include "keyboard_tracker.h"
#include "logger.h"
#include "screen_reader_tts.h"
static AtspiDeviceListener *listener;
static Keyboard_Tracker_Cb user_cb;
static void *user_data;
+#ifdef X11_ENABLED
static Ecore_Event_Handler *root_xwindow_property_changed_hld = NULL;
static Ecore_Event_Handler *active_xwindow_property_changed_hld = NULL;
root_xwindow_property_changed_hld = NULL;
}
}
-
+#endif
static gboolean device_cb(const AtspiDeviceEvent * stroke, void *data)
{
Key k;
{
listener = atspi_device_listener_new(device_cb, NULL, NULL);
atspi_register_keystroke_listener(listener, NULL, 0, ATSPI_KEY_PRESSED, ATSPI_KEYLISTENER_SYNCHRONOUS | ATSPI_KEYLISTENER_CANCONSUME, NULL);
+#ifdef X11_ENABLED
active_xwindow_property_tracker_register();
root_xwindow_property_tracker_register();
+#endif
DEBUG("keyboard tracker init");
}
void keyboard_tracker_shutdown(void)
{
atspi_deregister_keystroke_listener(listener, NULL, 0, ATSPI_KEY_PRESSED, NULL);
+#ifdef X11_ENABLED
root_xwindow_property_tracker_unregister();
active_xwindow_property_tracker_unregister();
+#endif
DEBUG("keyboard tracker shutdown");
}
#define _GNU_SOURCE
#include <stdio.h>
+#ifdef X11_ENABLED
#include <Ecore_X.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
#include <Ecore.h>
#include <math.h>
#include <atspi/atspi.h>
static void _quickpanel_change_state(gboolean quickpanel_switch)
{
DEBUG("START");
+#ifdef X11_ENABLED
Ecore_X_Window xwin = 0;
if (quickpanel_switch)
ecore_x_e_illume_quickpanel_state_send(ecore_x_e_illume_zone_get(xwin), state);
ecore_main_loop_iterate();
+#endif
}
/**
static void on_gesture_detected(void *data, Gesture_Info * info)
{
+#ifdef X11_ENABLED
Ecore_X_Window keyboard_win;
+#endif
_on_auto_review_stop();
if (info->type == ONE_FINGER_SINGLE_TAP && info->state == 3) {
if ((info->event_time - _last_hover_event_time) < ONGOING_HOVER_GESTURE_INTERPRETATION_INTERVAL && info->state == 1)
return;
_last_hover_event_time = info->state != 1 ? -1 : info->event_time;
-#ifdef ELM_ACCESS_KEYBOARD
+#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
keyboard_win = top_window_get(info->x_end, info->y_end);
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_read(keyboard_win, info->x_end, info->y_end);
_focus_next();
break;
case ONE_FINGER_SINGLE_TAP:
-#ifdef ELM_ACCESS_KEYBOARD
+#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
keyboard_win = top_window_get(info->x_end, info->y_end);
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_read(keyboard_win, info->x_end, info->y_end);
_focus_widget(info);
break;
case ONE_FINGER_DOUBLE_TAP:
-#ifdef ELM_ACCESS_KEYBOARD
+#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
keyboard_win = top_window_get(info->x_end, info->y_end);
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_activate(keyboard_win, info->x_end, info->y_end);
#include <Ecore.h>
#include <Ecore_Input.h>
+#ifdef X11_ENABLED
#include <Ecore_X.h>
+#else
+#include <Ecore_Wayland.h>
+#endif
static GestureCB _global_cb;
static void *_global_data;
-static Ecore_Window win;
+
+#ifdef X11_ENABLED
+static Ecore_X_Window win;
+#else
+static Ecore_Wl_Window *win;
+#endif
+
static Ecore_Event_Handler *property_changed_hld;
struct _Gestures_Config {
} gesture_type_e;
struct _Cover {
+#ifdef X11_ENABLED
Ecore_X_Window win; /**< Input window covering given zone */
+#else
+ Ecore_Wl_Window *win; /**< Input window covering given zone */
+#endif
unsigned int n_taps; /**< Number of fingers touching screen */
unsigned int event_time;
typedef struct _Cover Cover;
Gestures_Config *_e_mod_config;
+#ifdef X11_ENABLED
static Ecore_X_Window scrolled_win;
static int rx, ry;
+#endif
static Eina_List *handlers;
static Cover *cov;
static int win_angle;
void __transform_coordinates(int *ax, int *ay)
{
- Ecore_X_Window root;
int w;
int h;
int tmp;
+#ifdef X11_ENABLED
+ ecore_x_window_geometry_get(ecore_x_window_root_first_get(), NULL, NULL, &w, &h);
+#else
+ ecore_wl_screen_size_get(&w, &h);
+#endif
win_angle = _win_angle_get();
switch (win_angle) {
case 90:
- root = ecore_x_window_root_first_get();
- ecore_x_window_geometry_get(root, NULL, NULL, &w, &h);
tmp = *ax;
*ax = h - *ay;
*ay = tmp;
break;
case 270:
- root = ecore_x_window_root_first_get();
- ecore_x_window_geometry_get(root, NULL, NULL, &w, &h);
+
tmp = *ax;
*ax = *ay;
*ay = w - tmp;
if (cov->n_taps == 0)
cov->hover_gesture.state = GESTURE_NOT_STARTED;
}
-
+#ifdef X11_ENABLED
static void _get_root_coords(Ecore_X_Window win, int *x, int *y)
{
Ecore_X_Window root = ecore_x_window_root_first_get();
}
return 0;
}
+#else
+Ecore_Wl_Window *top_window_get(int x, int y)
+{
+ return 0;
+}
+#endif
+
void start_scroll(int x, int y)
{
+#ifdef X11_ENABLED
Ecore_X_Window wins[1] = { win };
Ecore_X_Window under = ecore_x_window_at_xy_with_skip_get(x, y, wins, sizeof(wins) / sizeof(wins[0]));
_get_root_coords(under, &rx, &ry);
ecore_x_window_focus(under);
ecore_x_mouse_down_send(under, x - rx, y - ry, 1);
scrolled_win = under;
+#endif
}
void continue_scroll(int x, int y)
{
+#ifdef X11_ENABLED
ecore_x_mouse_move_send(scrolled_win, x - rx, y - ry);
+#endif
}
void end_scroll(int x, int y)
{
- ecore_x_mouse_up_send(scrolled_win, x - rx, y - ry, 1);
+#ifdef X11_ENABLED
+ ecore_x_mouse_up_send(scrolled_win, x - rx, y - ry, 1);
ecore_x_mouse_out_send(scrolled_win, x - rx, y - ry);
+#endif
}
static unsigned int _win_angle_get(void)
{
+ int angle = 0;
+#ifdef X11_ENABLED
Ecore_X_Window root, first_root;
int ret;
int count;
- int angle = 0;
unsigned char *prop_data = NULL;
first_root = ecore_x_window_root_first_get();
if (prop_data)
free(prop_data);
+#else
+#endif
return angle;
}
int w, h;
if (!win) {
+#ifdef X11_ENABLED
Ecore_Window root = ecore_x_window_root_first_get();
if (!root)
return EINA_FALSE;
ecore_x_window_geometry_get(root, NULL, NULL, &w, &h);
win = ecore_x_window_input_new(root, 0, 0, w, h);
+#else
+ ecore_wl_screen_size_get(&w, &h);
+ win = ecore_wl_window_new(NULL, 0, 0, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
+#endif
}
if (!win)
return EINA_FALSE;
+#ifdef X11_ENABLED
ecore_x_input_multi_select(win);
ecore_x_window_show(win);
ecore_x_window_raise(win);
-
+#else
+ ecore_wl_window_show(win);
+ ecore_wl_window_raise(win);
+#endif
// restet gestures
memset(cov, 0x0, sizeof(Cover));
return EINA_TRUE;
}
-
+#ifdef X11_ENABLED
static Eina_Bool _win_property_changed(void *data, int type, void *event)
{
Ecore_X_Event_Window_Property *wp = event;
return EINA_TRUE;
}
+#endif
static Eina_Bool _gestures_input_window_init(void)
{
+#ifdef X11_ENABLED
Ecore_Window root = ecore_x_window_root_first_get();
if (!root) {
ERROR("No root window found. Is Window manager running?");
}
ecore_x_event_mask_set(root, ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
property_changed_hld = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _win_property_changed, NULL);
-
+#endif
return _gesture_input_win_create();
}
{
ecore_event_handler_del(property_changed_hld);
if (win)
+#ifdef X11_ENABLED
ecore_x_window_free(win);
+#else
+ ecore_wl_window_free(win);
+#endif
win = 0;
}
Eina_Bool screen_reader_gestures_init(void)
{
ecore_init();
+#ifdef X11_ENABLED
ecore_x_init(NULL);
-
+#else
+ ecore_wl_init(NULL);
+#endif
cov = calloc(sizeof(Cover), 1);
if (!_gestures_input_window_init()) {
ecore_event_handler_del(hdlr);
}
_gestures_input_widnow_shutdown();
-
+#ifdef X11_ENABLED
ecore_x_shutdown();
+#else
+ ecore_wl_shutdown();
+#endif
ecore_shutdown();
free(_e_mod_config);
free(cov);
#include <string.h>
#include "window_tracker.h"
#include "logger.h"
+
+#ifdef X11_ENABLED
#include <Ecore_X.h>
#include <Ecore_X_Atoms.h>
+#endif
static Window_Tracker_Cb user_cb;
static void *user_data;
return NULL;
}
- Ecore_X_Window focus_window = ecore_x_window_focus_get();
unsigned int active_window_pid = 0;
+#ifdef X11_ENABLED
+ Ecore_X_Window focus_window = ecore_x_window_focus_get();
+
if (focus_window) {
//invoking atspi_accessible_get_child_count for non active apps results in very long screen-reader startup
//not active apps have low priority and dbus calls take a lot of time (a few hundred ms per call)
if (active_window_pid)
DEBUG("First we will try filter apps by PID: %i", active_window_pid);
}
+#endif
desktop_children_count = atspi_accessible_get_child_count(desktop, NULL);
for (i = 0; i < desktop_children_count; i++) {
AtspiAccessible *app = atspi_accessible_get_child_at_index(desktop, i, NULL);