}
Eldbus_Message *
-_e_dispatch_drag_event(DragInfo drag_info, Eldbus_Connection *conn, const Eldbus_Message *msg)
+_e_dispatch_drag_event(DragInfo drag_info, int pointers_no, Eldbus_Connection *conn, const Eldbus_Message *msg)
{
Eldbus_Message *error_message = _check_and_correct_gesture_data(&drag_info, msg);
if (error_message)
return error_message;
+ if (pointers_no < 1)
+ return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Number of pointers is expected to be higher than 0.");
+
GestureCommand *cmd = (GestureCommand *)malloc(sizeof(GestureCommand));
if (!cmd)
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.Failed", "Malloc error.");
- cmd->drag_info[0] = drag_info;
- cmd->drag_info_size = 1;
+ for (int i = 0; i < pointers_no; ++i)
+ cmd->drag_info[i] = drag_info;
+
+ cmd->drag_info_size = pointers_no;
cmd->sequence_counter = 0;
cmd->conn = conn;
cmd->reply = eldbus_message_method_return_new(msg);
{ "ObjectNeedsScrollGesture", ELDBUS_ARGS({"i", "int"}, {"i", "int"}), NULL,
_object_needs_scroll_gesture
},
- { "DispatchDragEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"d", "double"}), NULL,
+ { "DispatchDragEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}, {"d", "double"}, {"i", "int"}), NULL,
_dispatch_drag_event
},
{ "DispatchPinchEvent", ELDBUS_ARGS({"i", "int"}, {"i", "int"}, {"i", "int"}, {"i", "int"}), NULL,
_dispatch_drag_event(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
{
DragInfo drag_info;
- if (eldbus_message_arguments_get(msg, "iiiiid", &drag_info.start.x, &drag_info.start.y, &drag_info.end.x, &drag_info.end.y, &drag_info.steps, &drag_info.hold_time))
- return _e_dispatch_drag_event(drag_info, conn, msg);
+ int pointers_no;
+ if (eldbus_message_arguments_get(msg, "iiiiidi", &drag_info.start.x, &drag_info.start.y, &drag_info.end.x, &drag_info.end.y, &drag_info.steps, &drag_info.hold_time, &pointers_no))
+ return _e_dispatch_drag_event(drag_info, pointers_no, conn, msg);
ERROR("eldbus_message_arguments_get() error\n");
return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Cannot get correct arguments");