Add parent set for mulit window. 29/210529/13
authorWonsik Jung <sidein@samsung.com>
Mon, 22 Jul 2019 06:06:44 +0000 (15:06 +0900)
committerWonsik Jung <sidein@samsung.com>
Thu, 8 Aug 2019 09:32:33 +0000 (18:32 +0900)
Add parent set for multi window.
After setting, parent and child window works together when window raise, lower and iconfined/diconifed.

Change-Id: I6043b50338ab9be2742d9e17f2d971c6dffdf3b9

13 files changed:
dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.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/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 17a2993..5057f14 100644 (file)
@@ -65,6 +65,21 @@ WheelEventSignalType& WheelEventSignal( Window window )
   return GetImplementation( window ).WheelEventSignal();
 }
 
+void SetParent( Window window, Window parent )
+{
+  GetImplementation( window ).SetParent( parent );
+}
+
+void Unparent( Window window )
+{
+  GetImplementation( window ).Unparent();
+}
+
+Window GetParent( Window window )
+{
+  return GetImplementation( window ).GetParent();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 3da549e..cd94caa 100644 (file)
@@ -113,6 +113,33 @@ DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
  */
 DALI_ADAPTOR_API WheelEventSignalType& WheelEventSignal( Window window );
 
+/**
+ * @brief Sets parent window of the window.
+ *
+ * After setting that, these windows do together when raise-up, lower and iconified/deiconified.
+ *
+ * @param[in] window The window instance
+ * @param[in] parent The parent window instance
+ */
+DALI_ADAPTOR_API void SetParent( Window window, Window parent );
+
+/**
+ * @brief Unsets parent window of the window.
+ *
+ * After unsetting, the window is disconnected his parent window.
+ *
+ * @param[in] window The window instance
+ */
+DALI_ADAPTOR_API void Unparent( Window window );
+
+/**
+ * @brief Gets parent window of the window.
+ *
+ * @param[in] window The window instance
+ * @return The parent window of the window
+ */
+DALI_ADAPTOR_API Window GetParent( Window window );
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 165a69a..5f29f56 100644 (file)
@@ -328,6 +328,17 @@ public:
    */
   virtual void SetTransparency( bool transparent ) = 0;
 
+  /**
+   * @copydoc Dali::Window::SetParent()
+   */
+  virtual void SetParent( Any parent ) = 0;
+
+  /**
+   * @brief Check whether the window is matched or not.
+   * @return The result of matched.
+   */
+  virtual bool IsMatchedWindow( Any window ) = 0;
+
   // Signals
 
   /**
index 9483164..4ecda0d 100644 (file)
@@ -77,6 +77,7 @@ Window::Window()
   mOpaqueState( false ),
   mResizeEnabled( false ),
   mType( Dali::Window::NORMAL ),
+  mParentWindow( NULL ),
   mPreferredOrientation( Dali::Window::PORTRAIT ),
   mRotationAngle( 0 ),
   mWindowWidth( 0 ),
@@ -693,6 +694,33 @@ Dali::Window Window::Get( Dali::Actor actor )
   return Dali::Window( windowImpl );
 }
 
+
+void Window::SetParent( Dali::Window& parent )
+{
+  if ( DALI_UNLIKELY( parent ) )
+  {
+    mParentWindow = parent;
+    Dali::Window grandParent = Dali::DevelWindow::GetParent( parent );
+    // check circular parent window setting
+    if ( DALI_UNLIKELY( grandParent ) && mWindowBase->IsMatchedWindow( grandParent.GetNativeHandle() ) )
+    {
+      Dali::DevelWindow::Unparent( parent );
+    }
+    mWindowBase->SetParent( parent.GetNativeHandle() );
+  }
+}
+
+void Window::Unparent()
+{
+  Any parent;
+  mWindowBase->SetParent( parent );
+}
+
+Dali::Window Window::GetParent()
+{
+  return mParentWindow;
+}
+
 } // Adaptor
 
 } // Internal
index 7fd04f9..f09e7ca 100644 (file)
@@ -333,6 +333,21 @@ public:
    */
   static Dali::Window Get( Dali::Actor actor );
 
+  /**
+   * @copydoc Dali::DevelWindow::SetParent()
+   */
+  void SetParent( Dali::Window& parent );
+
+  /**
+   * @copydoc Dali::DevelWindow::Unparent()
+   */
+  void Unparent();
+
+  /**
+   * @copydoc Dali::DevelWindow::GetParent()
+   */
+  Dali::Window GetParent();
+
 public: // Dali::Internal::Adaptor::SceneHolder
 
   /**
@@ -486,6 +501,7 @@ private:
   bool                                  mOpaqueState:1;
   bool                                  mResizeEnabled:1;
   Dali::Window::Type                    mType;
+  Dali::Window                          mParentWindow;
 
   OrientationPtr                               mOrientation;
   std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
index 06490d2..5b67e26 100644 (file)
@@ -2132,6 +2132,37 @@ void WindowBaseEcoreWl::CreateWindow( PositionSize positionSize )
   }
 }
 
+void WindowBaseEcoreWl::SetParent( Any parent )
+{
+  Ecore_Wl_Window* mEcoreParent;
+  if( parent.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl_Window *) ) && "Parent's surface type is invalid" );
+    mEcoreParent = AnyCast< Ecore_Wl_Window* >( parent );
+  }
+  else
+  {
+    mEcoreParent = NULL;
+  }
+  ecore_wl_window_parent_set( mEcoreWindow, mEcoreParent );
+}
+
+bool WindowBaseEcoreWl::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl_Window *) ) && "Window's surface type is invalid" );
+    if ( AnyCast< Ecore_Wl_Window* >( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
+  }
+  return ret;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 48ab90c..922e278 100644 (file)
@@ -414,6 +414,16 @@ public:
    */
   virtual void SetTransparency( bool transparent ) override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
+   */
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
+
 private:
 
   /**
@@ -473,6 +483,7 @@ private:
 #ifdef DALI_ELDBUS_AVAILABLE
   Eldbus_Connection*                   mSystemConnection;
 #endif // DALI_ELDBUS_AVAILABLE
+
 };
 
 } // namespace Adaptor
index 5d1a51a..2f5cf34 100755 (executable)
@@ -2187,6 +2187,37 @@ void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
   ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
 }
 
+void WindowBaseEcoreWl2::SetParent( Any parent )
+{
+  Ecore_Wl2_Window* mEcoreParent;
+  if( parent.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( parent.GetType() == typeid (Ecore_Wl2_Window *) ) && "Parent's surface type is invalid" );
+    mEcoreParent = AnyCast< Ecore_Wl2_Window* >( parent );
+  }
+  else
+  {
+    mEcoreParent = NULL;
+  }
+  ecore_wl2_window_parent_set( mEcoreWindow, mEcoreParent );
+}
+
+bool WindowBaseEcoreWl2::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( window.GetType() == typeid (Ecore_Wl2_Window *) ) && "Window's surface type is invalid" );
+    if ( AnyCast< Ecore_Wl2_Window*>( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
+  }
+  return ret;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 6a4694c..2b45ae0 100644 (file)
@@ -419,6 +419,16 @@ public:
    */
   virtual void SetTransparency( bool transparent ) override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
+   */
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
+
 private:
 
   /**
index e2f650b..0c36b1d 100755 (executable)
@@ -888,6 +888,48 @@ void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTranspare
  }
 }
 
+void WindowBaseEcoreX::SetParent( Any parent )
+{
+  Ecore_X_Window mEcoreParent;
+  if ( parent.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (parent.GetType() == typeid (Ecore_X_Window) ) )
+                        && "Surface type is invalid" );
+
+    if ( parent.GetType() == typeid (Ecore_X_Window) )
+    {
+      mEcoreParent = AnyCast< Ecore_X_Window >( parent );
+      ecore_x_icccm_transient_for_set( mEcoreWindow, mEcoreParent );
+    }
+    else
+    {
+      mEcoreParent = 0;
+      ecore_x_icccm_transient_for_unset( mEcoreWindow );
+    }
+  }
+  else
+  {
+    mEcoreParent = 0;
+    ecore_x_icccm_transient_for_unset( mEcoreWindow );
+  }
+}
+
+bool WindowBaseEcoreX::IsMatchedWindow( Any window )
+{
+  bool ret = false;
+  if ( window.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (window.GetType() == typeid (Ecore_X_Window) ) ) && "Surface type is invalid" );
+    if ( AnyCast< Ecore_X_Window >( window ) == mEcoreWindow )
+    {
+      ret = true;
+    }
+  }
+  return ret;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index c30eba6..6c99f46 100644 (file)
@@ -348,6 +348,16 @@ public:
    */
   virtual void SetTransparency( bool transparent ) override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
+   */
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
+
 private:
 
   /**
index b1d6f1c..87af139 100755 (executable)
@@ -100,25 +100,25 @@ void WindowBaseWin::OnFocusOut( int type, TWinEventInfo *event )
 
 void WindowBaseWin::OnWindowDamaged( int type, TWinEventInfo *event )
 {
-  Event_Mouse_Button* windowDamagedEvent( (Event_Mouse_Button*)event );\r
-\r
-  if( windowDamagedEvent->window == mWin32Window )\r
-  {\r
-    DamageArea area;\r
-    area.x = 0;\r
-    area.y = 0;\r
-    WindowSystem::GetScreenSize( area.width, area.height );\r
-\r
-    mWindowDamagedSignal.Emit( area );\r
-  }\r
+  Event_Mouse_Button* windowDamagedEvent( (Event_Mouse_Button*)event );
+
+  if( windowDamagedEvent->window == mWin32Window )
+  {
+    DamageArea area;
+    area.x = 0;
+    area.y = 0;
+    WindowSystem::GetScreenSize( area.width, area.height );
+
+    mWindowDamagedSignal.Emit( area );
+  }
 }
 
 void WindowBaseWin::OnMouseButtonDown( int type, TWinEventInfo *event )
 {
   Event_Mouse_Button touchEvent = *((Event_Mouse_Button*)event);
   touchEvent.timestamp = GetTickCount();
-  touchEvent.x = LOWORD( event->lParam );\r
-  touchEvent.y = HIWORD( event->lParam );\r
+  touchEvent.x = LOWORD( event->lParam );
+  touchEvent.y = HIWORD( event->lParam );
   touchEvent.multi.device = DEVICE_MOUSE;
 
   if( touchEvent.window == mWin32Window )
@@ -141,8 +141,8 @@ void WindowBaseWin::OnMouseButtonUp( int type, TWinEventInfo *event )
 {
   Event_Mouse_Button touchEvent = *( (Event_Mouse_Button*)event );
   touchEvent.timestamp = GetTickCount();
-  touchEvent.x = LOWORD( event->lParam );\r
-  touchEvent.y = HIWORD( event->lParam );\r
+  touchEvent.x = LOWORD( event->lParam );
+  touchEvent.y = HIWORD( event->lParam );
   touchEvent.multi.device = DEVICE_MOUSE;
 
   if( touchEvent.window == mWin32Window )
@@ -165,8 +165,8 @@ void WindowBaseWin::OnMouseButtonMove( int type, TWinEventInfo *event )
 {
   Event_Mouse_Button touchEvent = *((Event_Mouse_Button*)event);
   touchEvent.timestamp = GetTickCount();
-  touchEvent.x = LOWORD( event->lParam );\r
-  touchEvent.y = HIWORD( event->lParam );\r
+  touchEvent.x = LOWORD( event->lParam );
+  touchEvent.y = HIWORD( event->lParam );
   touchEvent.multi.device = DEVICE_MOUSE;
 
   if( touchEvent.window == mWin32Window )
@@ -479,11 +479,11 @@ unsigned int WindowBaseWin::GetSurfaceId( Any surface ) const
 
 void WindowBaseWin::CreateWinWindow( PositionSize positionSize, bool isTransparent )
 {
-  long hWnd = WindowsPlatformImplementation::CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL );\r
-\r
-  WindowsPlatformImplementation::ShowWindow( hWnd );\r
-\r
-  mWin32Window = (WinWindowHandle)hWnd;\r
+  long hWnd = WindowsPlatformImplementation::CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL );
+
+  WindowsPlatformImplementation::ShowWindow( hWnd );
+
+  mWin32Window = (WinWindowHandle)hWnd;
   DALI_ASSERT_ALWAYS( mWin32Window != 0 && "There is no Windows window" );
 }
 
@@ -491,67 +491,77 @@ void WindowBaseWin::EventEntry( TWinEventInfo *event )
 {
   unsigned int uMsg = event->uMsg;
 
-  switch( uMsg )\r
-  {\r
-  case WM_SETFOCUS:\r
-  {\r
-    OnFocusIn( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_KILLFOCUS:\r
-  {\r
-    OnFocusOut( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_PAINT:\r
-  {\r
-    OnWindowDamaged( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_LBUTTONDOWN:\r
-  {\r
-    OnMouseButtonDown( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_LBUTTONUP:\r
-  {\r
-    OnMouseButtonUp( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_MOUSEMOVE:\r
-  {\r
-    OnMouseButtonMove( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_MOUSEWHEEL:\r
-  {\r
-    OnMouseWheel( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_KEYDOWN:\r
-  {\r
-    OnKeyDown( uMsg, event );\r
-    break;\r
-  }\r
-\r
-  case WM_KEYUP:\r
-  {\r
-    OnKeyUp( uMsg, event );\r
-    break;\r
-  }\r
-\r
+  switch( uMsg )
+  {
+  case WM_SETFOCUS:
+  {
+    OnFocusIn( uMsg, event );
+    break;
+  }
+
+  case WM_KILLFOCUS:
+  {
+    OnFocusOut( uMsg, event );
+    break;
+  }
+
+  case WM_PAINT:
+  {
+    OnWindowDamaged( uMsg, event );
+    break;
+  }
+
+  case WM_LBUTTONDOWN:
+  {
+    OnMouseButtonDown( uMsg, event );
+    break;
+  }
+
+  case WM_LBUTTONUP:
+  {
+    OnMouseButtonUp( uMsg, event );
+    break;
+  }
+
+  case WM_MOUSEMOVE:
+  {
+    OnMouseButtonMove( uMsg, event );
+    break;
+  }
+
+  case WM_MOUSEWHEEL:
+  {
+    OnMouseWheel( uMsg, event );
+    break;
+  }
+
+  case WM_KEYDOWN:
+  {
+    OnKeyDown( uMsg, event );
+    break;
+  }
+
+  case WM_KEYUP:
+  {
+    OnKeyUp( uMsg, event );
+    break;
+  }
+
   default:
-    break;\r
+    break;
   }
 }
 
+void WindowBaseWin::SetParent( Any parent )
+{
+
+}
+
+bool WindowBaseWin::IsMatchedWindow( Any window )
+{
+  return false;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index b0e48c6..f19fdfc 100755 (executable)
@@ -336,6 +336,16 @@ public:
    */
   virtual void SetTransparency( bool transparent ) override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
+   */
+  virtual void SetParent( Any parent ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   */
+  virtual bool IsMatchedWindow( Any window ) override;
+
 private:
 
   /**