Modify window position data type 78/281978/14
authorWonsik Jung <sidein@samsung.com>
Sun, 25 Sep 2022 21:35:11 +0000 (06:35 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 14 Oct 2022 05:43:39 +0000 (14:43 +0900)
Current WindowPosition has the unsigned int data type.
It means that current data type can not support the negative coordinate.
This patch is to support it.

Change-Id: I2e025d1adef71853dc07b45bb03102f8ba8614c2

automated-tests/src/dali-adaptor/utc-Dali-Window.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/common/window-impl.cpp
dali/public-api/adaptor-framework/window.cpp
dali/public-api/adaptor-framework/window.h

index db45460..1873913 100644 (file)
@@ -445,7 +445,7 @@ int UtcDaliWindowSetPositionNegative(void)
   Dali::Window instance;
   try
   {
-    Dali::Uint16Pair arg1;
+    Dali::Window::WindowPosition arg1;
     instance.SetPosition(arg1);
     DALI_TEST_CHECK(false); // Should not get here
   }
index 6a64084..9b5647a 100644 (file)
@@ -46,7 +46,7 @@ typedef Signal<void()>
 typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;              ///< Auxiliary message signal type
 typedef Signal<void(Window, bool)>                                                   AccessibilityHighlightSignalType;        ///< Accessibility Highlight signal type
 typedef Signal<bool(const KeyEvent&)>                                                InterceptKeyEventSignalType;             ///< Intercept Key event signal type
-typedef Signal<void(Window, Window::WindowPosition)>                                 MovedSignalType;                         ///< Window Moved signal type
+typedef Signal<void(Window, Dali::Window::WindowPosition)>                           MovedSignalType;                         ///< Window Moved signal type
 
 /**
  * @brief Creates an initialized handle to a new Window.
@@ -538,7 +538,7 @@ DALI_ADAPTOR_API InterceptKeyEventSignalType& InterceptKeyEventSignal(Window win
  *
  * A callback of the following type may be connected:
  * @code
- *   void YourCallbackName( Window window, Uint16Pair position );
+ *   void YourCallbackName( Window window, Dali::Window::WindowPosition position );
  * @endcode
  * The parameters are the moved x and y coordinates.
  * and window means this signal was called from what window
index 67bf27c..5d4cb1c 100644 (file)
@@ -699,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();
 
index edb98e0..e1f2642 100644 (file)
@@ -303,12 +303,12 @@ Window::WindowSize Window::GetSize() const
   return GetImplementation(*this).GetSize();
 }
 
-void Window::SetPosition(Window::WindowPosition position)
+void Window::SetPosition(Dali::Window::WindowPosition position)
 {
   GetImplementation(*this).SetPosition(position);
 }
 
-Window::WindowPosition Window::GetPosition() const
+Dali::Window::WindowPosition Window::GetPosition() const
 {
   return GetImplementation(*this).GetPosition();
 }
index e0c8d34..38b9a4b 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_WINDOW_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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/math/int-pair.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/math/uint-16-pair.h>
 #include <dali/public-api/math/vector2.h>
@@ -71,7 +72,7 @@ class DALI_ADAPTOR_API Window : public BaseHandle
 {
 public:
   using WindowSize     = Uint16Pair; ///< Window size type @SINCE_1_2.60
-  using WindowPosition = Uint16Pair; ///< Window position type @SINCE_1_2.60
+  using WindowPosition = Int32Pair;  ///< Window position type @SINCE_2_1.45
 
   using FocusChangeSignalType = Signal<void(Window, bool)>;       ///< Window focus signal type @SINCE_1_4.35
   using ResizeSignalType      = Signal<void(Window, WindowSize)>; ///< Window resized signal type @SINCE_1_4.35