Fix the calculating logic for input region
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
index 3e73f6e..bb49a8d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
 
 /*
- * Copyright (c) 2021 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.
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/object/property-array.h>
 #include <dali/public-api/object/ref-object.h>
@@ -65,6 +66,9 @@ public:
   typedef Dali::DevelWindow::TransitionEffectEventSignalType         TransitionEffectEventSignalType;
   typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType;
   typedef Dali::DevelWindow::AuxiliaryMessageSignalType              AuxiliaryMessageSignalType;
+  typedef Dali::DevelWindow::AccessibilityHighlightSignalType        AccessibilityHighlightSignalType;
+  typedef Dali::DevelWindow::MovedSignalType                         MovedSignalType;
+  typedef Dali::DevelWindow::OrientationChangedSignalType            OrientationChangedSignalType;
   typedef Signal<void()>                                             SignalType;
 
   /**
@@ -88,7 +92,7 @@ public:
    * @param[in] isTransparent Whether window is transparent
    * @return A newly allocated Window
    */
-  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className,  Dali::WindowType type, bool isTransparent = false);
+  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent = false);
 
   /**
    * @copydoc Dali::Window::SetClass()
@@ -117,6 +121,36 @@ public:
   void Activate();
 
   /**
+   * @copydoc Dali::DevelWindow::Maximize()
+   */
+  void Maximize(bool maximize);
+
+  /**
+   * @copydoc Dali::DevelWindow::IsMaximized()
+   */
+  bool IsMaximized() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::SetMaximumSize()
+   */
+  void SetMaximumSize(Dali::Window::WindowSize size);
+
+  /**
+   * @copydoc Dali::DevelWindow::Minimize()
+   */
+  void Minimize(bool minimize);
+
+  /**
+   * @copydoc Dali::DevelWindow::IsMinimized()
+   */
+  bool IsMinimized() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::SetMimimumSize()
+   */
+  void SetMimimumSize(Dali::Window::WindowSize size);
+
+  /**
    * @copydoc Dali::Window::GetLayerCount()
    */
   uint32_t GetLayerCount() const;
@@ -132,6 +166,12 @@ public:
   Dali::RenderTaskList GetRenderTaskList() const;
 
   /**
+   * @brief Get window resource ID assigned by window manager
+   * @return The resource ID of the window
+   */
+  std::string GetNativeResourceId() const;
+
+  /**
    * @copydoc Dali::Window::AddAvailableOrientation()
    */
   void AddAvailableOrientation(WindowOrientation orientation);
@@ -292,6 +332,11 @@ public:
   PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::Window::SetLayout()
+   */
+  void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan);
+
+  /**
    * @copydoc Dali::Window::GetRootLayer()
    */
   Dali::Layer GetRootLayer() const;
@@ -366,6 +411,23 @@ public:
    */
   void SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation);
 
+  /**
+   * @brief Emit the accessibility highlight signal.
+   * The highlight indicates that it is an object to interact with the user regardless of focus.
+   * After setting the highlight on the object, you can do things that the object can do, such as
+   * giving or losing focus.
+   *
+   * @param[in] highlight If window needs to grab or clear highlight.
+   */
+  void EmitAccessibilityHighlightSignal(bool highlight);
+
+  /**
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   *
+   * @param[in] renderNotification to use
+   */
+  void SetRenderNotification(TriggerEventInterface *renderNotification);
+
 public: // Dali::Internal::Adaptor::SceneHolder
   /**
    * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle
@@ -417,6 +479,21 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   void SendRotationCompletedAcknowledgement();
 
+  /**
+   * @copydoc Dali::DevelWindow::IsWindowRotating()
+   */
+  bool IsWindowRotating() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::GetLastKeyEvent()
+   */
+  const Dali::KeyEvent& GetLastKeyEvent() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::GetLastTouchEvent()
+   */
+  const Dali::TouchEvent& GetLastTouchEvent() const;
+
 private:
   /**
    * @brief Enumeration for orietation mode.
@@ -452,6 +529,11 @@ private:
   void OnIconifyChanged(bool iconified);
 
   /**
+   * Called when the window becomes maximized or unmaximized.
+   */
+  void OnMaximizeChanged(bool maximized);
+
+  /**
    * Called when the window focus is changed.
    */
   void OnFocusChanged(bool focusIn);
@@ -498,6 +580,27 @@ private:
   void OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options);
 
   /**
+   * @brief Called when Accessibility is enabled.
+   *
+   * This method is to register the window to accessibility bridge.
+   */
+  void OnAccessibilityEnabled();
+
+  /**
+   * @brief Called when Accessibility is disabled.
+   *
+   * This method is to remove the window from accessibility bridge.
+   */
+  void OnAccessibilityDisabled();
+
+  /**
+   * Called when the window rotation is finished.
+   *
+   * This signal is emmit when window rotation is finisehd and WindowRotationCompleted() is called.
+   */
+  void OnRotationFinished();
+
+  /**
    * @brief Set available orientation to window base.
    */
   void SetAvailableAnlges(const std::vector<int>& angles);
