END_TEST;
}
+
+
+int UtcDaliTouchEventCombinerMultipleMouseButton(void)
+{
+ TouchEventCombiner combiner;
+ unsigned long time(0u);
+
+ // Primary down
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
+ point.SetMouseButton(MouseButton::PRIMARY);
+
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1, TEST_LOCATION);
+ }
+
+ // secondary down
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
+ point.SetMouseButton(MouseButton::SECONDARY);
+
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, ++time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2, TEST_LOCATION);
+ }
+
+ // move
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 150.0f, 150.0f);
+ point.SetMouseButton(MouseButton::PRIMARY);
+
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, ++time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2, TEST_LOCATION);
+ }
+
+ // up event
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point = GeneratePoint(1, PointState::UP, 150.0f, 150.0f);
+ point.SetMouseButton(MouseButton::PRIMARY);
+
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, ++time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2, TEST_LOCATION);
+ }
+
+ // up event
+ {
+ Integration::TouchEvent touchEvent;
+ Integration::HoverEvent hoverEvent;
+ Integration::Point point = GeneratePoint(1, PointState::UP, 150.0f, 150.0f);
+ point.SetMouseButton(MouseButton::SECONDARY);
+
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, ++time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1, TEST_LOCATION);
+ }
+
+ END_TEST;
+}
{
const unsigned long DEFAULT_MINIMUM_MOTION_TIME(1u);
const Vector2 DEFAULT_MINIMUM_MOTION_DISTANCE(1.0f, 1.0f);
+
+inline bool CheckEqualInputSource(const Point& lhs, const int deviceId, const MouseButton::Type mouseButton)
+{
+ return (lhs.GetDeviceId() == deviceId) && /// Check device id is equal and
+ ((mouseButton == MouseButton::INVALID) || /// ...Check whether input point is not from mouse
+ (mouseButton == lhs.GetMouseButton())); /// ...or from same mouse button
+}
} // unnamed namespace
struct TouchEventCombiner::PointInfo
const PointState::Type state = point.GetState();
const int deviceId = point.GetDeviceId();
const Device::Class::Type deviceType = point.GetDeviceClass();
+ const MouseButton::Type mouseButton = point.GetMouseButton();
switch(state)
{
// Iterate through already stored touch points and add to TouchEvent
for(PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter)
{
- if(iter->point.GetDeviceId() != deviceId)
+ if(!CheckEqualInputSource(iter->point, deviceId, mouseButton))
{
if(!isMultiTouchEvent)
{
PointInfoContainer::iterator match(mPressedPoints.end());
for(PointInfoContainer::iterator iter = mPressedPoints.begin(), endIter = mPressedPoints.end(); iter != endIter; ++iter)
{
- if(deviceId == iter->point.GetDeviceId())
+ if(CheckEqualInputSource(iter->point, deviceId, mouseButton))
{
match = iter;
if(match != mPressedPoints.end())
{
PointInfo matchedPoint(point, time);
+ matchedPoint.point.SetMouseButton(match->point.GetMouseButton());
std::swap(*match, matchedPoint);
dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // Dispatch touch event