e_universal_switch.c \
e_mod_utils.c \
e_mod_accessibility_conf.c \
- e_dispatch_key_event.c
+ e_dispatch_key_event.c \
+ e_dispatch_rotary_event.c
module_la_LIBADD =
module_la_CFLAGS = @ENLIGHTENMENT_CFLAGS@
--- /dev/null
+#include "e_dispatch_rotary_event.h"
+#include "e_mod_utils.h"
+#include "e_screen_reader_private.h"
+
+#define STARTING_Z_COORDINATE -15
+#define FINAL_Z_COORDINATE_CLOCKWISE -30
+#define FINAL_Z_COORDINATE_COUNTER_CLOCKWISE 30
+#define CONST_COORDINATE 180
+
+typedef struct _RotaryCommand {
+ RotaryInfo info;
+ Eina_Bool starting_sent;
+ Eldbus_Message *reply;
+ Eldbus_Connection *conn;
+} RotaryCommand;
+
+static Ecore_Event_Mouse_Wheel*
+_create_wheel_event(int z_coordinate)
+{
+ Ecore_Event_Mouse_Wheel *ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+
+ ev->window = e_comp->ee_win;
+ ev->root_window = e_comp->ee_win;
+ ev->event_window = e_comp->ee_win;
+
+ ev->timestamp= (int)(ecore_time_get() * 1000.0);
+ ev->modifiers = 0;
+
+ ev->same_screen = 1;
+ ev->direction = 0;
+ ev->z = z_coordinate;
+
+ ev->x = CONST_COORDINATE;
+ ev->y = CONST_COORDINATE;
+ ev->root.x = CONST_COORDINATE;
+ ev->root.y = CONST_COORDINATE;
+
+ ev->dev = _get_device();
+
+ return ev;
+}
+
+static Eina_Bool _on_rotary_timer(void *data)
+{
+ RotaryCommand *cmd = data;
+ if (cmd->info.multiplicity <= 0) {
+ eldbus_connection_send(cmd->conn, cmd->reply, NULL, NULL, -1);
+ free(cmd);
+ return EINA_FALSE;
+ }
+
+ Ecore_Event_Mouse_Wheel *ev = NULL;
+ if (!cmd->starting_sent) {
+ ev = _create_wheel_event(STARTING_Z_COORDINATE);
+ cmd->starting_sent = EINA_TRUE;
+ ecore_timer_add(0.0, _on_rotary_timer, cmd);
+ } else {
+ ev = _create_wheel_event(cmd->info.clockwise ? FINAL_Z_COORDINATE_CLOCKWISE : FINAL_Z_COORDINATE_COUNTER_CLOCKWISE);
+ --cmd->info.multiplicity;
+ cmd->starting_sent = EINA_FALSE;
+ ecore_timer_add(cmd->info.interval, _on_rotary_timer, cmd);
+ }
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+ return EINA_FALSE;
+}
+
+Eldbus_Message *_e_dispatch_rotary_event(RotaryInfo info, Eldbus_Connection *conn, const Eldbus_Message *msg)
+{
+ if (info.multiplicity < 1)
+ return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Multiplicity is expected to be higher than 0.");
+
+ RotaryCommand* cmd = malloc(sizeof(RotaryCommand));
+ cmd->info = info;
+ cmd->starting_sent = EINA_FALSE;
+ cmd->conn = conn;
+ cmd->reply = eldbus_message_method_return_new(msg);
+
+ ecore_timer_add(0.0, _on_rotary_timer, cmd);
+ return NULL;
+}
\ No newline at end of file
--- /dev/null
+#ifndef E_DISPATCH_ROTARY_EVENT_H_
+#define E_DISPATCH_ROTARY_EVENT_H_
+
+#include "e.h"
+
+typedef struct _RotaryInfo {
+ Eina_Bool clockwise;
+ int multiplicity;
+ double interval;
+} RotaryInfo;
+
+Eldbus_Message *_e_dispatch_rotary_event(RotaryInfo info, Eldbus_Connection *conn, const Eldbus_Message *msg);
+
+#endif
\ No newline at end of file
#include <e_dispatch_key_event.h>
#include "e_universal_switch.h"
#include "e_mod_accessibility_conf.h"
+#include <e_dispatch_rotary_event.h>
#define E_A11Y_SERVICE_BUS_NAME "org.enlightenment.wm-screen-reader"
#define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation"
static Eldbus_Message *_dispatch_rotation_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_dispatch_key_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_menu_is_shown(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
+static Eldbus_Message *_dispatch_rotary_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static const Eldbus_Method methods[] = {
{ "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}),
{ "MenuIsShown", ELDBUS_ARGS({"b", "bool"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
_menu_is_shown
},
+ { "DispatchRotaryEvent", ELDBUS_ARGS({"b", "bool"}, {"i", "int"}, {"d", "double"}), NULL,
+ _dispatch_rotary_event
+ },
{ }
};
return eldbus_message_method_return_new(msg);
}
+static Eldbus_Message *_dispatch_rotary_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+{
+ RotaryInfo info;
+
+ if (eldbus_message_arguments_get(msg, "bid", &info.clockwise, &info.multiplicity, &info.interval))
+ {
+ return _e_dispatch_rotary_event(info, conn, msg);
+ }
+ else
+ {
+ ERROR("eldbus_message_arguments_get() error\n");
+ }
+
+ return eldbus_message_method_return_new(msg);
+}
+
static int
_fetch_a11y_bus_address(void)
{
}
}
+//FIXME: return proper device according to required type
Ecore_Device * _get_device()
{
+ Ecore_Device *ret = NULL;
const Eina_List *dev_list = ecore_device_list();
if (!dev_list) return NULL;
const char *identifier = ecore_device_identifier_get(dev);
if (!identifier) continue;
- //FIXME: Find right way to get device class (there could be more than one touch device in the future)
- if (ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_TOUCH)
- return dev;
+ //FIXME: ECORE_DEVICE_CLASS_NONE is used on emulator
+ if (ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_MOUSE || ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_NONE)
+ ret = dev;
}
- return NULL;
+
+ return ret;
}
typedef struct _keycode_map_entry{