(Window) Added Add/Show API 06/118706/8
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 13 Mar 2017 16:42:37 +0000 (16:42 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 22 Mar 2017 13:23:29 +0000 (13:23 +0000)
Change-Id: Iba7a2a312b8cde2a7586fa996600f590010e1b57

adaptors/common/window-impl.h
adaptors/devel-api/adaptor-framework/window-devel.cpp
adaptors/devel-api/adaptor-framework/window-devel.h
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/wayland/window-impl-wl.cpp
adaptors/x11/window-impl-x.cpp

index 8b4bc28..0cf251b 100644 (file)
@@ -175,6 +175,22 @@ public:
   bool IsFocusAcceptable();
 
   /**
+   * @brief Shows the window if it is hidden.
+   */
+  void Show();
+
+  /**
+   * @brief Hides the window if it is showing.
+   */
+  void Hide();
+
+  /**
+   * @brief Returns whether the window is showing or not.
+   * @return True if the window is showing, false otherwise.
+   */
+  bool IsVisible() const;
+
+  /**
    * Called from Orientation after the Change signal has been sent
    */
   void RotationDone( int orientation, int width, int height );
@@ -292,6 +308,7 @@ private:
   bool                             mWMRotationAppSet:1;
   bool                             mEcoreEventHander:1;
   bool                             mIsFocusAcceptable:1;
+  bool                             mVisible:1;
   IndicatorInterface*              mIndicator;
   Dali::Window::WindowOrientation  mIndicatorOrientation;
   Dali::Window::WindowOrientation  mNextIndicatorOrientation;
index 48898e5..70ad18e 100644 (file)
@@ -40,6 +40,21 @@ bool IsFocusAcceptable( Window window )
   return GetImplementation( window ).IsFocusAcceptable();
 }
 
+void Show( Window window )
+{
+  GetImplementation( window ).Show();
+}
+
+void Hide( Window window )
+{
+  GetImplementation( window ).Hide();
+}
+
+bool IsVisible( Window window )
+{
+  return GetImplementation( window ).IsVisible();
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 1321d0b..db6c6ac 100644 (file)
@@ -45,7 +45,7 @@ typedef Signal< void (bool) > FocusSignalType;      ///< Window focus signal typ
  * @param[in] window The window to get a signal
  * @return The signal to connect to
  */
-FocusSignalType& FocusChangedSignal( Window window );
+DALI_IMPORT_API FocusSignalType& FocusChangedSignal( Window window );
 
 /**
  * @brief Sets whether window accepts focus or not.
@@ -53,7 +53,7 @@ FocusSignalType& FocusChangedSignal( Window window );
  * @param[in] window The window to accept focus
  * @param[in] accept If focus is accepted or not. Default is true.
  */
-void SetAcceptFocus( Window window, bool accept );
+DALI_IMPORT_API void SetAcceptFocus( Window window, bool accept );
 
 /**
  * @brief Returns whether window accepts focus or not.
@@ -61,7 +61,26 @@ void SetAcceptFocus( Window window, bool accept );
  * @param[in] window The window to accept focus
  * @return True if the window accept focus, false otherwise
  */
-bool IsFocusAcceptable( Window window );
+DALI_IMPORT_API bool IsFocusAcceptable( Window window );
+
+/**
+ * @brief Shows the window if it is hidden.
+ * @param[in] window The window to show
+ */
+DALI_IMPORT_API void Show( Window window );
+
+/**
+ * @brief Hides the window if it is showing.
+ * @param[in] window The window to hide
+ */
+DALI_IMPORT_API void Hide( Window window );
+
+/**
+ * @brief Returns whether the window is visible or not.
+ * @param[in] window The window to query
+ * @return True if the window is visible, false otherwise.
+ */
+DALI_IMPORT_API bool IsVisible( Window window );
 
 } // namespace DevelWindow
 
index 24c6cca..5c0523c 100644 (file)
@@ -309,6 +309,7 @@ Window::Window()
   mWMRotationAppSet( false ),
   mEcoreEventHander( true ),
   mIsFocusAcceptable( true ),
+  mVisible( true ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -647,6 +648,29 @@ bool Window::IsFocusAcceptable()
   return mIsFocusAcceptable;
 }
 
+void Window::Show()
+{
+  mVisible = true;
+  ecore_wl_window_show( mEventHandler->mEcoreWindow );
+
+  // Need an update request
+  if( mAdaptor )
+  {
+    mAdaptor->RequestUpdateOnce();
+  }
+}
+
+void Window::Hide()
+{
+  mVisible = false;
+  ecore_wl_window_hide( mEventHandler->mEcoreWindow );
+}
+
+bool Window::IsVisible() const
+{
+  return mVisible;
+}
+
 void Window::RotationDone( int orientation, int width, int height )
 {
   ecore_wl_window_rotation_change_done_send( mEventHandler->mEcoreWindow );
index 9110aa7..e9ec667 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -110,6 +110,7 @@ Window::Window()
   mIsTransparent( false ),
   mWMRotationAppSet( false ),
   mIsFocusAcceptable( true ),
+  mVisible( true ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -289,6 +290,22 @@ bool Window::IsFocusAcceptable()
   return mIsFocusAcceptable;
 }
 
+void Window::Show()
+{
+  mVisible = true;
+}
+
+void Window::Hide()
+{
+  mVisible = false;
+}
+
+bool Window::IsVisible() const
+{
+  return mVisible;
+}
+
+
 void Window::RotationDone( int orientation, int width, int height )
 {
 }
index 7f9e909..63069b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -344,6 +344,7 @@ Window::Window()
   mWMRotationAppSet( false ),
   mEcoreEventHander( true ),
   mIsFocusAcceptable( true ),
+  mVisible( true ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -743,6 +744,45 @@ bool Window::IsFocusAcceptable()
   return mIsFocusAcceptable;
 }
 
+void Window::Show()
+{
+  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
+  if( x11Window )
+  {
+    Ecore_X_Window win = x11Window->GetXWindow();
+    ecore_x_window_show( win );
+
+    // Need an update request
+    if( mAdaptor )
+    {
+      mAdaptor->RequestUpdateOnce();
+    }
+  }
+}
+
+void Window::Hide()
+{
+  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
+  if( x11Window )
+  {
+    Ecore_X_Window win = x11Window->GetXWindow();
+    ecore_x_window_hide( win );
+  }
+}
+
+bool Window::IsVisible() const
+{
+  bool visible = false;
+
+  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
+  if( x11Window )
+  {
+    Ecore_X_Window win = x11Window->GetXWindow();
+    visible = static_cast< bool >( ecore_x_window_visible_get( win ) );
+  }
+  return visible;
+}
+
 void Window::RotationDone( int orientation, int width, int height )
 {
   // Tell window manager we're done