Add MouseInOutEventSignal
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
index 0cf5be8..1afa98e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -93,6 +93,7 @@ Window::Window()
   mAuxiliaryMessageSignal(),
   mMovedSignal(),
   mOrientationChangedSignal(),
+  mMouseInOutEventSignal(),
   mLastKeyEvent(),
   mLastTouchEvent(),
   mIsTransparent(false),
@@ -159,6 +160,7 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std
   mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
   mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
   mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
+  mWindowBase->MouseInOutEventSignal().Connect(this, &Window::OnMouseInOutEvent);
 
   mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
   mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
@@ -196,6 +198,16 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std
   mNativeWindowId = mWindowBase->GetNativeWindowId();
 }
 
+void Window::SetRenderNotification(TriggerEventInterface *renderNotification)
+{
+  if(!mWindowSurface)
+  {
+    return;
+  }
+
+  mWindowSurface->SetRenderNotification(renderNotification);
+}
+
 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
 {
   mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
@@ -594,11 +606,8 @@ unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const
 
 void Window::SetInputRegion(const Rect<int>& inputRegion)
 {
-  Rect<int> convertRegion = RecalculateRect(inputRegion);
-
-  DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window (%p), WinId (%d), SetInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
-
-  mWindowBase->SetInputRegion(convertRegion);
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  mWindowBase->SetInputRegion(inputRegion);
 }
 
 void Window::SetType(WindowType type)
@@ -721,7 +730,7 @@ void Window::SetPosition(Dali::Window::WindowPosition position)
   int32_t      newX    = position.GetX();
   int32_t      newY    = position.GetY();
 
-  mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height));
+  mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height));
 
   if((oldRect.x != newX) || (oldRect.y != newY))
   {
@@ -805,6 +814,11 @@ void Window::SetPositionSize(PositionSize positionSize)
   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
 }
 
+void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+    mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
+}
+
 Dali::Layer Window::GetRootLayer() const
 {
   return mScene.GetRootLayer();
@@ -1031,6 +1045,13 @@ void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
   FeedKeyEvent(keyEvent);
 }
 
+void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent)
+{
+  Dali::Window handle(this);
+
+  mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
+}
+
 void Window::OnRotation(const RotationEvent& rotation)
 {
   PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
@@ -1269,58 +1290,16 @@ void Window::EnableFloatingMode(bool enable)
   mWindowBase->EnableFloatingMode(enable);
 }
 
-Rect<int> Window::RecalculateRect(const Rect<int>& rect)
-{
-  Rect<int> newRect;
-  int       screenWidth, screenHeight;
-
-  WindowSystem::GetScreenSize(screenWidth, screenHeight);
-
-  if(mRotationAngle == 90)
-  {
-    newRect.x      = rect.y;
-    newRect.y      = screenHeight - (rect.x + rect.width);
-    newRect.width  = rect.height;
-    newRect.height = rect.width;
-  }
-  else if(mRotationAngle == 180)
-  {
-    newRect.x      = screenWidth - (rect.x + rect.width);
-    newRect.y      = screenHeight - (rect.y + rect.height);
-    newRect.width  = rect.width;
-    newRect.height = rect.height;
-  }
-  else if(mRotationAngle == 270)
-  {
-    newRect.x      = screenWidth - (rect.y + rect.height);
-    newRect.y      = rect.x;
-    newRect.width  = rect.height;
-    newRect.height = rect.width;
-  }
-  else
-  {
-    newRect.x      = rect.x;
-    newRect.y      = rect.y;
-    newRect.width  = rect.width;
-    newRect.height = rect.height;
-  }
-  return newRect;
-}
-
 void Window::IncludeInputRegion(const Rect<int>& inputRegion)
 {
-  Rect<int> convertRegion = RecalculateRect(inputRegion);
-
-  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
-  mWindowBase->IncludeInputRegion(convertRegion);
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  mWindowBase->IncludeInputRegion(inputRegion);
 }
 
 void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
 {
-  Rect<int> convertRegion = RecalculateRect(inputRegion);
-
-  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
-  mWindowBase->ExcludeInputRegion(convertRegion);
+  DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  mWindowBase->ExcludeInputRegion(inputRegion);
 }
 
 void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)