@@ -517,20 +620,6 @@ private:
    */
   bool IsOrientationAvailable(WindowOrientation orientation) const;
 
-  /**
-   * @brief Return the rect value to recalulate with the default system coordinates.
-   *
-   * Some native window APIs work the geometry value based on the default system coordinates.
-   * IncludeInputRegion() and ExcludeInputRegion() are one of them.
-   * When the window is rotated, current window's geometry already were set with the rotated angle.
-   * If IncludeInputRegion() or ExcludeInputRegion() are called with rotated angle by application,
-   * the rect's area should be re-calcuated on the default system coordinates.
-   *
-   * @param[in] rect the window's current position and size with current window rotation angle.
-   * @return the re-calculated rect on the default system coordinates.
-   */
-  Rect<int> RecalculateRect(const Rect<int>& rect);
-
 private: // Dali::Internal::Adaptor::SceneHolder
   /**
    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet
@@ -553,9 +642,9 @@ private: // Dali::Internal::Adaptor::SceneHolder
   void OnResume() override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::SceneHolder::RecalculateTouchPosition
+   * @copydoc Dali::Internal::Adaptor::SceneHolder::RecalculatePosition
    */
-  void RecalculateTouchPosition(Integration::Point& point) override;
+  Vector2 RecalculatePosition(const Vector2& position) override;
 
 private: // Dali::Internal::Adaptor::EventHandler::Observer
   /**
@@ -643,31 +732,48 @@ public: // Signals
     return mAuxiliaryMessageSignal;
   }
 
+  /**
+   * @copydoc Dali::DevelWindow::AccessibilityHighlightSignal()
+   */
+  AccessibilityHighlightSignalType& AccessibilityHighlightSignal()
+  {
+    return mAccessibilityHighlightSignal;
+  }
+
+  /**
+   * @copydoc Dali::DevelWindow::MovedSignal()
+   */
+  MovedSignalType& MovedSignal()
+  {
+    return mMovedSignal;
+  }
+
+  /**
+   * @copydoc Dali::DevelWindow::OrientationChangedSignal()
+   */
+  OrientationChangedSignalType& OrientationChangedSignal()
+  {
+    return mOrientationChangedSignal;
+  }
+
 private:
   WindowRenderSurface* mWindowSurface; ///< The window rendering surface
   WindowBase*          mWindowBase;
   std::string          mName;
   std::string          mClassName;
-  bool                 mIsTransparent : 1;
-  bool                 mIsFocusAcceptable : 1;
-  bool                 mIconified : 1;
-  bool                 mOpaqueState : 1;
-  bool                 mWindowRotationAcknowledgement : 1;
   Dali::Window         mParentWindow;
 
   OrientationPtr   mOrientation;
   std::vector<int> mAvailableAngles;
   int              mPreferredAngle;
 
-  int mRotationAngle;                    ///< The angle of the rotation
-  int mWindowWidth;                      ///< The width of the window
-  int mWindowHeight;                     ///< The height of the window
-
-  EventHandlerPtr mEventHandler;         ///< The window events handler
-
-  OrientationMode mOrientationMode;      ///< The physical screen mode is portrait or landscape
+  int mRotationAngle;  ///< The angle of the rotation
+  int mWindowWidth;    ///< The width of the window
+  int mWindowHeight;   ///< The height of the window
+  int mNativeWindowId; ///< The Native Window Id
 
-  int mNativeWindowId;                   ///< The Native Window Id
+  EventHandlerPtr mEventHandler;    ///< The window events handler
+  OrientationMode mOrientationMode; ///< The physical screen mode is portrait or landscape
 
   // Signals
   SignalType                              mDeleteRequestSignal;
@@ -677,6 +783,21 @@ private:
   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
   AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
+  AccessibilityHighlightSignalType        mAccessibilityHighlightSignal;
+  MovedSignalType                         mMovedSignal;
+  OrientationChangedSignalType            mOrientationChangedSignal;
+
+  Dali::KeyEvent   mLastKeyEvent;
+  Dali::TouchEvent mLastTouchEvent;
+
+  bool mIsTransparent : 1;
+  bool mIsFocusAcceptable : 1;
+  bool mIconified : 1;
+  bool mMaximized : 1;
+  bool mOpaqueState : 1;
+  bool mWindowRotationAcknowledgement : 1;
+  bool mFocused : 1;
+  bool mIsWindowRotating : 1; ///< The window rotating flag.
 };
 
 } // namespace Adaptor