X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-impl.cpp;h=e0a6cc5d1beaf16747b8e2d200aa30df5f288f44;hb=06db2cc40c59daa1f29b8a2a375285030439d823;hp=ce7a6a7e4c61c1763525dbe7b3af47a6604bb7d2;hpb=ea68cf28bef0700c1432b8b84cef7758eede61c3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index ce7a6a7..e0a6cc5 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -32,7 +32,8 @@ #include // INTERNAL HEADERS -#include +#include +#include #include #include #include @@ -80,6 +81,7 @@ Window::Window() mIconified(false), mOpaqueState(false), mWindowRotationAcknowledgement(false), + mFocused(false), mParentWindow(NULL), mPreferredAngle(static_cast(WindowOrientation::NO_ORIENTATION_PREFERENCE)), mRotationAngle(0), @@ -92,19 +94,25 @@ Window::Window() mResizeSignal(), mVisibilityChangedSignal(), mTransitionEffectEventSignal(), - mKeyboardRepeatSettingsChangedSignal() + mKeyboardRepeatSettingsChangedSignal(), + mAuxiliaryMessageSignal() { } Window::~Window() { - if(mAdaptor) + if(mScene) { auto bridge = Accessibility::Bridge::GetCurrentBridge(); auto rootLayer = mScene.GetRootLayer(); - auto accessible = Accessibility::Accessible::Get(rootLayer); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); bridge->RemoveTopLevelWindow(accessible); + // Related to multi-window case. This is called for default window and non-default window, but it is effective for non-default window. + bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY); + } + if(mAdaptor) + { mAdaptor->RemoveWindow(this); } @@ -142,6 +150,7 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged); mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest); mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize); + mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage); mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed); @@ -171,10 +180,17 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) 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); + // Add Window to bridge for ATSPI + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + if(bridge->IsUp()) + { + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); + bridge->AddTopLevelWindow(accessible); + } + + bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled); + bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled); // 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. @@ -225,6 +241,30 @@ void Window::Activate() DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId); } +void Window::Maximize(bool maximize) +{ + mWindowBase->Maximize(maximize); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Maximize: %d\n", this, mNativeWindowId, maximize); +} + +bool Window::IsMaximized() const +{ + return mWindowBase->IsMaximized(); +} + +void Window::Minimize(bool minimize) +{ + mWindowBase->Minimize(minimize); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Minimize: %d\n", this, mNativeWindowId, minimize); +} + +bool Window::IsMinimized() const +{ + return mWindowBase->IsMinimized(); +} + uint32_t Window::GetLayerCount() const { return mScene.GetLayerCount(); @@ -240,6 +280,11 @@ Dali::RenderTaskList Window::GetRenderTaskList() const return mScene.GetRenderTaskList(); } +std::string Window::GetNativeResourceId() const +{ + return mWindowBase->GetNativeWindowResourceId(); +} + void Window::AddAvailableOrientation(WindowOrientation orientation) { if(IsOrientationAvailable(orientation) == false) @@ -314,6 +359,12 @@ void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOri mWindowBase->SetPositionSizeWithAngle(positionSize, angle); } +void Window::EmitAccessibilityHighlightSignal(bool highlight) +{ + Dali::Window handle(this); + mAccessibilityHighlightSignal.Emit(handle, highlight); +} + void Window::SetAvailableAnlges(const std::vector& angles) { if(angles.size() > 4) @@ -436,6 +487,7 @@ void Window::Show() { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, true); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowShown(); @@ -456,6 +508,7 @@ void Window::Hide() { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, false); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowHidden(); @@ -507,9 +560,11 @@ unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const void Window::SetInputRegion(const Rect& inputRegion) { - mWindowBase->SetInputRegion(inputRegion); + Rect convertRegion = RecalculateRect(inputRegion); + + 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(WindowType type) @@ -599,11 +654,14 @@ void Window::SetSize(Dali::Window::WindowSize size) { Uint16Pair newSize(newRect.width, newRect.height); + mWindowWidth = newRect.width; + mWindowHeight = newRect.height; + SurfaceResized(); 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), current angle (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.width, newRect.height); Dali::Window handle(this); mResizeSignal.Emit(handle, newSize); @@ -659,11 +717,14 @@ void Window::SetPositionSize(PositionSize positionSize) { Uint16Pair newSize(newRect.width, newRect.height); + mWindowWidth = newRect.width; + mWindowHeight = newRect.height; + SurfaceResized(); 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_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.width, newRect.height); Dali::Window handle(this); mResizeSignal.Emit(handle, newSize); mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize); @@ -714,6 +775,7 @@ void Window::OnIconifyChanged(bool iconified) { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, false); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowHidden(); @@ -729,6 +791,7 @@ void Window::OnIconifyChanged(bool iconified) { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, true); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowShown(); @@ -751,13 +814,14 @@ void Window::OnFocusChanged(bool focusIn) { if(focusIn) { - bridge->WindowShown(); + bridge->WindowFocused(handle); } else { - bridge->WindowHidden(); + bridge->WindowUnfocused(handle); } } + mFocused = focusIn; } void Window::OnOutputTransformed() @@ -795,7 +859,30 @@ void Window::OnWindowRedrawRequest() void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) { - SetPositionSize(positionSize); + PositionSize oldRect = mSurface->GetPositionSize(); + + mWindowSurface->UpdatePositionSize(positionSize); + + PositionSize newRect = positionSize; + + // When surface size is updated, inform adaptor of resizing and emit ResizeSignal + if((oldRect.width != newRect.width) || (oldRect.height != newRect.height)) + { + Uint16Pair newSize(newRect.width, newRect.height); + + SurfaceResized(); + + mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Updated PositionSize by server :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); + } + + mSurface->SetFullSwapNextFrame(); + + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); } void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) @@ -815,6 +902,8 @@ void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) void Window::OnRotation(const RotationEvent& rotation) { + PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height); + mRotationAngle = rotation.angle; mWindowWidth = rotation.width; mWindowHeight = rotation.height; @@ -822,14 +911,14 @@ void Window::OnRotation(const RotationEvent& rotation) // Notify that the orientation is changed mOrientation->OnOrientationChange(rotation); - mWindowSurface->RequestRotation(mRotationAngle, mWindowWidth, mWindowHeight); + mWindowSurface->RequestRotation(mRotationAngle, newPositionSize); int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360; SurfaceRotated(mWindowWidth, mWindowHeight, orientation); 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(): x[%d], y[%d], resize signal emit [%d x %d]\n", this, mNativeWindowId, newPositionSize.x, newPositionSize.y, mWindowWidth, mWindowHeight); // Emit signal Dali::Window handle(this); mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight)); @@ -855,6 +944,33 @@ void Window::OnResume() mSurface->SetFullSwapNextFrame(); } +void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options) +{ + mAuxiliaryMessageSignal.Emit(key, value, options); +} + +void Window::OnAccessibilityEnabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); + bridge->AddTopLevelWindow(accessible); + + if(mFocused) + { + Dali::Window handle(this); + bridge->WindowFocused(handle); + } +} + +void Window::OnAccessibilityDisabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer, true); + bridge->RemoveTopLevelWindow(accessible); +} + void Window::RecalculateTouchPosition(Integration::Point& point) { Vector2 position = point.GetScreenPosition(); @@ -1011,14 +1127,58 @@ void Window::EnableFloatingMode(bool enable) mWindowBase->EnableFloatingMode(enable); } +Rect Window::RecalculateRect(const Rect& rect) +{ + Rect 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& inputRegion) { - mWindowBase->IncludeInputRegion(inputRegion); + Rect 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& inputRegion) { - mWindowBase->ExcludeInputRegion(inputRegion); + Rect 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) @@ -1037,6 +1197,11 @@ void Window::SendRotationCompletedAcknowledgement() } } +bool Window::IsWindowRotating() const +{ + return mWindowSurface->IsWindowRotating(); +} + } // namespace Adaptor } // namespace Internal