When processing multiple multi-touches, they are grouped and processed.
Group multi-touch events and process them when a frame event occurs.
Change-Id: I1e3ac2a0026f3f95910b53521f3ddd8c6108de3c
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#if defined(DEBUG_ENABLED)
Debug::Filter* gSceneHolderLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_SCENE_HOLDER");
#endif
+
+const uint32_t MAX_PRESSED_POINT_COUNT = 2;
} // unnamed namespace
uint32_t SceneHolder::mSceneHolderCounter = 0;
mAdaptor(nullptr),
mDpi(),
mAdaptorStarted(false),
- mVisible(true)
+ mVisible(true),
+ mHandledMultiTouch(false),
+ mPreviousTouchEvent(),
+ mPreviousHoverEvent(),
+ mPreviousType(Integration::TouchEventCombiner::DISPATCH_NONE)
{
}
{
timeStamp = TimeService::GetMilliSeconds();
}
-
Vector2 convertedPosition = RecalculatePosition(point.GetScreenPosition());
point.SetScreenPosition(convertedPosition);
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
+ Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent, mHandledMultiTouch);
if(type != Integration::TouchEventCombiner::DISPATCH_NONE)
{
DALI_LOG_INFO(gSceneHolderLogFilter, Debug::Verbose, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y);
// Keep the handle alive until the core events are processed.
Dali::BaseHandle sceneHolder(this);
- // First the touch and/or hover event & related gesture events are queued
+ uint32_t pointCount = touchEvent.GetPointCount();
+ if(pointCount > MAX_PRESSED_POINT_COUNT)
+ {
+ mPreviousTouchEvent = touchEvent;
+ mPreviousHoverEvent = hoverEvent;
+ if(mPreviousType == Integration::TouchEventCombiner::DISPATCH_NONE)
+ {
+ mPreviousType = type;
+ }
+ else if(mPreviousType != type)
+ {
+ mPreviousType = Integration::TouchEventCombiner::DISPATCH_BOTH;
+ }
+ mHandledMultiTouch = true;
+ }
+
if(type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
{
mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
- mScene.QueueEvent(touchEvent);
}
if(type == Integration::TouchEventCombiner::DISPATCH_HOVER || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
{
mLastHoverEvent = Dali::Integration::NewHoverEvent(timeStamp, point);
- mScene.QueueEvent(hoverEvent);
}
// Next the events are processed with a single call into Core
+ if(pointCount <= MAX_PRESSED_POINT_COUNT || (point.GetState() != PointState::MOTION))
+ {
+ mHandledMultiTouch = false;
+ mPreviousType = Integration::TouchEventCombiner::DISPATCH_NONE;
+
+ // First the touch and/or hover event & related gesture events are queued
+ if(type == Integration::TouchEventCombiner::DISPATCH_TOUCH || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
+ {
+ mScene.QueueEvent(touchEvent);
+ }
+
+ if(type == Integration::TouchEventCombiner::DISPATCH_HOVER || type == Integration::TouchEventCombiner::DISPATCH_BOTH)
+ {
+ mScene.QueueEvent(hoverEvent);
+ }
+ mAdaptor->ProcessCoreEvents();
+ }
+ }
+}
+
+void SceneHolder::FeedMouseFrameEvent()
+{
+ if(DALI_UNLIKELY(!mAdaptorStarted))
+ {
+ DALI_LOG_ERROR("Adaptor is stopped, or not be started yet. Ignore this feed.\n");
+ return;
+ }
+
+ if(mPreviousType == Integration::TouchEventCombiner::DISPATCH_TOUCH || mPreviousType == Integration::TouchEventCombiner::DISPATCH_BOTH)
+ {
+ mScene.QueueEvent(mPreviousTouchEvent);
+ }
+
+ if(mPreviousType == Integration::TouchEventCombiner::DISPATCH_HOVER || mPreviousType == Integration::TouchEventCombiner::DISPATCH_BOTH)
+ {
+ mScene.QueueEvent(mPreviousHoverEvent);
+ }
+
+ if(mPreviousType != Integration::TouchEventCombiner::DISPATCH_NONE)
+ {
mAdaptor->ProcessCoreEvents();
}
+
+ mHandledMultiTouch = false;
+ mPreviousType = Integration::TouchEventCombiner::DISPATCH_NONE;
}
const Dali::TouchEvent& SceneHolder::GetLastTouchEvent() const
mScene.QueueEvent(event);
// Next the events are processed with a single call into Core
+ mHandledMultiTouch = false;
+ mPreviousType = Integration::TouchEventCombiner::DISPATCH_NONE;
mAdaptor->ProcessCoreEvents();
}
#define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/point.h>
#include <dali/integration-api/events/touch-event-combiner.h>
+#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/scene.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/events/hover-event.h>
*/
void FeedTouchPoint(Dali::Integration::Point& point, int timeStamp);
+ /**
+ * @copydoc Dali::Integration::SceneHolder::FeedMouseFrameEvent
+ */
+ void FeedMouseFrameEvent();
+
/**
* @brief Get the Last Touch Event
*
Uint16Pair mDpi; ///< The DPI for this SceneHolder.
- bool mAdaptorStarted; ///< Whether the adaptor has started or not
- bool mVisible : 1; ///< Whether the scene is visible or not
+ bool mAdaptorStarted; ///< Whether the adaptor has started or not
+ bool mVisible : 1; ///< Whether the scene is visible or not
+ bool mHandledMultiTouch : 1;
+ Integration::TouchEvent mPreviousTouchEvent;
+ Integration::HoverEvent mPreviousHoverEvent;
+ Integration::TouchEventCombiner::EventDispatchType mPreviousType;
};
} // namespace Adaptor
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
windowBase->FocusChangedSignal().Connect(this, &EventHandler::OnFocusChanged);
windowBase->RotationSignal().Connect(this, &EventHandler::OnRotation);
windowBase->TouchEventSignal().Connect(this, &EventHandler::OnTouchEvent);
+ windowBase->MouseFrameEventSignal().Connect(this, &EventHandler::OnMouseFrameEvent);
windowBase->WheelEventSignal().Connect(this, &EventHandler::OnWheelEvent);
windowBase->KeyEventSignal().Connect(this, &EventHandler::OnKeyEvent);
windowBase->SelectionDataSendSignal().Connect(this, &EventHandler::OnSelectionDataSend);
}
}
+void EventHandler::OnMouseFrameEvent()
+{
+ for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
+ {
+ (*iter)->OnMouseFrameEvent();
+ }
+}
+
void EventHandler::OnWheelEvent(Integration::WheelEvent& wheelEvent)
{
for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
#define DALI_INTERNAL_EVENT_HANDLER_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
virtual void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) = 0;
+ /**
+ * @brief Deriving classes should override this to be notified when we receive a mouse frame event.
+ */
+ virtual void OnMouseFrameEvent() = 0;
+
/**
* Deriving classes should override this to be notified when we receive a wheel event.
* @param[in] wheelEvent The wheel event
*/
void OnTouchEvent(Integration::Point& point, uint32_t timeStamp);
+ /**
+ * Called when a mouse frame event is received.
+ */
+ void OnMouseFrameEvent();
+
/**
* Called when a mouse wheel is received.
*/
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mTouchedSignal.Emit(touchEvent);
}
+void GlWindow::OnMouseFrameEvent()
+{
+}
+
void GlWindow::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
{
// TODO:
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_GL_WINDOW_IMPL_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnMouseFrameEvent
+ */
+ void OnMouseFrameEvent() override;
+
/**
* @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
*/
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mWindowDamagedSignal(),
mRotationSignal(),
mTouchEventSignal(),
+ mMouseFrameEventSignal(),
mWheelEventSignal(),
mKeyEventSignal(),
mSelectionDataSendSignal(),
return mTouchEventSignal;
}
+WindowBase::MouseFrameEventSignalType& WindowBase::MouseFrameEventSignal()
+{
+ return mMouseFrameEventSignal;
+}
+
WindowBase::WheelEventSignalType& WindowBase::WheelEventSignal()
{
return mWheelEventSignal;
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Input events
typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
+ typedef Signal<void()> MouseFrameEventSignalType;
typedef Signal<void(Integration::WheelEvent&)> WheelEventSignalType;
typedef Signal<void(Integration::KeyEvent&)> KeyEventSignalType;
*/
virtual void SetFrontBufferRendering(bool enable) = 0;
- /**
+ /**
* @brief Enables or disables front buffer rendering.
* @return Returns whether front buffer rendering has been enabled or not.
*/
*/
TouchEventSignalType& TouchEventSignal();
+ /**
+ * @brief This signal is emitted when a mouse frame event is received.
+ */
+ MouseFrameEventSignalType& MouseFrameEventSignal();
+
/**
* @brief This signal is emitted when a mouse wheel is received.
*/
DamageSignalType mWindowDamagedSignal;
RotationSignalType mRotationSignal;
TouchEventSignalType mTouchEventSignal;
+ MouseFrameEventSignalType mMouseFrameEventSignal;
WheelEventSignalType mWheelEventSignal;
KeyEventSignalType mKeyEventSignal;
SelectionSignalType mSelectionDataSendSignal;
FeedTouchPoint(point, timeStamp);
}
+void Window::OnMouseFrameEvent()
+{
+ FeedMouseFrameEvent();
+}
+
void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
{
FeedWheelEvent(wheelEvent);
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
+ /**
+ * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnMouseFrameEvent
+ */
+ void OnMouseFrameEvent() override;
+
/**
* @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
*/
bool mOpaqueState : 1;
bool mWindowRotationAcknowledgement : 1;
bool mFocused : 1;
- bool mIsWindowRotating : 1; ///< The window rotating flag.
- bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag.
+ bool mIsWindowRotating : 1; ///< The window rotating flag.
+ bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag.
bool mIsEmittedWindowCreatedEvent : 1; ///< The Window Created Event emit flag for accessibility.
bool mIsFrontBufferRendering : 1; ///< The Front Buffer Rendering state.
};
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// timestamp is given in seconds, the signal expects it in milliseconds
mThis->mTouchEventSignal.Emit(point, event.timestamp * 1000);
+
+ mThis->mMouseFrameEventSignal.Emit();
}
}
point.SetDeviceSubclass(deviceSubclass);
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetDeviceSubclass(deviceSubclass);
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetDeviceSubclass(deviceSubclass);
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
mTouchEventSignal.Emit(point, touchEvent->timestamp);
DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n");
+
+ mMouseFrameEventSignal.Emit();
}
}
}
#ifdef OVER_TIZEN_VERSION_8
+/**
+ * Called when a touch motion is received.
+ */
+static Eina_Bool EcoreEventMouseFrame(void* data, int type, void* event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ if(windowBase)
+ {
+ windowBase->OnMouseFrame(data, type, event);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
/**
* Called when a touch motion is received.
*/
// Register pointer lock/unlock event
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_POINTER_CONSTRAINTS, EcoreEventPointerConstraints, this));
+
+ // Register mouse frame events
+ mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_FRAME, EcoreEventMouseFrame, this));
#endif
// Register Mouse wheel events
point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+#ifndef OVER_TIZEN_VERSION_8
+ mMouseFrameEventSignal.Emit();
+#endif
}
}
point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+#ifndef OVER_TIZEN_VERSION_8
+ mMouseFrameEventSignal.Emit();
+#endif
}
}
point.SetDeviceSubclass(deviceSubclass);
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+#ifndef OVER_TIZEN_VERSION_8
+ mMouseFrameEventSignal.Emit();
+#endif
}
}
#ifdef OVER_TIZEN_VERSION_8
+void WindowBaseEcoreWl2::OnMouseFrame(void* data, int type, void* event)
+{
+ Ecore_Event_Mouse_Frame* MouseFrameEvent = static_cast<Ecore_Event_Mouse_Frame*>(event);
+
+ if(MouseFrameEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)) && Dali::Adaptor::IsAvailable())
+ {
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_FRAME");
+ mMouseFrameEventSignal.Emit();
+ }
+}
+
void WindowBaseEcoreWl2::OnMouseButtonRelativeMove(void* data, int type, void* event)
{
Ecore_Event_Mouse_Relative_Move* relativeMoveEvent = static_cast<Ecore_Event_Mouse_Relative_Move*>(event);
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+#ifndef OVER_TIZEN_VERSION_8
+ mMouseFrameEventSignal.Emit();
+#endif
+
DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
}
}
#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void OnMouseButtonMove(void* data, int type, void* event);
+ /**
+ * @brief Called when a mouse frame is received.
+ */
+ void OnMouseFrame(void* data, int type, void* event);
+
/**
* @brief Called when a touch motion is received.
*/
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
}
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
point.SetAngle(Degree(touchEvent.multi.angle));
mTouchEventSignal.Emit(point, touchEvent.timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetAngle(Degree(touchEvent.multi.angle));
mTouchEventSignal.Emit(point, touchEvent.timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetAngle(Degree(touchEvent.multi.angle));
mTouchEventSignal.Emit(point, touchEvent.timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
}
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}
point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
mTouchEventSignal.Emit(point, touchEvent->timestamp);
+
+ mMouseFrameEventSignal.Emit();
}
}