From f1cdfb2f2d85972113d8bb16a775e84aed03d669 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Mon, 13 Mar 2017 16:42:37 +0000 Subject: [PATCH] (Window) Added Add/Show API Change-Id: Iba7a2a312b8cde2a7586fa996600f590010e1b57 --- adaptors/common/window-impl.h | 17 +++++++++ .../devel-api/adaptor-framework/window-devel.cpp | 15 ++++++++ .../devel-api/adaptor-framework/window-devel.h | 25 +++++++++++-- adaptors/ecore/wayland/window-impl-ecore-wl.cpp | 24 +++++++++++++ adaptors/wayland/window-impl-wl.cpp | 19 +++++++++- adaptors/x11/window-impl-x.cpp | 42 +++++++++++++++++++++- 6 files changed, 137 insertions(+), 5 deletions(-) diff --git a/adaptors/common/window-impl.h b/adaptors/common/window-impl.h index 8b4bc28..0cf251b 100644 --- a/adaptors/common/window-impl.h +++ b/adaptors/common/window-impl.h @@ -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; diff --git a/adaptors/devel-api/adaptor-framework/window-devel.cpp b/adaptors/devel-api/adaptor-framework/window-devel.cpp index 48898e5..70ad18e 100644 --- a/adaptors/devel-api/adaptor-framework/window-devel.cpp +++ b/adaptors/devel-api/adaptor-framework/window-devel.cpp @@ -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 diff --git a/adaptors/devel-api/adaptor-framework/window-devel.h b/adaptors/devel-api/adaptor-framework/window-devel.h index 1321d0b..db6c6ac 100644 --- a/adaptors/devel-api/adaptor-framework/window-devel.h +++ b/adaptors/devel-api/adaptor-framework/window-devel.h @@ -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 diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index 24c6cca..5c0523c 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -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 ); diff --git a/adaptors/wayland/window-impl-wl.cpp b/adaptors/wayland/window-impl-wl.cpp index 9110aa7..e9ec667 100644 --- a/adaptors/wayland/window-impl-wl.cpp +++ b/adaptors/wayland/window-impl-wl.cpp @@ -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 ) { } diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index 7f9e909..63069b2 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.cpp @@ -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 -- 2.7.4