#include <e_screen_reader_private.h>
#include <vconf.h>
#include <e_dispatch_gesture_event.h>
+#include "e_universal_switch.h"
#define E_A11Y_SERVICE_BUS_NAME "org.enlightenment.wm-screen-reader"
#define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation"
int _eina_log_dom = 0;
#define DBG(...) do EINA_LOG_DOM_DBG(_eina_log_dom, __VA_ARGS__); while(0)
-// constant below allows to distinguish the origin of mouse events between one created in this module and the one created by user
-#define MAGIC_DEVICE_NUMBER 2048
-
static Eina_Bool g_gesture_navi;
static Eina_List *handlers;
int highlighted_object_x, highlighted_object_y;
Eina_Bool is_selection_mode;
int object_needs_scroll_from_x, object_needs_scroll_from_y;
-Ecore_Event_Filter *ssp_ef = NULL;
-extern int device_number_shift;
EAPI E_Module_Api e_modapi =
{
"Screen Reader Module of Window Manager"
};
-typedef enum signal_type_ {
- GESTURE_DETECTED_SIGNAL,
- MOUSE_DOWN_SIGNAL,
- MOUSE_UP_SIGNAL
-} signal_type;
-
static Eldbus_Message *_sc_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_ssp_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
+static Eldbus_Message *_asp_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_is_slider(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_highlighted_object_info(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_is_screen_reader_support(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
{ "ScreenSwitchProviderEnabled", ELDBUS_ARGS({"b", "bool"}), NULL,
_ssp_enable
},
+ { "AccessoriesSwitchProviderEnabled", ELDBUS_ARGS({"b", "bool"}), NULL,
+ _asp_enable
+ },
{ "IsSlider", ELDBUS_ARGS({"b", "bool"}), NULL,
_is_slider
},
0},
[MOUSE_DOWN_SIGNAL] = {"MouseDown", ELDBUS_ARGS({"i", "deviceId"}), 0},
[MOUSE_UP_SIGNAL] = {"MouseUp", ELDBUS_ARGS({"i", "deviceId"}), 0},
+ [KEY_DOWN_SIGNAL] = {"KeyDown", ELDBUS_ARGS({"s", "keyId"}), 0},
+ [KEY_UP_SIGNAL] = {"KeyUp", ELDBUS_ARGS({"s", "keyId"}), 0},
{ }
};
return NULL;
}
-static Eina_Bool
-_ssp_filter(void *data, void *loop_data, int type, void *event)
+static Eldbus_Message *
+_ssp_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
- if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN || type == ECORE_EVENT_MOUSE_BUTTON_UP)
+ Eina_Bool enabled = EINA_FALSE;
+ if (!eldbus_message_arguments_get(msg, "b", &enabled))
{
- Ecore_Event_Mouse_Button *ev = event;
-
- if (ev->multi.device >= MAGIC_DEVICE_NUMBER)
- {
- ev->multi.device = ev->multi.device - MAGIC_DEVICE_NUMBER;
- return EINA_TRUE;
- }
-
- if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
- eldbus_service_signal_emit(iface, MOUSE_DOWN_SIGNAL, ev->multi.device);
- else
- eldbus_service_signal_emit(iface, MOUSE_UP_SIGNAL, ev->multi.device);
-
- return EINA_FALSE;
+ ERROR("eldbus_message_arguments_get() error\n");
+ return NULL;
}
- if (type == ECORE_EVENT_MOUSE_MOVE)
- {
- Ecore_Event_Mouse_Move *ev = event;
-
- if (ev->multi.device >= MAGIC_DEVICE_NUMBER)
- {
- ev->multi.device = ev->multi.device - MAGIC_DEVICE_NUMBER;
- return EINA_TRUE;
- }
- else
- {
- return EINA_FALSE;
- }
- }
+ if (enabled)
+ _ssp_submodule_init();
+ else
+ _ssp_submodule_shutdown();
- return EINA_TRUE;
+ return eldbus_message_method_return_new(msg);
}
static Eldbus_Message *
-_ssp_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+_asp_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
Eina_Bool enabled = EINA_FALSE;
if (!eldbus_message_arguments_get(msg, "b", &enabled))
return NULL;
}
- if (enabled && !ssp_ef)
- {
- ssp_ef = ecore_event_filter_add(NULL, _ssp_filter, NULL, NULL);
- device_number_shift = MAGIC_DEVICE_NUMBER;
- }
- else if (!enabled)
- {
- ecore_event_filter_del(ssp_ef);
- ssp_ef = NULL;
- device_number_shift = 0;
- }
+ if (enabled)
+ _asp_submodule_init();
+ else
+ _asp_submodule_shutdown();
return eldbus_message_method_return_new(msg);
}
--- /dev/null
+#include "e_universal_switch.h"
+#include "e_mod_main.h"
+
+// constant below allows to distinguish the origin of mouse events between one created in this module and the one created by user
+#define DEVICE_NUMBER_OFFSET 2048
+
+extern Eldbus_Service_Interface *iface;
+extern int device_number_shift;
+
+static Ecore_Event_Filter *screen_switch_provider_filter = NULL;
+static Ecore_Event_Filter *accessories_switch_provider_filter = NULL;
+
+static const char* uncaught_keys[] = {"XF86Back", "XF86Menu", "XF86AudioRaiseVolume", "XF86AudioLowerVolume"};
+
+static Eina_Bool _ssp_filter(void *data, void *loop_data, int type, void *event)
+{
+ if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN || type == ECORE_EVENT_MOUSE_BUTTON_UP)
+ {
+ Ecore_Event_Mouse_Button *ev = event;
+
+ if (ev->multi.device >= DEVICE_NUMBER_OFFSET)
+ {
+ ev->multi.device = ev->multi.device - DEVICE_NUMBER_OFFSET;
+ return EINA_TRUE;
+ }
+
+ if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
+ eldbus_service_signal_emit(iface, MOUSE_DOWN_SIGNAL, ev->multi.device);
+ else
+ eldbus_service_signal_emit(iface, MOUSE_UP_SIGNAL, ev->multi.device);
+
+ return EINA_FALSE;
+ }
+
+ if (type == ECORE_EVENT_MOUSE_MOVE)
+ {
+ Ecore_Event_Mouse_Move *ev = event;
+
+ if (ev->multi.device >= DEVICE_NUMBER_OFFSET)
+ {
+ ev->multi.device = ev->multi.device - DEVICE_NUMBER_OFFSET;
+ return EINA_TRUE;
+ }
+ else
+ {
+ return EINA_FALSE;
+ }
+ }
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _is_intercepted(const char *key)
+{
+ int uncaught_keys_size = sizeof(uncaught_keys) / sizeof(uncaught_keys[0]);
+
+ for (int i = 0; i < uncaught_keys_size; ++i)
+ if (strcmp(uncaught_keys[i], key) == 0)
+ return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _asp_filter(void *data, void *loop_data, int type, void *event)
+{
+ if (type != ECORE_EVENT_KEY_DOWN && type != ECORE_EVENT_KEY_UP)
+ return EINA_TRUE;
+
+ Ecore_Event_Key *ev = event;
+
+ if (!_is_intercepted(ev->key))
+ return EINA_TRUE;
+
+ if (type == ECORE_EVENT_KEY_DOWN)
+ eldbus_service_signal_emit(iface, KEY_DOWN_SIGNAL, ev->key);
+ else
+ eldbus_service_signal_emit(iface, KEY_UP_SIGNAL, ev->key);
+
+ return EINA_FALSE;
+}
+
+void _ssp_submodule_init()
+{
+ if (screen_switch_provider_filter)
+ return;
+
+ screen_switch_provider_filter = ecore_event_filter_add(NULL, _ssp_filter, NULL, NULL);
+ device_number_shift = DEVICE_NUMBER_OFFSET;
+}
+
+void _ssp_submodule_shutdown()
+{
+ if (!screen_switch_provider_filter)
+ return;
+
+ ecore_event_filter_del(screen_switch_provider_filter);
+ screen_switch_provider_filter = NULL;
+ device_number_shift = 0;
+}
+
+void _asp_submodule_init()
+{
+ if (accessories_switch_provider_filter)
+ return;
+
+ accessories_switch_provider_filter = ecore_event_filter_add(NULL, _asp_filter, NULL, NULL);
+}
+
+void _asp_submodule_shutdown()
+{
+ if (!accessories_switch_provider_filter)
+ return;
+
+ ecore_event_filter_del(accessories_switch_provider_filter);
+ accessories_switch_provider_filter = NULL;
+}