[Tizen] Add input region APIs 47/263147/1
authorWonsik Jung <sidein@samsung.com>
Wed, 4 Aug 2021 23:10:13 +0000 (08:10 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 27 Aug 2021 00:44:49 +0000 (09:44 +0900)
Add input region APIs about including and excluding.

Change-Id: Ie79dac83f202450b58b73401f0fd146a2284cb87

18 files changed:
automated-tests/src/dali-adaptor/utc-Dali-Window.cpp
dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/android/window-base-android.cpp
dali/internal/window-system/android/window-base-android.h
dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h
dali/internal/window-system/macos/window-base-mac.h
dali/internal/window-system/macos/window-base-mac.mm
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
dali/internal/window-system/windows/window-base-win.cpp
dali/internal/window-system/windows/window-base-win.h

index e0580d0..cab5d0a 100644 (file)
@@ -1350,3 +1350,39 @@ int UtcDaliWindowSetParentNegative(void)
   }
   END_TEST;
 }
+
+int UtcDaliWindowAddInputRegion(void)
+{
+  Dali::Window instance;
+  try
+  {
+    Rect<int> includedInputRegion(0,0,720,640);
+    DevelWindow::IncludeInputRegion(instance, includedInputRegion);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
+int UtcDaliWindowSubtractInputRegion(void)
+{
+  Dali::Window instance;
+  try
+  {
+    Rect<int> includedInputRegion(0,0,720,1280);
+    DevelWindow::IncludeInputRegion(instance, includedInputRegion);
+
+    Rect<int> excludedInputRegion(0,641,720,640);
+    DevelWindow::ExcludeInputRegion(instance, excludedInputRegion);
+
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
index 886d56b..908a8ae 100644 (file)
@@ -171,6 +171,16 @@ void EnableFloatingMode(Window window, bool enable)
   GetImplementation(window).EnableFloatingMode(enable);
 }
 
+void IncludeInputRegion(Window window, const Rect<int>& inputRegion)
+{
+  GetImplementation(window).IncludeInputRegion(inputRegion);
+}
+
+void ExcludeInputRegion(Window window, const Rect<int>& inputRegion)
+{
+  GetImplementation(window).ExcludeInputRegion(inputRegion);
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 20adb92..108b4f4 100644 (file)
@@ -308,6 +308,39 @@ DALI_ADAPTOR_API void RequestResizeToServer(Window window, WindowResizeDirection
  */
 DALI_ADAPTOR_API void EnableFloatingMode(Window window, bool enable);
 
+/**
+ * @brief Includes input region.
+ *
+ * This function inlcudes input regions.
+ * It can be used multiple times and supports multiple regions.
+ * It means input region will be extended.
+ *
+ * This input is related to mouse and touch event.
+ * If device has touch screen, this function is useful.
+ * Otherwise device does not have that, we can use it after connecting mouse to the device.
+ *
+ * @param[in] window The window instance.
+ * @param[in] inputRegion The added region to accept input events.
+ */
+DALI_ADAPTOR_API void IncludeInputRegion(Window window, const Rect<int>& inputRegion);
+
+/**
+ * @brief Excludes input region.
+ *
+ * This function excludes input regions.
+ * It can be used multiple times and supports multiple regions.
+ * It means input region will be reduced.
+ * Nofice, should be set input area by IncludeInputRegion() before this function is used.
+ *
+ * This input is related to mouse and touch event.
+ * If device has touch screen, this function is useful.
+ * Otherwise device does not have that, we can use it after connecting mouse to the device.
+ *
+ * @param[in] window The window instance.
+ * @param[in] inputRegion The subtracted region to except input events.
+ */
+DALI_ADAPTOR_API void ExcludeInputRegion(Window window, const Rect<int>& inputRegion);
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 98d8b20..99e1dee 100644 (file)
@@ -389,6 +389,14 @@ bool WindowBaseAndroid::IsFloatingModeEnabled() const
   return false;
 }
 
+void WindowBaseAndroid::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseAndroid::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index c3c52b3..8ba0a14 100644 (file)
@@ -404,6 +404,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization
index 389e7c5..7983f45 100644 (file)
@@ -406,6 +406,18 @@ public:
    */
   virtual void ImeWindowReadyToRender() = 0;
 
+  /**
+   * @brief Includes input region.
+   * @param[in] inputRegion The added region to accept input events.
+   */
+  virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
+
+  /**
+   * @brief Excludes input region.
+   * @param[in] inputRegion The subtracted region to except input events.
+   */
+  virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
+
   // Signals
 
   /**
index 79228af..1bc3188 100644 (file)
@@ -995,6 +995,16 @@ void Window::EnableFloatingMode(bool enable)
   mWindowBase->EnableFloatingMode(enable);
 }
 
+void Window::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+  mWindowBase->IncludeInputRegion(inputRegion);
+}
+
+void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+  mWindowBase->ExcludeInputRegion(inputRegion);
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index b7c1d61..761bb0e 100644 (file)
@@ -391,6 +391,16 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   void EnableFloatingMode(bool enable);
 
+  /**
+   * @copydoc Dali::DevelWindow::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion);
+
+  /**
+   * @copydoc Dali::DevelWindow::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion);
+
 private:
   /**
    * @brief Enumeration for orietation mode.
index 41bc806..b967686 100644 (file)
@@ -337,6 +337,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   // Undefined
   WindowBaseCocoa(const WindowBaseCocoa&) = delete;
index e4c06ac..594a186 100644 (file)
@@ -680,6 +680,14 @@ bool WindowBaseCocoa::IsFloatingModeEnabled() const
   return false;
 }
 
+void WindowBaseCocoa::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseCocoa::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Dali::Internal::Adaptor
 
 @implementation CocoaView
index 37f992c..55c6a7e 100644 (file)
@@ -2209,6 +2209,14 @@ bool WindowBaseEcoreWl::IsFloatingModeEnabled() const
   return false;
 }
 
+void WindowBaseEcoreWl::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseEcoreWl::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 003fdfa..8cca415 100644 (file)
@@ -470,6 +470,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization
index d467bb3..403337a 100644 (file)
@@ -2720,6 +2720,30 @@ bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
   return ecore_wl2_window_floating_mode_get(mEcoreWindow);
 }
 
+void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+  Eina_Rectangle rect;
+  rect.x = inputRegion.x;
+  rect.y = inputRegion.y;
+  rect.w = inputRegion.width;
+  rect.h = inputRegion.height;
+
+  ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
+void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+  Eina_Rectangle rect;
+  rect.x = inputRegion.x;
+  rect.y = inputRegion.y;
+  rect.w = inputRegion.width;
+  rect.h = inputRegion.height;
+
+  ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 9c71f52..d05c99a 100644 (file)
@@ -502,6 +502,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization
index fa125d8..67cb784 100644 (file)
@@ -955,6 +955,14 @@ bool WindowBaseEcoreX::IsFloatingModeEnabled() const
   return false;
 }
 
+void WindowBaseEcoreX::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseEcoreX::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 03ffbcc..2a34f8f 100644 (file)
@@ -404,6 +404,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization
index 748f707..cb903ef 100644 (file)
@@ -611,6 +611,14 @@ bool WindowBaseWin::IsFloatingModeEnabled() const
   return false;
 }
 
+void WindowBaseWin::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseWin::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 854e66c..6e0f7db 100644 (file)
@@ -391,6 +391,16 @@ public:
    */
   bool IsFloatingModeEnabled() const override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
 private:
   /**
    * Second stage initialization