[Tizen] Modify window position data type
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
index 8b0f1f0..5d4cb1c 100644 (file)
@@ -92,6 +92,7 @@ Window::Window()
   mTransitionEffectEventSignal(),
   mKeyboardRepeatSettingsChangedSignal(),
   mAuxiliaryMessageSignal(),
+  mMovedSignal(),
   mLastKeyEvent(),
   mLastTouchEvent(),
   mIsTransparent(false),
@@ -257,6 +258,11 @@ bool Window::IsMaximized() const
   return mWindowBase->IsMaximized();
 }
 
+void Window::SetMaximumSize(Dali::Window::WindowSize size)
+{
+  mWindowBase->SetMaximumSize(size);
+}
+
 void Window::Minimize(bool minimize)
 {
   mWindowBase->Minimize(minimize);
@@ -269,6 +275,11 @@ bool Window::IsMinimized() const
   return mWindowBase->IsMinimized();
 }
 
+void Window::SetMimimumSize(Dali::Window::WindowSize size)
+{
+  mWindowBase->SetMimimumSize(size);
+}
+
 uint32_t Window::GetLayerCount() const
 {
   return mScene.GetLayerCount();
@@ -688,8 +699,19 @@ Dali::Window::WindowSize Window::GetSize() const
 void Window::SetPosition(Dali::Window::WindowPosition position)
 {
   PositionSize oldRect = mSurface->GetPositionSize();
+  int32_t newX = position.GetX();
+  int32_t newY = position.GetY();
 
-  mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
+  mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height));
+
+  if((oldRect.x != newX) || (oldRect.y != newY))
+  {
+    Dali::Window handle(this);
+    Dali::Window::WindowPosition newPosition(newX, newY);
+
+    DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY());
+    mMovedSignal.Emit(handle, newPosition);
+  }
 
   mSurface->SetFullSwapNextFrame();
 
@@ -711,11 +733,18 @@ PositionSize Window::GetPositionSize() const
 void Window::SetPositionSize(PositionSize positionSize)
 {
   PositionSize oldRect = mSurface->GetPositionSize();
+  Dali::Window handle(this);
 
   mWindowSurface->MoveResize(positionSize);
 
   PositionSize newRect = mSurface->GetPositionSize();
 
+  if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
+  {
+    Dali::Window::WindowPosition position(newRect.x, newRect.y);
+    mMovedSignal.Emit(handle, position);
+  }
+
   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
   {
@@ -729,7 +758,6 @@ void Window::SetPositionSize(PositionSize positionSize)
     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
 
     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.width, newRect.height);
-    Dali::Window handle(this);
     mResizeSignal.Emit(handle, newSize);
     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
   }
@@ -863,23 +891,44 @@ void Window::OnWindowRedrawRequest()
 
 void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
 {
+  bool resized = false;
+  bool moved = false;
+  Dali::Window handle(this);
   PositionSize oldRect = mSurface->GetPositionSize();
 
   mWindowSurface->UpdatePositionSize(positionSize);
 
   PositionSize newRect = positionSize;
 
-  // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
+  if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
+  {
+    moved = true;
+  }
+
   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
   {
+    resized = true;
+  }
+
+  if(moved)
+  {
+    Dali::Window::WindowPosition position(newRect.x, newRect.y);
+    mMovedSignal.Emit(handle, position);
+  }
+
+  // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
+  if(resized)
+  {
     Uint16Pair newSize(newRect.width, newRect.height);
 
+    mWindowWidth   = newRect.width;
+    mWindowHeight  = newRect.height;
+
     SurfaceResized();
 
     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
 
     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Updated PositionSize by server :resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
-    Dali::Window handle(this);
     mResizeSignal.Emit(handle, newSize);
     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
   }