X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-impl.cpp;h=e0a6cc5d1beaf16747b8e2d200aa30df5f288f44;hb=6b609829e437193b41eddfa934124fe9a42dea7f;hp=c14a0c4416f6e8b80652d3b70e1952168333acc7;hpb=428943db1f24970cd00c323ea47dfbd05ebf7d87;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 c14a0c4..7c6ebfc 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) 2023 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. @@ -20,19 +20,19 @@ // EXTERNAL HEADERS #include +#include #include #include #include #include #include #include -#include -#include #include #include // INTERNAL HEADERS -#include +#include +#include #include #include #include @@ -55,54 +55,74 @@ namespace #if defined(DEBUG_ENABLED) 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, Dali::WindowType type, bool isTransparent) +Window* Window::New(const std::string& name, const std::string& className, const WindowData& windowData) { Any surface; - return Window::New(surface, positionSize, name, className, type, isTransparent); + return Window::New(surface, name, className, windowData); } -Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent) +Window* Window::New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData) { Window* window = new Window(); - window->mIsTransparent = isTransparent; - window->Initialize(surface, positionSize, name, className, type); + window->mIsTransparent = windowData.GetTransparency(); + window->mIsFrontBufferRendering = windowData.GetFrontBufferRendering(); + window->Initialize(surface, windowData.GetPositionSize(), name, className, windowData.GetWindowType()); return window; } Window::Window() : mWindowSurface(nullptr), mWindowBase(), - mIsTransparent(false), - mIsFocusAcceptable(true), - mIconified(false), - mOpaqueState(false), - mWindowRotationAcknowledgement(false), mParentWindow(NULL), mPreferredAngle(static_cast(WindowOrientation::NO_ORIENTATION_PREFERENCE)), mRotationAngle(0), mWindowWidth(0), mWindowHeight(0), - mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT), mNativeWindowId(-1), + mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT), mDeleteRequestSignal(), mFocusChangeSignal(), mResizeSignal(), mVisibilityChangedSignal(), mTransitionEffectEventSignal(), mKeyboardRepeatSettingsChangedSignal(), - mAuxiliaryMessageSignal() + mAuxiliaryMessageSignal(), + mMovedSignal(), + mOrientationChangedSignal(), + mMouseInOutEventSignal(), + mMouseRelativeEventSignal(), + mMoveCompletedSignal(), + mResizeCompletedSignal(), + mInsetsChangedSignal(), + mPointerConstraintsSignal(), + mLastKeyEvent(), + mIsTransparent(false), + mIsFocusAcceptable(true), + mIconified(false), + mMaximized(false), + mOpaqueState(false), + mWindowRotationAcknowledgement(false), + mFocused(false), + mIsWindowRotating(false), + mIsEnabledUserGeometry(false), + mIsEmittedWindowCreatedEvent(false), + mIsFrontBufferRendering(false) { } Window::~Window() { - auto bridge = Accessibility::Bridge::GetCurrentBridge(); - auto rootLayer = mScene.GetRootLayer(); - auto accessible = Accessibility::Accessible::Get(rootLayer); - bridge->RemoveTopLevelWindow(accessible); + if(mScene) + { + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer); + 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) { @@ -137,6 +157,7 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std // Connect signals mWindowBase->IconifyChangedSignal().Connect(this, &Window::OnIconifyChanged); + mWindowBase->MaximizeChangedSignal().Connect(this, &Window::OnMaximizeChanged); mWindowBase->FocusChangedSignal().Connect(this, &Window::OnFocusChanged); mWindowBase->DeleteRequestSignal().Connect(this, &Window::OnDeleteRequest); mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent); @@ -144,10 +165,16 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest); mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize); mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage); + mWindowBase->MouseInOutEventSignal().Connect(this, &Window::OnMouseInOutEvent); + mWindowBase->MouseRelativeEventSignal().Connect(this, &Window::OnMouseRelativeEvent); + mWindowBase->MoveCompletedSignal().Connect(this, &Window::OnMoveCompleted); + mWindowBase->ResizeCompletedSignal().Connect(this, &Window::OnResizeCompleted); + mWindowBase->PointerConstraintsSignal().Connect(this, &Window::OnPointerConstraints); mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed); + mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished); - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); + mWindowBase->InsetsChangedSignal().Connect(this, &Window::OnInsetsChanged); SetClass(name, className); @@ -164,8 +191,41 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std { mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT; } + + mWindowWidth = positionSize.width; + mWindowHeight = positionSize.height; + + bool isSetWithScreenSize = false; + if(mWindowWidth <= 0 || mWindowHeight <= 0) + { + mWindowWidth = screenWidth; + mWindowHeight = screenHeight; + isSetWithScreenSize = true; + DALI_LOG_RELEASE_INFO("Window size is set with screen size(%d x %d)\n", mWindowWidth, mWindowHeight); + } + + if(isSetWithScreenSize == false || positionSize.x != 0 || positionSize.y != 0) + { + SetUserGeometryPolicy(); + } + // For Debugging mNativeWindowId = mWindowBase->GetNativeWindowId(); + + if(mIsFrontBufferRendering) + { + SetFrontBufferRendering(mIsFrontBufferRendering); + } +} + +void Window::SetRenderNotification(TriggerEventInterface* renderNotification) +{ + if(!mWindowSurface) + { + return; + } + + mWindowSurface->SetRenderNotification(renderNotification); } void Window::OnAdaptorSet(Dali::Adaptor& adaptor) @@ -173,11 +233,26 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor)); mEventHandler->AddObserver(*this); + if(mWindowBase->GetType() == WindowType::IME) + { + mWindowBase->InitializeIme(); + mWindowSurface->InitializeImeSurface(); + } + // Add Window to bridge for ATSPI - auto bridge = Accessibility::Bridge::GetCurrentBridge(); - auto rootLayer = mScene.GetRootLayer(); - auto accessible = Accessibility::Accessible::Get(rootLayer, true); - bridge->AddTopLevelWindow(accessible); + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + + bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled); + bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled); + + if(bridge->IsUp()) + { + OnAccessibilityEnabled(); + } + else + { + 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. @@ -228,6 +303,40 @@ 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::SetMaximumSize(Dali::Window::WindowSize size) +{ + mWindowBase->SetMaximumSize(size); +} + +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(); +} + +void Window::SetMimimumSize(Dali::Window::WindowSize size) +{ + mWindowBase->SetMimimumSize(size); +} + uint32_t Window::GetLayerCount() const { return mScene.GetLayerCount(); @@ -238,9 +347,24 @@ Dali::Layer Window::GetLayer(uint32_t depth) const return mScene.GetLayer(depth); } -Dali::RenderTaskList Window::GetRenderTaskList() const +void Window::KeepRendering(float durationSeconds) +{ + mScene.KeepRendering(durationSeconds); +} + +void Window::SetPartialUpdateEnabled(bool enabled) +{ + mScene.SetPartialUpdateEnabled(enabled); +} + +bool Window::IsPartialUpdateEnabled() const { - return mScene.GetRenderTaskList(); + return mScene.IsPartialUpdateEnabled(); +} + +std::string Window::GetNativeResourceId() const +{ + return mWindowBase->GetNativeWindowResourceId(); } void Window::AddAvailableOrientation(WindowOrientation orientation) @@ -306,7 +430,6 @@ void Window::SetPreferredOrientation(WindowOrientation orientation) WindowOrientation Window::GetPreferredOrientation() { - DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle); WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle); return preferredOrientation; } @@ -317,6 +440,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) @@ -439,6 +568,7 @@ void Window::Show() { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, true); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowShown(); @@ -459,6 +589,7 @@ void Window::Hide() { Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, false); + Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowHidden(); @@ -510,11 +641,8 @@ unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const void Window::SetInputRegion(const Rect& 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); - - mWindowBase->SetInputRegion(convertRegion); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + mWindowBase->SetInputRegion(inputRegion); } void Window::SetType(WindowType type) @@ -593,22 +721,29 @@ int Window::GetBrightness() const void Window::SetSize(Dali::Window::WindowSize size) { - PositionSize oldRect = mSurface->GetPositionSize(); + PositionSize oldRect = GetPositionSize(); - mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight())); + PositionSize newRect; + newRect.width = size.GetWidth(); + newRect.height = size.GetHeight(); - PositionSize newRect = mSurface->GetPositionSize(); + SetUserGeometryPolicy(); // When surface size is updated, inform adaptor of resizing and emit ResizeSignal if((oldRect.width != newRect.width) || (oldRect.height != newRect.height)) { + mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, newRect.width, newRect.height)); + Uint16Pair newSize(newRect.width, newRect.height); - SurfaceResized(); + mWindowWidth = newRect.width; + mWindowHeight = newRect.height; - mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetSize(): (%d, %d), [%d x %d]\n", this, mNativeWindowId, mRotationAngle, oldRect.x, oldRect.y, 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); + SurfaceResized(static_cast(mWindowWidth), static_cast(mWindowHeight)); + + mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize); Dali::Window handle(this); mResizeSignal.Emit(handle, newSize); @@ -618,65 +753,112 @@ void Window::SetSize(Dali::Window::WindowSize size) mSurface->SetFullSwapNextFrame(); - Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight())); + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->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(mWindowWidth, mWindowHeight); } void Window::SetPosition(Dali::Window::WindowPosition position) { PositionSize oldRect = mSurface->GetPositionSize(); + int32_t newX = position.GetX(); + int32_t newY = position.GetY(); + + SetUserGeometryPolicy(); - mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); + mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height)); + + if((oldRect.x != newX) || (oldRect.y != newY)) + { + Dali::Window handle(this); + Dali::Window::WindowPosition newPosition(newX, newY); + + DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY()); + mMovedSignal.Emit(handle, newPosition); + } mSurface->SetFullSwapNextFrame(); - Dali::Accessibility::Accessible::Get(mScene.GetRootLayer(), true)->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); } Dali::Window::WindowPosition Window::GetPosition() const { - PositionSize positionSize = mSurface->GetPositionSize(); - + PositionSize positionSize = GetPositionSize(); return Dali::Window::WindowPosition(positionSize.x, positionSize.y); } PositionSize Window::GetPositionSize() const { - return mSurface->GetPositionSize(); + PositionSize positionSize = mSurface->GetPositionSize(); + positionSize.width = mWindowWidth; + positionSize.height = mWindowHeight; + return positionSize; } void Window::SetPositionSize(PositionSize positionSize) { - PositionSize oldRect = mSurface->GetPositionSize(); + bool moved = false; + bool resize = false; - mWindowSurface->MoveResize(positionSize); + PositionSize oldRect = GetPositionSize(); + Dali::Window handle(this); - PositionSize newRect = mSurface->GetPositionSize(); + SetUserGeometryPolicy(); + + if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y)) + { + moved = true; + } + + if((oldRect.width != positionSize.width) || (oldRect.height != positionSize.height)) + { + resize = true; + } + + if(moved || resize) + { + mWindowSurface->MoveResize(positionSize); + } + + // When window is moved, emit Moved Signal + if(moved) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, positionSize.x, positionSize.y); + Dali::Window::WindowPosition position(positionSize.x, positionSize.y); + mMovedSignal.Emit(handle, position); + } // When surface size is updated, inform adaptor of resizing and emit ResizeSignal - if((oldRect.width != newRect.width) || (oldRect.height != newRect.height)) + if(resize) { - Uint16Pair newSize(newRect.width, newRect.height); + Uint16Pair newSize(positionSize.width, positionSize.height); + + mWindowWidth = positionSize.width; + mWindowHeight = positionSize.height; - SurfaceResized(); + SurfaceResized(static_cast(mWindowWidth), static_cast(mWindowHeight)); 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); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resize signal emit [%d x %d]\n", this, mNativeWindowId, positionSize.width, positionSize.height); + 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)); + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); +} + +void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) +{ + SetUserGeometryPolicy(); + mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan); } Dali::Layer Window::GetRootLayer() const @@ -711,19 +893,28 @@ bool Window::UngrabKeyList(const Dali::Vector& key, Dali::VectorWindowHidden(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowHidden(); } + if(isActuallyChanged) + { + bridge->WindowMinimized(handle); + } + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible); } else @@ -732,45 +923,71 @@ void Window::OnIconifyChanged(bool iconified) if(mVisible) { - Dali::Window handle(this); mVisibilityChangedSignal.Emit(handle, true); + bridge->WindowShown(handle); WindowVisibilityObserver* observer(mAdaptor); observer->OnWindowShown(); } + if(isActuallyChanged) + { + bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_ICONIFY); + } + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible); } mSurface->SetFullSwapNextFrame(); } -void Window::OnFocusChanged(bool focusIn) +void Window::OnMaximizeChanged(bool maximized) { - Dali::Window handle(this); - mFocusChangeSignal.Emit(handle, focusIn); - - mSurface->SetFullSwapNextFrame(); + const bool isActuallyChanged = (maximized != mMaximized); - if(auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge()) + if(isActuallyChanged) { - if(focusIn) + auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge(); + Dali::Window handle(this); + + if(maximized) { - bridge->WindowFocused(handle); + mMaximized = true; + bridge->WindowMaximized(handle); } else { - bridge->WindowUnfocused(handle); + mMaximized = false; + bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_MAXIMIZE); } } } +void Window::OnFocusChanged(bool focusIn) +{ + Dali::Window handle(this); + mFocusChangeSignal.Emit(handle, focusIn); + + mSurface->SetFullSwapNextFrame(); + auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge(); + + if(focusIn) + { + bridge->WindowFocused(handle); + } + else + { + bridge->WindowUnfocused(handle); + } + + mFocused = focusIn; +} + void Window::OnOutputTransformed() { - PositionSize positionSize = mSurface->GetPositionSize(); + PositionSize positionSize = GetPositionSize(); - int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360; - SurfaceRotated(static_cast(positionSize.width), static_cast(positionSize.height), orientation); + SurfaceRotated(static_cast(positionSize.width), static_cast(positionSize.height), mRotationAngle, mWindowBase->GetScreenRotationAngle()); mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height)); mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height)); @@ -800,7 +1017,57 @@ void Window::OnWindowRedrawRequest() void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) { - SetPositionSize(positionSize); + bool moved = false; + bool resize = false; + + Dali::Window handle(this); + + PositionSize oldRect = GetPositionSize(); + PositionSize newRect = positionSize; + + if((oldRect.x != newRect.x) || (oldRect.y != newRect.y)) + { + moved = true; + } + + if((oldRect.width != newRect.width) || (oldRect.height != newRect.height)) + { + resize = true; + } + + if(moved || resize) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), position or size is updated by server , (%d, %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.x, newRect.y, newRect.width, newRect.height); + mWindowSurface->UpdatePositionSize(positionSize); + } + + if((oldRect.x != newRect.x) || (oldRect.y != newRect.y)) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, newRect.x, newRect.y); + Dali::Window::WindowPosition position(newRect.x, newRect.y); + mMovedSignal.Emit(handle, position); + } + + // 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); + + mWindowWidth = newRect.width; + mWindowHeight = newRect.height; + + SurfaceResized(static_cast(mWindowWidth), static_cast(mWindowHeight)); + + mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resized signal emit [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height); + mResizeSignal.Emit(handle, newSize); + mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize); + } + + mSurface->SetFullSwapNextFrame(); + + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); } void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) @@ -815,33 +1082,67 @@ void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) { + mLastKeyEvent = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass); FeedKeyEvent(keyEvent); } +void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent) +{ + Dali::Window handle(this); + + mMouseInOutEventSignal.Emit(handle, mouseInOutEvent); +} + +void Window::OnMouseRelativeEvent(const Dali::DevelWindow::MouseRelativeEvent& mouseRelativeEvent) +{ + Dali::Window handle(this); + + mMouseRelativeEventSignal.Emit(handle, mouseRelativeEvent); +} + +void Window::OnPointerConstraints(const Dali::Int32Pair& position, bool locked, bool confined) +{ + Dali::Window handle(this); + + Vector2 newPosition = RecalculatePosition(Vector2(position.GetX(), position.GetY())); + Dali::DevelWindow::PointerConstraintsEvent pointerConstraintsEvent(static_cast(newPosition.x), static_cast(newPosition.y), locked, confined); + + mPointerConstraintsSignal.Emit(handle, pointerConstraintsEvent); +} + 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; + mIsWindowRotating = true; + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), angle(%d), Window Rotation (%d , %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newPositionSize.x, newPositionSize.y, mWindowWidth, mWindowHeight); + // 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); + SurfaceRotated(static_cast(mWindowWidth), static_cast(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle()); 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); - // Emit signal Dali::Window handle(this); mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight)); + mOrientationChangedSignal.Emit(handle, GetCurrentOrientation()); mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight)); } +void Window::OnRotationFinished() +{ + mIsWindowRotating = false; + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window rotation is finised\n", this, mNativeWindowId); +} + void Window::OnPause() { if(mEventHandler) @@ -865,9 +1166,65 @@ void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value mAuxiliaryMessageSignal.Emit(key, value, options); } -void Window::RecalculateTouchPosition(Integration::Point& point) +void Window::OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets) +{ + mInsetsChangedSignal.Emit(partType, partState, insets); +} + +void Window::OnAccessibilityEnabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer); + bridge->AddTopLevelWindow(accessible); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is enabled\n", this, mNativeWindowId); + + Dali::Window handle(this); + if(!mIsEmittedWindowCreatedEvent) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Created Event\n", this, mNativeWindowId); + bridge->WindowCreated(handle); + mIsEmittedWindowCreatedEvent = true; + } + + if(!mVisible || mIconified) + { + return; + } + + bridge->WindowShown(handle); + + if(mFocused) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Focused Event\n", this, mNativeWindowId); + bridge->WindowFocused(handle); + } +} + +void Window::OnAccessibilityDisabled() +{ + auto bridge = Accessibility::Bridge::GetCurrentBridge(); + auto rootLayer = mScene.GetRootLayer(); + auto accessible = Accessibility::Accessible::Get(rootLayer); + bridge->RemoveTopLevelWindow(accessible); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Accessibility is disabled\n", this, mNativeWindowId); +} + +void Window::OnMoveCompleted(Dali::Window::WindowPosition& position) +{ + Dali::Window handle(this); + mMoveCompletedSignal.Emit(handle, position); +} + +void Window::OnResizeCompleted(Dali::Window::WindowSize& size) +{ + Dali::Window handle(this); + mResizeCompletedSignal.Emit(handle, size); +} + +Vector2 Window::RecalculatePosition(const Vector2& position) { - Vector2 position = point.GetScreenPosition(); Vector2 convertedPosition; switch(mRotationAngle) @@ -896,8 +1253,7 @@ void Window::RecalculateTouchPosition(Integration::Point& point) break; } } - - point.SetScreenPosition(convertedPosition); + return convertedPosition; } Dali::Window Window::Get(Dali::Actor actor) @@ -960,7 +1316,6 @@ Dali::Window Window::GetParent() WindowOrientation Window::GetCurrentOrientation() const { - DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), GetCurrentOrientation(): %d\n", this, mNativeWindowId, mRotationAngle); return ConvertToOrientation(mRotationAngle); } @@ -1008,11 +1363,13 @@ int32_t Window::GetNativeId() const void Window::RequestMoveToServer() { + SetUserGeometryPolicy(); mWindowBase->RequestMoveToServer(); } void Window::RequestResizeToServer(WindowResizeDirection direction) { + SetUserGeometryPolicy(); mWindowBase->RequestResizeToServer(direction); } @@ -1021,58 +1378,21 @@ void Window::EnableFloatingMode(bool enable) mWindowBase->EnableFloatingMode(enable); } -Rect Window::RecalculateRect(const Rect& rect) +bool Window::IsFloatingModeEnabled() { - 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; + return mWindowBase->IsFloatingModeEnabled(); } void Window::IncludeInputRegion(const Rect& 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); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + mWindowBase->IncludeInputRegion(inputRegion); } void Window::ExcludeInputRegion(const Rect& 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); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + mWindowBase->ExcludeInputRegion(inputRegion); } void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement) @@ -1091,6 +1411,89 @@ void Window::SendRotationCompletedAcknowledgement() } } +bool Window::IsWindowRotating() const +{ + return mIsWindowRotating; +} + +const Dali::KeyEvent& Window::GetLastKeyEvent() const +{ + return mLastKeyEvent; +} + +void Window::SetUserGeometryPolicy() +{ + if(mIsEnabledUserGeometry == true) + { + return; + } + + mIsEnabledUserGeometry = true; + AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window user.geometry is changed\n", this, mNativeWindowId); +} + +bool Window::PointerConstraintsLock() +{ + return mWindowBase->PointerConstraintsLock(); +} + +bool Window::PointerConstraintsUnlock() +{ + return mWindowBase->PointerConstraintsUnlock(); +} + +void Window::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height) +{ + mWindowBase->LockedPointerRegionSet(x, y, width, height); +} + +void Window::LockedPointerCursorPositionHintSet(int32_t x, int32_t y) +{ + mWindowBase->LockedPointerCursorPositionHintSet(x, y); +} + +bool Window::PointerWarp(int32_t x, int32_t y) +{ + return mWindowBase->PointerWarp(x, y); +} + +void Window::CursorVisibleSet(bool visible) +{ + mWindowBase->CursorVisibleSet(visible); +} + +bool Window::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return mWindowBase->KeyboardGrab(deviceSubclass); +} + +bool Window::KeyboardUnGrab() +{ + return mWindowBase->KeyboardUnGrab(); +} + +void Window::SetFullScreen(bool fullscreen) +{ + mWindowBase->SetFullScreen(fullscreen); +} + +bool Window::GetFullScreen() +{ + return mWindowBase->GetFullScreen(); +} + +void Window::SetFrontBufferRendering(bool enable) +{ + mWindowBase->SetFrontBufferRendering(enable); + mWindowSurface->SetFrontBufferRendering(enable); +} + +bool Window::GetFrontBufferRendering() +{ + return mWindowBase->GetFrontBufferRendering(); +} + } // namespace Adaptor } // namespace Internal