#define MOVE_STEP 10
#define ZOOM_LENGTH 150
+
+#define DRAG_INITIAL_STEPS 3
+#define DRAG_FINAL_STEPS 1
+
enum
{
TAP,
SWIPE_DOWN,
ZOOM_IN,
ZOOM_OUT,
+ DRAG
};
int device_number_shift;
TouchInputSequence *ts;
} TouchCommand;
+ typedef struct _DragTouchCommand {
+ int type;
+ int x1, y1;
+ int x2, y2;
+ int steps;
+ int initial_sequence_counter;
+ int sequence_counter;
+ TouchInputSequence *ts;
+ } DragTouchCommand;
+
static TouchCommand tc;
+static DragTouchCommand dtc;
static int _move_count = -1;
static int _zw = 0;
{-1}
};
+static TouchInputSequence _ts_drag[] = {
+ /* down */
+ {0.0, _dispatch_mouse_in_event, 0},
+ {0.0, _dispatch_mouse_move_event, 0},
+ {0.0, _dispatch_mouse_down_event, 0},
+ /* move */
+ {0.01, _dispatch_mouse_move_event, 0},
+ /* up */
+ {0.1, _dispatch_mouse_up_event, 0},
+ {-1}
+};
+
static Ecore_Device * _get_device()
{
const Eina_List *dev_list = NULL;
return ECORE_CALLBACK_CANCEL;
}
+Eina_Bool
+_drag_touch_sequence_timer(void *data)
+{
+ DragTouchCommand *dtc = data;
+
+ if (dtc == NULL || dtc->ts->delay < 0)
+ return ECORE_CALLBACK_CANCEL;
+
+ if (dtc->initial_sequence_counter < DRAG_INITIAL_STEPS) {
+ dtc->initial_sequence_counter++;
+ dtc->ts->dispatch_func(dtc->type, dtc->x1, dtc->y1, 0);
+ dtc->ts++;
+
+ ecore_timer_add(dtc->ts->delay, _drag_touch_sequence_timer, dtc);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (dtc->sequence_counter <= dtc->steps) {
+ int current_x = (dtc->x1 * (dtc->steps - dtc->sequence_counter) + dtc->x2 * dtc->sequence_counter) / (dtc->steps);
+ int current_y = (dtc->y1 * (dtc->steps - dtc->sequence_counter) + dtc->y2 * dtc->sequence_counter) / (dtc->steps);
+ dtc->sequence_counter++;
+ dtc->ts->dispatch_func(dtc->type, current_x, current_y, 0);
+
+ ecore_timer_add(dtc->ts->delay, _drag_touch_sequence_timer, dtc);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ dtc->ts++;
+ dtc->ts->dispatch_func(dtc->type, dtc->x2, dtc->y2, 0);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
void _e_dispatch_gesture_event(int type, int x, int y)
{
E_Zone *zone;
ecore_timer_add(tc.ts->delay, _touch_sequnece_timer, &tc);
}
+
+void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps)
+{
+ E_Zone *zone;
+
+ zone = e_zone_current_get();
+ if (zone)
+ {
+ _zw = zone->w;
+ _zh = zone->h;
+ }
+ else
+ {
+ ERROR("Fail to find zone");
+ return;
+ }
+
+ if (x1 < 0 || y1 < 0 || x1 > _zw || y1 > _zh || steps < 1)
+ {
+ ERROR("Invalid value: %d, %d, %d", x1, y1, steps);
+ return;
+ }
+
+ // Starting drag gesture from edge causes additional gesture on the screen
+ if (x1 == 0) x1 += 1;
+ if (x1 == _zw) x1 -= 1;
+ if (y1 == 0) y1 += 1;
+ if (y1 == _zh) y1 -= 1;
+
+ dtc.type = DRAG;
+ dtc.x1 = x1;
+ dtc.y1 = y1;
+ dtc.x2 = x2;
+ dtc.y2 = y2;
+ dtc.steps = steps;
+ dtc.initial_sequence_counter = 0;
+ dtc.sequence_counter = 0;
+ dtc.ts = _ts_drag;
+
+ ecore_timer_add(0.0, _drag_touch_sequence_timer, &dtc);
+}
static Eldbus_Message *_is_selection_mode(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_object_needs_scroll_gesture(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static Eldbus_Message *_dispatch_gesture_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
+static Eldbus_Message *_dispatch_drag_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg);
static const Eldbus_Method methods[] = {
{ "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}),
{ "DispatchGestureEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
_dispatch_gesture_event
},
+ { "DispatchDragEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
+ _dispatch_drag_event
+ },
{ }
};
return eldbus_message_method_return_new(msg);
}
+static Eldbus_Message *
+_dispatch_drag_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+{
+ int x1, y1, x2, y2, steps;
+ if (eldbus_message_arguments_get(msg, "iiiii", &x1, &y1, &x2, &y2, &steps))
+ {
+ _e_dispatch_drag_event(x1, y1, x2, y2, steps);
+ }
+ else
+ ERROR("eldbus_message_arguments_get() error\n");
+
+ return eldbus_message_method_return_new(msg);
+}
+
static int
_fetch_a11y_bus_address(void)
{