/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
#include <dali/internal/window-system/common/window-impl.h>
// EXTERNAL HEADERS
-#include <thread>
+#include <dali/devel-api/adaptor-framework/orientation.h>
#include <dali/integration-api/core.h>
+#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/public-api/actors/actor.h>
-#include <dali/public-api/actors/layer.h>
#include <dali/public-api/actors/camera-actor.h>
-#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/adaptor-framework/window-enumerations.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/rendering/frame-buffer.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-#include <dali/integration-api/events/touch-event-integ.h>
+#include <thread>
// INTERNAL HEADERS
+#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/window-system/common/orientation-impl.h>
#include <dali/internal/window-system/common/render-surface-factory.h>
-#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-base.h>
-#include <dali/internal/window-system/common/window-system.h>
+#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/window-system.h>
#include <dali/internal/window-system/common/window-visibility-observer.h>
namespace Dali
{
namespace Adaptor
{
-
namespace
{
-
#if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
+Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
#endif
} // unnamed namespace
-Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
{
Any surface;
- return Window::New(surface, positionSize, name, className, isTransparent);
+ return Window::New(surface, positionSize, name, className, type, isTransparent);
}
-Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
{
- Window* window = new Window();
+ Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize(surface, positionSize, name, className);
+ window->Initialize(surface, positionSize, name, className, type);
return window;
}
Window::Window()
-: mWindowSurface( nullptr ),
+: mWindowSurface(nullptr),
mWindowBase(),
- mIsTransparent( false ),
- mIsFocusAcceptable( true ),
- mIconified( false ),
- mOpaqueState( false ),
- mResizeEnabled( false ),
- mType( Dali::Window::NORMAL ),
- mParentWindow( NULL ),
- mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ),
- mRotationAngle( -1 ),
- mWindowWidth( 0 ),
- mWindowHeight( 0 ),
- mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
- mNativeWindowId( -1 ),
- mResizedSignal(),
+ mIsTransparent(false),
+ mIsFocusAcceptable(true),
+ mIconified(false),
+ mOpaqueState(false),
+ mWindowRotationAcknowledgement(false),
+ mParentWindow(NULL),
+ mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
+ mRotationAngle(0),
+ mWindowWidth(0),
+ mWindowHeight(0),
+ mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
+ mNativeWindowId(-1),
mDeleteRequestSignal(),
mFocusChangeSignal(),
mResizeSignal(),
mVisibilityChangedSignal(),
- mTransitionEffectEventSignal()
+ mTransitionEffectEventSignal(),
+ mKeyboardRepeatSettingsChangedSignal()
{
}
Window::~Window()
{
- if ( mEventHandler )
+ if(mAdaptor)
{
- mEventHandler->RemoveObserver( *this );
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer);
+ bridge->RemoveTopLevelWindow(accessible);
+
+ mAdaptor->RemoveWindow(this);
+ }
+
+ if(mEventHandler)
+ {
+ mEventHandler->RemoveObserver(*this);
}
}
-void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
+void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, WindowType type)
{
// Create a window render surface
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
- mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
- mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
+ mSurface = renderSurfaceFactory->CreateWindowRenderSurface(positionSize, surface, mIsTransparent);
+ mWindowSurface = static_cast<WindowRenderSurface*>(mSurface.get());
// Get a window base
mWindowBase = mWindowSurface->GetWindowBase();
- // Connect signals
- mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
- mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
- mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
- mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
-
- mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
+ // Set Window Type
+ mWindowBase->SetType(type);
- if( !positionSize.IsEmpty() )
+ // Initialize for Ime window type
+ if(type == WindowType::IME)
{
- AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
- mResizeEnabled = true;
+ mWindowBase->InitializeIme();
+ mWindowSurface->InitializeImeSurface();
}
- SetClass( name, className );
+ // Connect signals
+ mWindowBase->IconifyChangedSignal().Connect(this, &Window::OnIconifyChanged);
+ mWindowBase->FocusChangedSignal().Connect(this, &Window::OnFocusChanged);
+ mWindowBase->DeleteRequestSignal().Connect(this, &Window::OnDeleteRequest);
+ mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent);
+ mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged);
+ mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
+ mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
+
+ mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
- mWindowSurface->Map();
+ AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
- mOrientation = Orientation::New( this );
+ SetClass(name, className);
+
+ mOrientation = Orientation::New(this);
// Get OrientationMode
int screenWidth, screenHeight;
- WindowSystem::GetScreenSize( screenWidth, screenHeight );
- if( screenWidth > screenHeight )
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+ if(screenWidth > screenHeight)
{
mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
}
void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
{
- mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
- mEventHandler->AddObserver( *this );
+ mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
+ mEventHandler->AddObserver(*this);
+
+ auto bridge = Accessibility::Bridge::GetCurrentBridge();
+ auto rootLayer = mScene.GetRootLayer();
+ auto accessible = Accessibility::Accessible::Get(rootLayer, true);
+ bridge->AddTopLevelWindow(accessible);
+
+ // If you call the 'Show' before creating the adaptor, the application cannot know the app resource id.
+ // The show must be called after the adaptor is initialized.
+ Show();
}
-void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
+void Window::OnSurfaceSet(Dali::RenderSurfaceInterface* surface)
{
- mWindowSurface = static_cast<WindowRenderSurface*>( surface );
+ mWindowSurface = static_cast<WindowRenderSurface*>(surface);
}
-void Window::SetClass( std::string name, std::string className )
+void Window::SetClass(std::string name, std::string className)
{
- mName = name;
+ mName = name;
mClassName = className;
- mWindowBase->SetClass( name, className );
+ mWindowBase->SetClass(name, className);
}
std::string Window::GetClassName() const
{
mWindowBase->Raise();
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId);
}
void Window::Lower()
{
mWindowBase->Lower();
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId);
}
void Window::Activate()
{
mWindowBase->Activate();
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
}
uint32_t Window::GetLayerCount() const
return mScene.GetLayerCount();
}
-Dali::Layer Window::GetLayer( uint32_t depth ) const
+Dali::Layer Window::GetLayer(uint32_t depth) const
{
- return mScene.GetLayer( depth );
+ return mScene.GetLayer(depth);
}
Dali::RenderTaskList Window::GetRenderTaskList() const
return mScene.GetRenderTaskList();
}
-void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
+void Window::AddAvailableOrientation(WindowOrientation orientation)
{
- if( IsOrientationAvailable( orientation ) == false )
+ if(IsOrientationAvailable(orientation) == false)
{
return;
}
- bool found = false;
- int convertedAngle = ConvertToAngle( orientation );
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
- for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+ bool found = false;
+ int convertedAngle = ConvertToAngle(orientation);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
+ for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
{
- if( mAvailableAngles[i] == convertedAngle )
+ if(mAvailableAngles[i] == convertedAngle)
{
found = true;
break;
}
}
- if( !found )
+ if(!found)
{
- mAvailableAngles.push_back( convertedAngle );
- SetAvailableAnlges( mAvailableAngles );
+ mAvailableAngles.push_back(convertedAngle);
+ SetAvailableAnlges(mAvailableAngles);
}
}
-void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
+void Window::RemoveAvailableOrientation(WindowOrientation orientation)
{
- if( IsOrientationAvailable( orientation ) == false )
+ if(IsOrientationAvailable(orientation) == false)
{
return;
}
- int convertedAngle = ConvertToAngle( orientation );
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle );
- for( std::vector< int >::iterator iter = mAvailableAngles.begin();
- iter != mAvailableAngles.end(); ++iter )
+ int convertedAngle = ConvertToAngle(orientation);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
+ for(std::vector<int>::iterator iter = mAvailableAngles.begin();
+ iter != mAvailableAngles.end();
+ ++iter)
{
- if( *iter == convertedAngle )
+ if(*iter == convertedAngle)
{
- mAvailableAngles.erase( iter );
+ mAvailableAngles.erase(iter);
break;
}
}
- SetAvailableAnlges( mAvailableAngles );
+ SetAvailableAnlges(mAvailableAngles);
}
-void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+void Window::SetPreferredOrientation(WindowOrientation orientation)
{
- if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
+ if(orientation < WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation );
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation);
return;
}
- mPreferredAngle = ConvertToAngle( orientation );
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
- mWindowBase->SetPreferredAngle( mPreferredAngle );
+ mPreferredAngle = ConvertToAngle(orientation);
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
+ mWindowBase->SetPreferredAngle(mPreferredAngle);
}
-Dali::Window::WindowOrientation Window::GetPreferredOrientation()
+WindowOrientation Window::GetPreferredOrientation()
{
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle );
- Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
+ WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle);
return preferredOrientation;
}
-void Window::SetAvailableAnlges( const std::vector< int >& angles )
+void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation)
{
- if( angles.size() > 4 )
+ int angle = ConvertToAngle(orientation);
+ mWindowBase->SetPositionSizeWithAngle(positionSize, angle);
+}
+
+void Window::SetAvailableAnlges(const std::vector<int>& angles)
+{
+ if(angles.size() > 4)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
return;
}
- mWindowBase->SetAvailableAnlges( angles );
+ mWindowBase->SetAvailableAnlges(angles);
}
-int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
+int Window::ConvertToAngle(WindowOrientation orientation)
{
- int convertAngle = static_cast< int >( orientation );
- if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
+ int convertAngle = static_cast<int>(orientation);
+ if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
{
- switch( orientation )
+ switch(orientation)
{
- case Dali::Window::LANDSCAPE:
+ case WindowOrientation::LANDSCAPE:
{
convertAngle = 0;
break;
}
- case Dali::Window::PORTRAIT:
+ case WindowOrientation::PORTRAIT:
{
convertAngle = 90;
break;
}
- case Dali::Window::LANDSCAPE_INVERSE:
+ case WindowOrientation::LANDSCAPE_INVERSE:
{
convertAngle = 180;
break;
}
- case Dali::Window::PORTRAIT_INVERSE:
+ case WindowOrientation::PORTRAIT_INVERSE:
{
convertAngle = 270;
break;
}
- case Dali::Window::NO_ORIENTATION_PREFERENCE:
+ case WindowOrientation::NO_ORIENTATION_PREFERENCE:
{
convertAngle = -1;
break;
return convertAngle;
}
-Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle ) const
+WindowOrientation Window::ConvertToOrientation(int angle) const
{
- Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
- if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
+ WindowOrientation orientation = static_cast<WindowOrientation>(angle);
+ if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
{
- switch( angle )
+ switch(angle)
{
case 0:
{
- orientation = Dali::Window::LANDSCAPE;
+ orientation = WindowOrientation::LANDSCAPE;
break;
}
case 90:
{
- orientation = Dali::Window::PORTRAIT;
+ orientation = WindowOrientation::PORTRAIT;
break;
}
case 180:
{
- orientation = Dali::Window::LANDSCAPE_INVERSE;
+ orientation = WindowOrientation::LANDSCAPE_INVERSE;
break;
}
case 270:
{
- orientation = Dali::Window::PORTRAIT_INVERSE;
+ orientation = WindowOrientation::PORTRAIT_INVERSE;
break;
}
case -1:
{
- orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
+ orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
break;
}
}
return orientation;
}
-bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
+bool Window::IsOrientationAvailable(WindowOrientation orientation) const
{
- if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
+ if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
return false;
}
return true;
return mWindowSurface->GetNativeWindow();
}
-void Window::SetAcceptFocus( bool accept )
+void Window::SetAcceptFocus(bool accept)
{
mIsFocusAcceptable = accept;
- mWindowBase->SetAcceptFocus( accept );
+ mWindowBase->SetAcceptFocus(accept);
}
bool Window::IsFocusAcceptable() const
mWindowBase->Show();
- if( !mIconified )
+ if(!mIconified)
{
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowShown();
+ Dali::Window handle(this);
+ mVisibilityChangedSignal.Emit(handle, true);
- Dali::Window handle( this );
- mVisibilityChangedSignal.Emit( handle, true );
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
}
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
}
void Window::Hide()
mWindowBase->Hide();
- if( !mIconified )
+ if(!mIconified)
{
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowHidden();
+ Dali::Window handle(this);
+ mVisibilityChangedSignal.Emit(handle, false);
- Dali::Window handle( this );
- mVisibilityChangedSignal.Emit( handle, false );
- }
-
-
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
}
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
}
bool Window::IsVisible() const
{
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
return mVisible && !mIconified;
}
return mWindowBase->GetSupportedAuxiliaryHintCount();
}
-std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
+std::string Window::GetSupportedAuxiliaryHint(unsigned int index) const
{
- return mWindowBase->GetSupportedAuxiliaryHint( index );
+ return mWindowBase->GetSupportedAuxiliaryHint(index);
}
-unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
+unsigned int Window::AddAuxiliaryHint(const std::string& hint, const std::string& value)
{
- return mWindowBase->AddAuxiliaryHint( hint, value );
+ return mWindowBase->AddAuxiliaryHint(hint, value);
}
-bool Window::RemoveAuxiliaryHint( unsigned int id )
+bool Window::RemoveAuxiliaryHint(unsigned int id)
{
- return mWindowBase->RemoveAuxiliaryHint( id );
+ return mWindowBase->RemoveAuxiliaryHint(id);
}
-bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
+bool Window::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
{
- return mWindowBase->SetAuxiliaryHintValue( id, value );
+ return mWindowBase->SetAuxiliaryHintValue(id, value);
}
-std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
+std::string Window::GetAuxiliaryHintValue(unsigned int id) const
{
- return mWindowBase->GetAuxiliaryHintValue( id );
+ return mWindowBase->GetAuxiliaryHintValue(id);
}
-unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
+unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const
{
- return mWindowBase->GetAuxiliaryHintId( hint );
+ return mWindowBase->GetAuxiliaryHintId(hint);
}
-void Window::SetInputRegion( const Rect< int >& inputRegion )
+void Window::SetInputRegion(const Rect<int>& inputRegion)
{
- mWindowBase->SetInputRegion( inputRegion );
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window (%p), WinId (%d), SetInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
+ mWindowBase->SetInputRegion(convertRegion);
}
-void Window::SetType( Dali::Window::Type type )
+void Window::SetType(WindowType type)
{
- if( type != mType )
- {
- mWindowBase->SetType( type );
-
- mType = type;
- }
+ mWindowBase->SetType(type);
}
-Dali::Window::Type Window::GetType() const
+WindowType Window::GetType() const
{
- return mType;
+ return mWindowBase->GetType();
}
-bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
+WindowOperationResult Window::SetNotificationLevel(WindowNotificationLevel level)
{
- if( mType != Dali::Window::NOTIFICATION )
+ WindowType type = mWindowBase->GetType();
+ if(type != WindowType::NOTIFICATION)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
- return false;
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", type);
+ return WindowOperationResult::INVALID_OPERATION;
}
- return mWindowBase->SetNotificationLevel( level );
+ return mWindowBase->SetNotificationLevel(level);
}
-Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
+WindowNotificationLevel Window::GetNotificationLevel() const
{
- if( mType != Dali::Window::NOTIFICATION )
+ WindowType type = mWindowBase->GetType();
+ if(type != WindowType::NOTIFICATION)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
- return Dali::Window::NotificationLevel::NONE;
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", type);
+ return WindowNotificationLevel::NONE;
}
return mWindowBase->GetNotificationLevel();
}
-void Window::SetOpaqueState( bool opaque )
+void Window::SetOpaqueState(bool opaque)
{
mOpaqueState = opaque;
- mWindowBase->SetOpaqueState( opaque );
+ mWindowBase->SetOpaqueState(opaque);
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque);
}
bool Window::IsOpaqueState() const
return mOpaqueState;
}
-bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
+WindowOperationResult Window::SetScreenOffMode(WindowScreenOffMode screenOffMode)
{
- return mWindowBase->SetScreenOffMode( screenOffMode );
+ return mWindowBase->SetScreenOffMode(screenOffMode);
}
-Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
+WindowScreenOffMode Window::GetScreenOffMode() const
{
return mWindowBase->GetScreenOffMode();
}
-bool Window::SetBrightness( int brightness )
+WindowOperationResult Window::SetBrightness(int brightness)
{
- if( brightness < 0 || brightness > 100 )
+ if(brightness < 0 || brightness > 100)
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
- return false;
+ DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness);
+ return WindowOperationResult::INVALID_OPERATION;
}
- return mWindowBase->SetBrightness( brightness );
+ return mWindowBase->SetBrightness(brightness);
}
int Window::GetBrightness() const
return mWindowBase->GetBrightness();
}
-void Window::SetSize( Dali::Window::WindowSize size )
+void Window::SetSize(Dali::Window::WindowSize size)
{
- if( !mResizeEnabled )
- {
- AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
- mWindowSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
+ mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
PositionSize newRect = mSurface->GetPositionSize();
// When surface size is updated, inform adaptor of resizing and emit ResizeSignal
- if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
+ if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
- Uint16Pair newSize( newRect.width, newRect.height );
+ Uint16Pair newSize(newRect.width, newRect.height);
SurfaceResized();
- mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
- Dali::Window handle( this );
- mResizedSignal.Emit( newSize );
- mResizeSignal.Emit( handle, newSize );
+ Dali::Window handle(this);
+ mResizeSignal.Emit(handle, newSize);
- mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
}
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
}
Dali::Window::WindowSize Window::GetSize() const
{
PositionSize positionSize = mSurface->GetPositionSize();
- return Dali::Window::WindowSize( positionSize.width, positionSize.height );
+ return Dali::Window::WindowSize(positionSize.width, positionSize.height);
}
-void Window::SetPosition( Dali::Window::WindowPosition position )
+void Window::SetPosition(Dali::Window::WindowPosition position)
{
- if( !mResizeEnabled )
- {
- AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
- mResizeEnabled = true;
- }
-
PositionSize oldRect = mSurface->GetPositionSize();
- mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
+ mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
}
Dali::Window::WindowPosition Window::GetPosition() const
{
PositionSize positionSize = mSurface->GetPositionSize();
- return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
+ return Dali::Window::WindowPosition(positionSize.x, positionSize.y);
}
-void Window::SetPositionSize( PositionSize positionSize )
+PositionSize Window::GetPositionSize() const
{
- if( !mResizeEnabled )
- {
- AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
- mResizeEnabled = true;
- }
+ return mSurface->GetPositionSize();
+}
+void Window::SetPositionSize(PositionSize positionSize)
+{
PositionSize oldRect = mSurface->GetPositionSize();
- mWindowSurface->MoveResize( positionSize );
+ mWindowSurface->MoveResize(positionSize);
PositionSize newRect = mSurface->GetPositionSize();
// When surface size is updated, inform adaptor of resizing and emit ResizeSignal
- if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
+ if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
{
- Uint16Pair newSize( newRect.width, newRect.height );
+ Uint16Pair newSize(newRect.width, newRect.height);
SurfaceResized();
- mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
- Dali::Window handle( this );
- mResizedSignal.Emit( newSize );
- mResizeSignal.Emit( handle, newSize );
- mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
+ Dali::Window handle(this);
+ mResizeSignal.Emit(handle, newSize);
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
}
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
+
+ Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
}
Dali::Layer Window::GetRootLayer() const
return mScene.GetRootLayer();
}
-void Window::SetTransparency( bool transparent )
+void Window::SetTransparency(bool transparent)
{
- mWindowSurface->SetTransparency( transparent );
+ mWindowSurface->SetTransparency(transparent);
}
-bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
+bool Window::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
{
- return mWindowBase->GrabKey( key, grabMode );
+ return mWindowBase->GrabKey(key, grabMode);
}
-bool Window::UngrabKey( Dali::KEY key )
+bool Window::UngrabKey(Dali::KEY key)
{
- return mWindowBase->UngrabKey( key );
+ return mWindowBase->UngrabKey(key);
}
-bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
+bool Window::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
{
- return mWindowBase->GrabKeyList( key, grabMode, result );
+ return mWindowBase->GrabKeyList(key, grabMode, result);
}
-bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
+bool Window::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
{
- return mWindowBase->UngrabKeyList( key, result );
+ return mWindowBase->UngrabKeyList(key, result);
}
-void Window::OnIconifyChanged( bool iconified )
+void Window::OnIconifyChanged(bool iconified)
{
- if( iconified )
+ if(iconified)
{
mIconified = true;
- if( mVisible )
+ if(mVisible)
{
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowHidden();
+ Dali::Window handle(this);
+ mVisibilityChangedSignal.Emit(handle, false);
- Dali::Window handle( this );
- mVisibilityChangedSignal.Emit( handle, false );
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
}
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
}
else
{
mIconified = false;
- if( mVisible )
+ if(mVisible)
{
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowShown();
+ Dali::Window handle(this);
+ mVisibilityChangedSignal.Emit(handle, true);
- Dali::Window handle( this );
- mVisibilityChangedSignal.Emit( handle, true );
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
}
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
}
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
}
-void Window::OnFocusChanged( bool focusIn )
+void Window::OnFocusChanged(bool focusIn)
{
- Dali::Window handle( this );
- mFocusChangeSignal.Emit( handle, focusIn );
+ Dali::Window handle(this);
+ mFocusChangeSignal.Emit(handle, focusIn);
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
+ mSurface->SetFullSwapNextFrame();
+
+ if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge())
{
- eglGraphics->SetFullSwapNextFrame();
+ if(focusIn)
+ {
+ bridge->WindowShown();
+ }
+ else
+ {
+ bridge->WindowHidden();
+ }
}
}
void Window::OnOutputTransformed()
{
PositionSize positionSize = mSurface->GetPositionSize();
- SurfaceResized();
- mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
- mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+ int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
+ SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), orientation);
+
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
}
void Window::OnDeleteRequest()
mDeleteRequestSignal.Emit();
}
-void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
+void Window::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
+{
+ Dali::Window handle(this);
+ mTransitionEffectEventSignal.Emit(handle, state, type);
+}
+
+void Window::OnKeyboardRepeatSettingsChanged()
+{
+ Dali::Window handle(this);
+ mKeyboardRepeatSettingsChangedSignal.Emit();
+}
+
+void Window::OnWindowRedrawRequest()
{
- Dali::Window handle( this );
- mTransitionEffectEventSignal.Emit( handle, state, type );
+ mAdaptor->RenderOnce();
}
-void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
+void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
{
- FeedTouchPoint( point, timeStamp );
+ SetPositionSize(positionSize);
}
-void Window::OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
+void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
{
- FeedWheelEvent( wheelEvent );
+ FeedTouchPoint(point, timeStamp);
}
-void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
+void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
{
- FeedKeyEvent( keyEvent );
+ FeedWheelEvent(wheelEvent);
}
-void Window::OnRotation( const RotationEvent& rotation )
+void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
+{
+ FeedKeyEvent(keyEvent);
+}
+
+void Window::OnRotation(const RotationEvent& rotation)
{
mRotationAngle = rotation.angle;
- mWindowWidth = rotation.width;
- mWindowHeight = rotation.height;
+ mWindowWidth = rotation.width;
+ mWindowHeight = rotation.height;
// Notify that the orientation is changed
- mOrientation->OnOrientationChange( rotation );
+ mOrientation->OnOrientationChange(rotation);
- mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
+ mWindowSurface->RequestRotation(mRotationAngle, mWindowWidth, mWindowHeight);
- SurfaceResized();
+ int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
+ SurfaceRotated(mWindowWidth, mWindowHeight, orientation);
- mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
// Emit signal
- Dali::Window handle( this );
- mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
- mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
+ Dali::Window handle(this);
+ mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
- mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
}
void Window::OnPause()
{
- if( mEventHandler )
+ if(mEventHandler)
{
mEventHandler->Pause();
}
-
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
}
void Window::OnResume()
{
- if( mEventHandler )
+ if(mEventHandler)
{
mEventHandler->Resume();
}
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
- {
- eglGraphics->SetFullSwapNextFrame();
- }
+ mSurface->SetFullSwapNextFrame();
}
-void Window::RecalculateTouchPosition( Integration::Point& point )
+void Window::RecalculateTouchPosition(Integration::Point& point)
{
Vector2 position = point.GetScreenPosition();
Vector2 convertedPosition;
- switch( mRotationAngle )
+ switch(mRotationAngle)
{
case 90:
{
- convertedPosition.x = static_cast<float>( mWindowWidth ) - position.y;
+ convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
convertedPosition.y = position.x;
break;
}
case 180:
{
- convertedPosition.x = static_cast<float>( mWindowWidth ) - position.x;
- convertedPosition.y = static_cast<float>( mWindowHeight ) - position.y;
+ convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
+ convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
break;
}
case 270:
{
convertedPosition.x = position.y;
- convertedPosition.y = static_cast<float>( mWindowHeight ) - position.x;
+ convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
break;
}
default:
}
}
- point.SetScreenPosition( convertedPosition );
+ point.SetScreenPosition(convertedPosition);
}
-Dali::Window Window::Get( Dali::Actor actor )
+Dali::Window Window::Get(Dali::Actor actor)
{
Internal::Adaptor::Window* windowImpl = nullptr;
- if ( Internal::Adaptor::Adaptor::IsAvailable() )
+ if(Internal::Adaptor::Adaptor::IsAvailable())
{
- Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
- windowImpl = dynamic_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
- if( windowImpl )
+ Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation(Internal::Adaptor::Adaptor::Get());
+ windowImpl = dynamic_cast<Internal::Adaptor::Window*>(adaptor.GetWindow(actor));
+ if(windowImpl)
{
- return Dali::Window( windowImpl );
+ return Dali::Window(windowImpl);
}
}
return Dali::Window();
}
-void Window::SetParent( Dali::Window& parent )
+void Window::SetParent(Dali::Window& parent)
+{
+ if(DALI_UNLIKELY(parent))
+ {
+ mParentWindow = parent;
+ Dali::Window self = Dali::Window(this);
+ // check circular parent window setting
+ if(Dali::DevelWindow::GetParent(parent) == self)
+ {
+ Dali::DevelWindow::Unparent(parent);
+ }
+ mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, false);
+ }
+}
+
+void Window::SetParent(Dali::Window& parent, bool belowParent)
{
- if ( DALI_UNLIKELY( parent ) )
+ if(DALI_UNLIKELY(parent))
{
- mParentWindow = parent;
- Dali::Window self = Dali::Window( this );
+ mParentWindow = parent;
+ Dali::Window self = Dali::Window(this);
// check circular parent window setting
- if ( Dali::DevelWindow::GetParent( parent ) == self )
+ if(Dali::DevelWindow::GetParent(parent) == self)
{
- Dali::DevelWindow::Unparent( parent );
+ Dali::DevelWindow::Unparent(parent);
}
- mWindowBase->SetParent( GetImplementation( mParentWindow ).mWindowBase );
+ mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, belowParent);
}
}
void Window::Unparent()
{
- mWindowBase->SetParent( nullptr );
+ mWindowBase->SetParent(nullptr, false);
mParentWindow.Reset();
}
return mParentWindow;
}
-Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
+WindowOrientation Window::GetCurrentOrientation() const
+{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle);
+ return ConvertToOrientation(mRotationAngle);
+}
+
+int Window::GetPhysicalOrientation() const
{
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle );
- return ConvertToOrientation( mRotationAngle );
+ return (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
}
-void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
+void Window::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
{
Dali::Vector<float>::SizeType count = orientations.Count();
- for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
+ for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
{
- if( IsOrientationAvailable( orientations[index] ) == false )
+ if(IsOrientationAvailable(orientations[index]) == false)
{
DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
continue;
}
- bool found = false;
- int convertedAngle = ConvertToAngle( orientations[index] );
+ bool found = false;
+ int convertedAngle = ConvertToAngle(orientations[index]);
- for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+ for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
{
- if( mAvailableAngles[i] == convertedAngle )
+ if(mAvailableAngles[i] == convertedAngle)
{
found = true;
break;
}
}
- if( !found )
+ if(!found)
{
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
- mAvailableAngles.push_back( convertedAngle );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle);
+ mAvailableAngles.push_back(convertedAngle);
}
}
- SetAvailableAnlges( mAvailableAngles );
+ SetAvailableAnlges(mAvailableAngles);
}
int32_t Window::GetNativeId() const
return mWindowBase->GetNativeWindowId();
}
-void Window::SetDamagedAreas(std::vector<Dali::Rect<int>>& areas)
+void Window::RequestMoveToServer()
+{
+ mWindowBase->RequestMoveToServer();
+}
+
+void Window::RequestResizeToServer(WindowResizeDirection direction)
+{
+ mWindowBase->RequestResizeToServer(direction);
+}
+
+void Window::EnableFloatingMode(bool enable)
+{
+ mWindowBase->EnableFloatingMode(enable);
+}
+
+Rect<int> Window::RecalculateRect(const Rect<int>& rect)
+{
+ Rect<int> newRect;
+ int screenWidth, screenHeight;
+
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
+
+ if(mRotationAngle == 90)
+ {
+ newRect.x = rect.y;
+ newRect.y = screenHeight - (rect.x + rect.width);
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else if(mRotationAngle == 180)
+ {
+ newRect.x = screenWidth - (rect.x + rect.width);
+ newRect.y = screenHeight - (rect.y + rect.height);
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ else if(mRotationAngle == 270)
+ {
+ newRect.x = screenWidth - (rect.y + rect.height);
+ newRect.y = rect.x;
+ newRect.width = rect.height;
+ newRect.height = rect.width;
+ }
+ else
+ {
+ newRect.x = rect.x;
+ newRect.y = rect.y;
+ newRect.width = rect.width;
+ newRect.height = rect.height;
+ }
+ return newRect;
+}
+
+void Window::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
+ mWindowBase->IncludeInputRegion(convertRegion);
+}
+
+void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+ Rect<int> convertRegion = RecalculateRect(inputRegion);
+
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, RecalculateRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, convertRegion.x, convertRegion.y, convertRegion.width, convertRegion.height);
+ mWindowBase->ExcludeInputRegion(convertRegion);
+}
+
+void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
+{
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), needAcknowledgement(%d) Set needs Rotation Completed Acknowledgement\n", this, mNativeWindowId, needAcknowledgement);
+ mWindowSurface->SetNeedsRotationCompletedAcknowledgement(needAcknowledgement);
+ mWindowRotationAcknowledgement = needAcknowledgement;
+}
+
+void Window::SendRotationCompletedAcknowledgement()
{
- GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
- EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
- if (eglGraphics)
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SendRotationCompletedAcknowledgement(): orientation: %d, mWindowRotationAcknowledgement: %d\n", this, mNativeWindowId, mRotationAngle, mWindowRotationAcknowledgement);
+ if(mWindowRotationAcknowledgement)
{
- eglGraphics->SetDamagedAreas(areas);
+ SetRotationCompletedAcknowledgement();
}
}
-} // Adaptor
+} // namespace Adaptor
-} // Internal
+} // namespace Internal
-} // Dali
+} // namespace Dali