/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
END_TEST;
}
-
-int UtcDaliTapGestureSetGetSourceTypeP(void)
-{
- TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
- DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::INVALID, TEST_LOCATION);
-
- GetImplementation(gesture).SetGestureSourceType(GestureSourceType::PRIMARY);
- DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::PRIMARY, TEST_LOCATION);
-
- GetImplementation(gesture).SetGestureSourceType(GestureSourceType::SECONDARY);
- DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::SECONDARY, TEST_LOCATION);
-
- GetImplementation(gesture).SetGestureSourceType(GestureSourceType::TERTIARY);
- DALI_TEST_EQUALS(gesture.GetSourceType(), GestureSourceType::TERTIARY, TEST_LOCATION);
-
- END_TEST;
-}
\ No newline at end of file
renderTask.SetSourceActor(blue);
renderTask.SetViewportGuideActor(blue);
- application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_HEIGHT,
- TestApplication::DEFAULT_SURFACE_WIDTH,
- 90);
+ application.GetScene().SurfaceRotated(static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT),
+ static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH),
+ 90, 0);
// Render and notify
application.SendNotification();
DALI_TEST_CHECK(callStack.FindIndexFromMethodAndParams("Viewport", viewportParams2) >= 0);
END_TEST;
-}
\ No newline at end of file
+}
actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
application.GetScene().Add(actor);
+ // consume the orientating changing flag by first rendering
application.SendNotification();
damagedRects.clear();
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
TestApplication::DEFAULT_SURFACE_HEIGHT,
- 0);
+ 0, 0);
- // Check current surface orientation
+ // Check current orientations
int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should not be changed yet.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- // Check current surface orientation
+ // Check current orientations
orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should be changed.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
END_TEST;
}
damagedRects.clear();
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
TestApplication::DEFAULT_SURFACE_HEIGHT,
- 90);
+ 90, 90);
// Check current surface orientation
int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should not be changed yet.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- // Check current surface orientation
+ // Check current orientations
orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should be changed.
DALI_TEST_EQUALS(orientation, 90, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 90, TEST_LOCATION);
END_TEST;
}
damagedRects.clear();
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
TestApplication::DEFAULT_SURFACE_HEIGHT,
- 180);
+ 180, 180);
// Check current surface orientation
int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should not be changed yet.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- // Check current surface orientation
+ // Check current orientations
orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should be changed.
DALI_TEST_EQUALS(orientation, 180, TEST_LOCATION);
+DALI_TEST_EQUALS(screenOrientation, 180, TEST_LOCATION);
END_TEST;
}
damagedRects.clear();
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
TestApplication::DEFAULT_SURFACE_HEIGHT,
- 270);
+ 270, 270);
// Check current surface orientation
int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should not be changed yet.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- // Check current surface orientation
+ // Check current orientations
orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should be changed.
DALI_TEST_EQUALS(orientation, 270, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 270, TEST_LOCATION);
END_TEST;
}
damagedRects.clear();
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_WIDTH,
TestApplication::DEFAULT_SURFACE_HEIGHT,
- 90);
+ 90, 90);
// Check current surface orientation
int32_t orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ int32_t screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should not be changed yet.
DALI_TEST_EQUALS(orientation, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 0, TEST_LOCATION);
application.GetScene().SetRotationCompletedAcknowledgement();
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- // Check current surface orientation
+ // Check current orientations
orientation = application.GetScene().GetCurrentSurfaceOrientation();
+ screenOrientation = application.GetScene().GetCurrentScreenOrientation();
// It should be changed.
DALI_TEST_EQUALS(orientation, 90, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenOrientation, 90, TEST_LOCATION);
bool isSetRotationCompletedAcknowledgementSet = application.GetScene().IsRotationCompletedAcknowledgementSet();
DALI_TEST_EQUALS(isSetRotationCompletedAcknowledgementSet, true, TEST_LOCATION);
// Rotate surface
application.GetScene().SurfaceRotated(TestApplication::DEFAULT_SURFACE_HEIGHT,
TestApplication::DEFAULT_SURFACE_WIDTH,
- 90);
+ 90, 0);
damagedRects.clear();
detector.DetectedSignal().Connect(&application, functor);
// Emit a down signal with MouseButton
- application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 100));
- application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 120));
- application.SendNotification();
-
- DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::INVALID, TEST_LOCATION);
-
- data.Reset();
-
- // Emit a down signal with MouseButton
- application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 700));
- application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 720));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 120));
application.SendNotification();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::PRIMARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_PRIMARY, TEST_LOCATION);
data.Reset();
application.SendNotification();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::SECONDARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_SECONDARY, TEST_LOCATION);
data.Reset();
application.SendNotification();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::TERTIARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_TERTIARY, TEST_LOCATION);
END_TEST;
}
{
namespace Integration
{
-Scene Scene::New(Size size, int32_t orientation)
+Scene Scene::New(Size size, int32_t windowOrientation, int32_t screenOrientation)
{
- Internal::ScenePtr internal = Internal::Scene::New(size, orientation);
+ Internal::ScenePtr internal = Internal::Scene::New(size, windowOrientation, screenOrientation);
return Scene(internal.Get());
}
GetImplementation(*this).GetFramePresentedCallback(callbacks);
}
-void Scene::SurfaceRotated(float width, float height, int32_t orientation)
+void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
{
- GetImplementation(*this).SurfaceRotated(width, height, orientation);
+ GetImplementation(*this).SurfaceRotated(width, height, windowOrientation, screenOrientation);
}
int32_t Scene::GetCurrentSurfaceOrientation() const
return GetImplementation(*this).GetCurrentSurfaceOrientation();
}
+int32_t Scene::GetCurrentScreenOrientation() const
+{
+ return GetImplementation(*this).GetCurrentScreenOrientation();
+}
+
const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
{
return GetImplementation(*this).GetCurrentSurfaceRect();
* @brief Create an initialized Scene handle.
*
* @param[in] size The size of the set surface for this scene
- * @param[in] orientation The rotated angle of the set surface for this scene
+ * @param[in] windowOrientation The rotated angle of the set surface for this scene
+ * @param[in] screenOrientation The rotated angle of the screen
*
* @return a handle to a newly allocated Dali resource.
*/
- static Scene New(Size size, int32_t orientation = 0);
+ static Scene New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0);
/**
* @brief Downcast an Object handle to Scene handle.
*
* @param[in] width The width of rotated surface
* @param[in] height The height of rotated surface
- * @param[in] orientation The orientation of rotated surface
+ * @param[in] windowOrientation the current window orientation
+ * @param[in] screenOrientation the current screen orientation
*/
- void SurfaceRotated(float width, float height, int32_t orientation);
+ void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
/**
* @brief Gets the current surface orientation. It gets the value from the scene object.
int32_t GetCurrentSurfaceOrientation() const;
/**
+ * @brief Gets the current screen orientation. It gets the value from the scene object.
+ *
+ * @return The current screen orientation.
+ */
+ int32_t GetCurrentScreenOrientation() const;
+
+ /**
* @brief Gets the current surface rectangle. It gets the value from the scene object.
*
* @return The current surface rectangle
{
namespace Internal
{
-ScenePtr Scene::New(Size size, int32_t orientation)
+ScenePtr Scene::New(Size size, int32_t windowOrientation, int32_t screenOrientation)
{
ScenePtr scene = new Scene;
// Second-phase construction
- scene->Initialize(size, orientation);
+ scene->Initialize(size, windowOrientation, screenOrientation);
return scene;
}
mBackgroundColor(DEFAULT_BACKGROUND_COLOR),
mDepthTreeDirty(false),
mEventProcessor(*this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor()),
- mSurfaceOrientation(0)
+ mSurfaceOrientation(0),
+ mScreenOrientation(0)
{
}
// When this destructor is called, the scene has either already been removed from Core or Core has already been destroyed
}
-void Scene::Initialize(Size size, int32_t orientation)
+void Scene::Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation)
{
ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
OwnerPointer<SceneGraph::Scene> transferOwnership(const_cast<SceneGraph::Scene*>(mSceneObject));
AddSceneMessage(updateManager, transferOwnership);
- SurfaceRotated(size.width, size.height, orientation);
+ SurfaceRotated(size.width, size.height, windowOrientation, screenOrientation);
}
void Scene::Add(Actor& actor)
{
if((fabsf(mSize.width - width) > Math::MACHINE_EPSILON_1) || (fabsf(mSize.height - height) > Math::MACHINE_EPSILON_1))
{
- ChangedSurface(width, height, mSurfaceOrientation);
+ ChangedSurface(width, height, mSurfaceOrientation, mScreenOrientation);
}
}
}
}
-void Scene::SurfaceRotated(float width, float height, int32_t orientation)
+void Scene::SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
{
- mSurfaceOrientation = orientation;
- ChangedSurface(width, height, orientation);
+ ChangedSurface(width, height, windowOrientation, screenOrientation);
}
int32_t Scene::GetCurrentSurfaceOrientation() const
return mSceneObject->GetSurfaceOrientation();
}
+int32_t Scene::GetCurrentScreenOrientation() const
+{
+ return mSceneObject->GetScreenOrientation();
+}
+
const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
{
return mSceneObject->GetSurfaceRect();
}
-void Scene::ChangedSurface(float width, float height, int32_t orientation)
+void Scene::ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation)
{
+ bool changedOrientation = false;
Rect<int32_t> newSize(0, 0, static_cast<int32_t>(width), static_cast<int32_t>(height)); // truncated
mSize.width = width;
mSize.height = height;
+ if(mSurfaceOrientation != windowOrientation || mScreenOrientation != screenOrientation)
+ {
+ changedOrientation = true;
+ }
+
+ mSurfaceOrientation = windowOrientation;
+ mScreenOrientation = screenOrientation;
+
// Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
mDefaultCamera->SetPerspectiveProjection(mSize);
// Set the surface orientation to Default camera for window/screen rotation
- mDefaultCamera->RotateProjection(orientation);
+ if(changedOrientation)
+ {
+ int32_t orientation = (windowOrientation + screenOrientation) % 360;
+ mDefaultCamera->RotateProjection(orientation);
+ }
mRootLayer->SetSize(width, height);
// Send the surface rectangle/orientation to SceneGraph::Scene for calculating glViewport/Scissor
ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+ DALI_LOG_RELEASE_INFO("Send Surface Rect Message, width[%d], height[%d]\n", newSize.width, newSize.height);
SetSurfaceRectMessage(tls->GetEventThreadServices(), *mSceneObject, newSize);
- SetSurfaceOrientationMessage(tls->GetEventThreadServices(), *mSceneObject, static_cast<int32_t>(orientation));
+ if(changedOrientation)
+ {
+ DALI_LOG_RELEASE_INFO("Send Surface Orientation Message, surface orientation[%d], screen orientation[%d]\n", mSurfaceOrientation, mScreenOrientation);
+ SetSurfaceOrientationsMessage(tls->GetEventThreadServices(), *mSceneObject, mSurfaceOrientation, mScreenOrientation);
+ }
// set default render-task viewport parameters
RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask(0u);
/**
* @copydoc Dali::Integration::Scene::New
*/
- static ScenePtr New(Size size, int32_t orientation = 0);
+ static ScenePtr New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0);
/**
* virtual destructor
*
* @param[in] width The width of rotated surface
* @param[in] height The height of rotated surface
- * @param[in] orientation The orientation of rotated surface
+ * @param[in] windowOrientation the current window orientation
+ * @param[in] screenOrientation the current screen orientation
*/
- void SurfaceRotated(float width, float height, int32_t orientation);
+ void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
/**
* @copydoc Dali::Integration::Scene::SetRotationCompletedAcknowledgement
int32_t GetCurrentSurfaceOrientation() const;
/**
+ * @copydoc Dali::Integration::Scene::GetCurrentScreenOrientation
+ */
+ int32_t GetCurrentScreenOrientation() const;
+
+ /**
* @copydoc Dali::Integration::Scene::GetCurrentSurfaceRect
*/
const Rect<int32_t>& GetCurrentSurfaceRect() const;
* Second-phase constructor.
*
* @param[in] size The size of the set surface
- * @param[in] orientation The orientation of the set surface for this scene
+ * @param[in] windowOrientation The rotated angle of the set surface for this scene
+ * @param[in] screenOrientation The rotated angle of the screen
*/
- void Initialize(Size size, int32_t orientation);
+ void Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation);
// Undefined
Scene(const Scene&) = delete;
*
* @param[in] width The width of rotated surface
* @param[in] height The height of rotated surface
- * @param[in] orientation The orientation of rotated surface
+ * @param[in] windowOrientation the current window orientation
+ * @param[in] screenOrientation the current screen orientation
*/
- void ChangedSurface(float width, float height, int32_t orientation);
+ void ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
private:
Internal::SceneGraph::Scene* mSceneObject;
// The Surface's orientation
int32_t mSurfaceOrientation;
+ // The Screen's orientation
+ int32_t mScreenOrientation;
+
// The key event signal
Integration::Scene::KeyEventSignalType mKeyEventSignal;
Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
GestureEvent::GestureEvent(GestureType::Value gesture, GestureState gestureState)
: gestureType(gesture),
state(gestureState),
- time(0)
+ time(0),
+ sourceType(GestureSourceType::INVALID),
+ sourceData(GestureSourceData::INVALID)
{
}
} // namespace Internal
#define DALI_INTERNAL_EVENT_GESTURE_EVENT_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
uint32_t time;
+ /**
+ * This is the value of which source the gesture was started with. (ex : mouse)
+ */
+ GestureSourceType sourceType;
+
+ /**
+ * The data of the source type.
+ */
+ GestureSourceData sourceData;
+
protected: // Constructors only to be used by derived structures.
/**
* This constructor is only used by derived classes.
#define DALI_INTERNAL_GESTURE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return mTime;
}
+ /**
+ * @brief Sets the value of which source the gesture was started with. (ex : mouse)
+ * @param[in] source The gesture source type.
+ */
+ inline void SetSourceType(GestureSourceType source)
+ {
+ mSourceType = source;
+ }
+
+ /**
+ * @brief Gets the value of which source the gesture was started with.
+ * @return The gesture source type.
+ */
+ inline GestureSourceType GetSourceType() const
+ {
+ return mSourceType;
+ }
+
+ /**
+ * @brief Sets the value of source data.
+ * @param[in] data The gesture source data.
+ */
+ inline void SetSourceData(GestureSourceData data)
+ {
+ mSourceData = data;
+ }
+
+ /**
+ * @brief Gets the data of source type.
+ * @return The gesture source data.
+ */
+ inline GestureSourceData GetSourceData() const
+ {
+ return mSourceData;
+ }
+
Gesture(const Gesture&) = delete; ///< Deleted copy constructor
Gesture(Gesture&&) = delete; ///< Deleted move constructor
Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
*/
Gesture(GestureType::Value gestureType, GestureState gestureState)
: mGestureType(gestureType),
- mState(gestureState)
+ mState(gestureState),
+ mSourceType(GestureSourceType::INVALID),
+ mSourceData(GestureSourceData::INVALID)
{
}
GestureType::Value mGestureType;
GestureState mState;
uint32_t mTime{0u};
+ GestureSourceType mSourceType;
+ GestureSourceData mSourceData;
};
} // namespace Internal
#define DALI_INTERNAL_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
// EXTERNAL INCLUDES
+#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/internal/event/events/gesture-event.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/gesture.h>
void SendEvent(Scene& scene, const Integration::TouchEvent& event)
{
mScene = &scene;
+ if(event.GetPointCount() > 0)
+ {
+ const Integration::Point& point = event.points[0];
+ MouseButton::Type mouseButton = point.GetMouseButton();
+ if(mouseButton != MouseButton::INVALID)
+ {
+ mSourceType = GestureSourceType::MOUSE;
+ switch(mouseButton)
+ {
+ case MouseButton::PRIMARY:
+ {
+ mSourceData = GestureSourceData::MOUSE_PRIMARY;
+ break;
+ }
+ case MouseButton::SECONDARY:
+ {
+ mSourceData = GestureSourceData::MOUSE_SECONDARY;
+ break;
+ }
+ case MouseButton::TERTIARY:
+ {
+ mSourceData = GestureSourceData::MOUSE_TERTIARY;
+ break;
+ }
+ default:
+ {
+ mSourceData = GestureSourceData::INVALID;
+ break;
+ }
+ }
+ }
+ }
SendEvent(event);
}
GestureRecognizer(Vector2 screenSize, GestureType::Value detectorType)
: mScreenSize(screenSize),
mType(detectorType),
- mScene(nullptr)
+ mScene(nullptr),
+ mSourceType(GestureSourceType::INVALID),
+ mSourceData(GestureSourceData::INVALID)
{
}
Vector2 mScreenSize;
GestureType::Value mType;
Scene* mScene;
+ GestureSourceType mSourceType; /// < Gesture input source type.
+ GestureSourceData mSourceData; /// < Gesture input source data.
};
using GestureRecognizerPtr = IntrusivePtr<GestureRecognizer>;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
longPress->SetNumberOfTouches(longPressEvent.numberOfTouches);
longPress->SetScreenPoint(longPressEvent.point);
longPress->SetLocalPoint(localPoint);
+ longPress->SetSourceType(longPressEvent.sourceType);
+ longPress->SetSourceData(longPressEvent.sourceData);
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
longPress.time += mMinimumHoldingTime;
}
+ longPress.sourceType = mSourceType;
+ longPress.sourceData = mSourceData;
if(mScene)
{
pan->SetNumberOfTouches(panEvent.numberOfTouches);
pan->SetScreenPosition(panEvent.currentPosition);
pan->SetPosition(localCurrent);
+ pan->SetSourceType(panEvent.sourceType);
+ pan->SetSourceData(panEvent.sourceData);
RenderTask& renderTaskImpl(*renderTask.Get());
gesture.timeDelta = 0;
}
- gesture.time = currentEvent.time;
+ gesture.time = currentEvent.time;
+ gesture.sourceType = mSourceType;
+ gesture.sourceData = mSourceData;
if(mScene)
{
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
pinch->SetScreenCenterPoint(pinchEvent.centerPoint);
pinch->SetLocalCenterPoint(localCenter);
+ pinch->SetSourceType(pinchEvent.sourceType);
+ pinch->SetSourceData(pinchEvent.sourceData);
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
gesture.state = GestureState::CANCELLED;
}
- gesture.time = currentEvent.time;
+ gesture.time = currentEvent.time;
+ gesture.sourceType = mSourceType;
+ gesture.sourceData = mSourceData;
if(mScene)
{
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
rotation->SetRotation(rotationEvent.rotation);
rotation->SetScreenCenterPoint(rotationEvent.centerPoint);
rotation->SetLocalCenterPoint(localCenter);
+ rotation->SetSourceType(rotationEvent.sourceType);
+ rotation->SetSourceData(rotationEvent.sourceData);
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
gesture.state = GestureState::CANCELLED;
}
- gesture.time = currentEvent.time;
+ gesture.time = currentEvent.time;
+ gesture.sourceType = mSourceType;
+ gesture.sourceData = mSourceData;
if(mScene)
{
internalTap->SetNumberOfTouches(tap.GetNumberOfTouches());
internalTap->SetScreenPoint(tap.GetScreenPoint());
internalTap->SetLocalPoint(tap.GetLocalPoint());
- internalTap->SetGestureSourceType(tap.GetSourceType());
+ internalTap->SetSourceType(tap.GetSourceType());
+ internalTap->SetSourceData(tap.GetSourceData());
internalTap->SetNumberOfTaps(numberOfTaps == 0u ? mMaximumTapsRequired : numberOfTaps);
mTap = Dali::TapGesture(internalTap.Get());
if(numberOfTaps == 0u || mReceiveAllTapEvents)
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
TapGestureEvent::TapGestureEvent(GestureState state)
: GestureEvent(GestureType::TAP, state),
numberOfTaps(1),
- numberOfTouches(1),
- gestureSourceType(GestureSourceType::INVALID)
+ numberOfTouches(1)
{
}
#define DALI_INTERNAL_EVENT_TAP_GESTURE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 a multi-touch tap, then this should be the centroid of all the touch points.
*/
Vector2 point;
-
- /**
- * This is the value of which input was tapped.
- */
- GestureSourceType gestureSourceType;
};
} // namespace Internal
#define DALI_INTERNAL_TAP_GESTURE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return mLocalPoint;
}
- /**
- * @brief This is the value of which input was tapped.
- * @param[in] source This is the value of which input was tapped to set.
- */
- inline void SetGestureSourceType(const GestureSourceType sourceType)
- {
- mGestureSourceType = sourceType;
- }
-
- /**
- * @copydoc Dali::TapGesture::GetSourceType()
- */
- inline const GestureSourceType& GetSourceType() const
- {
- return mGestureSourceType;
- }
-
private:
/**
* @brief Virtual destructor
~TapGesture() override = default;
private:
- Vector2 mScreenPoint;
- Vector2 mLocalPoint;
- uint32_t mNumberOfTaps{1u};
- uint32_t mNumberOfTouches{1u};
- GestureSourceType mGestureSourceType{GestureSourceType::INVALID};
+ Vector2 mScreenPoint;
+ Vector2 mLocalPoint;
+ uint32_t mNumberOfTaps{1u};
+ uint32_t mNumberOfTouches{1u};
};
} // namespace Internal
tap->SetNumberOfTouches(tapEvent.numberOfTouches);
tap->SetScreenPoint(tapEvent.point);
tap->SetLocalPoint(localPoint);
- tap->SetGestureSourceType(tapEvent.gestureSourceType);
+ tap->SetSourceType(tapEvent.sourceType);
+ tap->SetSourceData(tapEvent.sourceData);
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
mTouchTime(0u),
mLastTapTime(0u),
mLastTouchTime(0u),
- mGestureSourceType(GestureSourceType::INVALID),
mMaximumAllowedTime(maximumAllowedTime)
{
}
const Integration::Point& point = event.points[0];
PointState::Type pointState = point.GetState();
- MouseButton::Type mouseButton = point.GetMouseButton();
- switch(mouseButton)
- {
- case MouseButton::INVALID:
- {
- mGestureSourceType = GestureSourceType::INVALID;
- break;
- }
- case MouseButton::PRIMARY:
- {
- mGestureSourceType = GestureSourceType::PRIMARY;
- break;
- }
- case MouseButton::SECONDARY:
- {
- mGestureSourceType = GestureSourceType::SECONDARY;
- break;
- }
- case MouseButton::TERTIARY:
- {
- mGestureSourceType = GestureSourceType::TERTIARY;
- break;
- }
- default:
- {
- mGestureSourceType = GestureSourceType::INVALID;
- break;
- }
- }
-
switch(mState)
{
case CLEAR:
void TapGestureRecognizer::EmitPossibleState(const Integration::TouchEvent& event)
{
TapGestureEvent tapEvent(GestureState::POSSIBLE);
- tapEvent.point = mTouchPosition;
- tapEvent.time = event.time;
- tapEvent.gestureSourceType = mGestureSourceType;
+ tapEvent.point = mTouchPosition;
+ tapEvent.time = event.time;
ProcessEvent(tapEvent);
}
void TapGestureRecognizer::EmitTap(uint32_t time, TapGestureEvent& event)
{
- event.numberOfTaps = mTapsRegistered;
- event.point = mTouchPosition;
- event.time = time;
- event.gestureSourceType = mGestureSourceType;
+ event.numberOfTaps = mTapsRegistered;
+ event.point = mTouchPosition;
+ event.time = time;
ProcessEvent(event);
}
void TapGestureRecognizer::ProcessEvent(TapGestureEvent& event)
{
+ event.sourceType = mSourceType;
+ event.sourceData = mSourceData;
if(mScene)
{
// Create another handle so the recognizer cannot be destroyed during process function
uint32_t mLastTapTime; ///< Time last tap gesture was registered
uint32_t mLastTouchTime; ///< The last touch down time.
- GestureSourceType mGestureSourceType; /// < Gesture input source type value.
- uint32_t mMaximumAllowedTime; ///< The maximum allowed time required to be recognized as a multi tap gesture (millisecond)
+ uint32_t mMaximumAllowedTime; ///< The maximum allowed time required to be recognized as a multi tap gesture (millisecond)
};
} // namespace Internal
mSkipRendering(false),
mSurfaceRect(),
mSurfaceOrientation(0),
+ mScreenOrientation(0),
mSurfaceRectChanged(false),
mRotationCompletedAcknowledgement(false)
{
mSurfaceRect = rect;
mSurfaceRectChanged = true;
+ DALI_LOG_RELEASE_INFO("update surfce rect in scene-graph, width[%d], height[%d]\n", mSurfaceRect.width, mSurfaceRect.height);
+
if(mRoot)
{
mRoot->SetUpdated(true);
return mSurfaceRect;
}
-void Scene::SetSurfaceOrientation(int32_t orientation)
+bool Scene::IsSurfaceRectChanged()
{
- mSurfaceOrientation = orientation;
+ bool surfaceRectChanged = mSurfaceRectChanged;
+ mSurfaceRectChanged = false;
+
+ return surfaceRectChanged;
+}
+
+void Scene::SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation)
+{
+ mSurfaceOrientation = windowOrientation;
+ mScreenOrientation = screenOrienation;
if(mRoot)
{
mRoot->SetUpdated(true);
}
+
+ DALI_LOG_RELEASE_INFO("update orientation in scene-graph, surface [%d], screen[%d]\n", mSurfaceOrientation, mScreenOrientation);
}
int32_t Scene::GetSurfaceOrientation() const
return mSurfaceOrientation;
}
-bool Scene::IsSurfaceRectChanged()
+int32_t Scene::GetScreenOrientation() const
{
- bool surfaceRectChanged = mSurfaceRectChanged;
- mSurfaceRectChanged = false;
-
- return surfaceRectChanged;
+ return mScreenOrientation;
}
void Scene::SetRotationCompletedAcknowledgement()
const Rect<int32_t>& GetSurfaceRect() const;
/**
- * Set the surface orientation when surface is rotated.
+ * Set the surface orientations when surface or screen is rotated.
*
- * @param[in] orientation The orientation value representing the surface.
+ * @param[in] windowOrientation The orientations value representing surface.
+ * @param[in] screenOrienation The orientations value representing screen.
*/
- void SetSurfaceOrientation(int32_t orientation);
+ void SetSurfaceOrientations(int32_t windowOrientation, int32_t screenOrienation);
/**
* Get the surface orientation.
int32_t GetSurfaceOrientation() const;
/**
+ * Get the screen orientation.
+ *
+ * @return the current screen orientation
+ */
+ int32_t GetScreenOrientation() const;
+
+ /**
* Query wheter the surface rect is changed or not.
* @return true if the surface rect is changed.
*/
Rect<int32_t> mSurfaceRect; ///< The rectangle of surface which is related ot this scene.
int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene
- bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized, moved or rotated.
+ int32_t mScreenOrientation; ///< The orientation of screen
+ bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized or moved.
bool mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation.
// Render pass and render target
new(slot) LocalType(&scene, &Scene::SetSurfaceRect, rect);
}
-inline void SetSurfaceOrientationMessage(EventThreadServices& eventThreadServices, const Scene& scene, int32_t orientation)
+inline void SetSurfaceOrientationsMessage(EventThreadServices& eventThreadServices, const Scene& scene, const int32_t windowOrientation, const int32_t screenOrientation)
{
- using LocalType = MessageValue1<Scene, int32_t>;
+ using LocalType = MessageValue2<Scene, int32_t, int32_t>;
// Reserve some memory inside the message queue
uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
// Construct message in the message queue memory; note that delete should not be called on the return value
- new(slot) LocalType(&scene, &Scene::SetSurfaceOrientation, orientation);
+ new(slot) LocalType(&scene, &Scene::SetSurfaceOrientations, windowOrientation, screenOrientation);
}
inline void SetRotationCompletedAcknowledgementMessage(EventThreadServices& eventThreadServices, const Scene& scene)
namespace Dali
{
const uint32_t CORE_MAJOR_VERSION = 2;
-const uint32_t CORE_MINOR_VERSION = 1;
-const uint32_t CORE_MICRO_VERSION = 46;
+const uint32_t CORE_MINOR_VERSION = 2;
+const uint32_t CORE_MICRO_VERSION = 0;
const char* const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
#define DALI_GESTURE_ENUMERATIONS_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
/**
* @brief Enumeration for gesture input source type.
+ * @SINCE_2_2.0
*/
enum class GestureSourceType : int8_t
{
- INVALID = -1, ///< invalid data
- PRIMARY = 1, ///< Primary
- SECONDARY = 3, ///< Secondary
- TERTIARY = 2, ///< Third (tertiary)
+ INVALID, ///< invalid data
+ MOUSE, ///< mouse
+};
+
+/**
+ * @brief Enumeration for data of gesture input source type.
+ * @SINCE_2_2.0
+ */
+enum class GestureSourceData : int8_t
+{
+ INVALID = -1, ///< invalid data
+ MOUSE_PRIMARY = 1, /**< Primary(Left) mouse button */
+ MOUSE_SECONDARY = 3, /**< Secondary(Right) mouse button */
+ MOUSE_TERTIARY = 2, /**< Center(Wheel) mouse button */
};
} // namespace Dali
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return GetImplementation(*this).GetTime();
}
+GestureSourceType Gesture::GetSourceType() const
+{
+ return GetImplementation(*this).GetSourceType();
+}
+
+GestureSourceData Gesture::GetSourceData() const
+{
+ return GetImplementation(*this).GetSourceData();
+}
+
} // namespace Dali
#define DALI_GESTURE_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
uint32_t GetTime() const;
+ /**
+ * @brief Gets the value of which source the gesture was started with. (ex : mouse)
+ * @SINCE_2_2.0
+ * @return The gesture input source.
+ */
+ GestureSourceType GetSourceType() const;
+
+ /**
+ * @brief Gets the data of the source type.
+ * @SINCE_2_2.0
+ * @return The gesture source data.
+ */
+ GestureSourceData GetSourceData() const;
+
public: // Not intended for application developers
/// @cond internal
/**
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return GetImplementation(*this).GetLocalPoint();
}
-const GestureSourceType& TapGesture::GetSourceType() const
-{
- return GetImplementation(*this).GetSourceType();
-}
-
} // namespace Dali
#define DALI_TAP_GESTURE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
const Vector2& GetLocalPoint() const;
- /**
- * @brief This is the input type of which was tapped.
- * @return The input type which was tapped.
- */
- const GestureSourceType& GetSourceType() const;
-
public: // Not intended for application developers
/// @cond internal
/**
Name: dali2
Summary: DALi 3D Engine
-Version: 2.1.46
+Version: 2.2.0
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT