X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-impl.cpp;h=7c6ebfc22c4b97e313ea9be58e820cb00cf9ce08;hb=6b609829e437193b41eddfa934124fe9a42dea7f;hp=0cf5be8a5ed2637fee13a1e482ad3c6d23d84ec6;hpb=2e0025e2267d2d1545b4d1cd51a7fe562af21995;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 0cf5be8..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) 2022 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. @@ -23,13 +23,10 @@ #include #include #include -#include #include #include #include #include -#include -#include #include #include @@ -60,17 +57,18 @@ Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "L #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; } @@ -93,8 +91,13 @@ Window::Window() mAuxiliaryMessageSignal(), mMovedSignal(), mOrientationChangedSignal(), + mMouseInOutEventSignal(), + mMouseRelativeEventSignal(), + mMoveCompletedSignal(), + mResizeCompletedSignal(), + mInsetsChangedSignal(), + mPointerConstraintsSignal(), mLastKeyEvent(), - mLastTouchEvent(), mIsTransparent(false), mIsFocusAcceptable(true), mIconified(false), @@ -102,7 +105,10 @@ Window::Window() mOpaqueState(false), mWindowRotationAcknowledgement(false), mFocused(false), - mIsWindowRotating(false) + mIsWindowRotating(false), + mIsEnabledUserGeometry(false), + mIsEmittedWindowCreatedEvent(false), + mIsFrontBufferRendering(false) { } @@ -159,11 +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); @@ -181,19 +192,40 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT; } - if(positionSize.width <= 0 || positionSize.height <= 0) + mWindowWidth = positionSize.width; + mWindowHeight = positionSize.height; + + bool isSetWithScreenSize = false; + if(mWindowWidth <= 0 || mWindowHeight <= 0) { - mWindowWidth = screenWidth; - mWindowHeight = screenHeight; + mWindowWidth = screenWidth; + mWindowHeight = screenHeight; + isSetWithScreenSize = true; + DALI_LOG_RELEASE_INFO("Window size is set with screen size(%d x %d)\n", mWindowWidth, mWindowHeight); } - else + + if(isSetWithScreenSize == false || positionSize.x != 0 || positionSize.y != 0) { - mWindowWidth = positionSize.width; - mWindowHeight = positionSize.height; + 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) @@ -201,22 +233,27 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor)); mEventHandler->AddObserver(*this); - // Add Window to bridge for ATSPI - auto bridge = Accessibility::Bridge::GetCurrentBridge(); - if(bridge->IsUp()) + if(mWindowBase->GetType() == WindowType::IME) { - auto rootLayer = mScene.GetRootLayer(); - auto accessible = Accessibility::Accessible::Get(rootLayer); - bridge->AddTopLevelWindow(accessible); - - // Emit Window create event - // Create and Destory signal only emit in multi-window environment, so it does not emit on default layer. - bridge->Emit(accessible, Accessibility::WindowEvent::CREATE); + mWindowBase->InitializeIme(); + mWindowSurface->InitializeImeSurface(); } + // Add Window to bridge for ATSPI + 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. Show(); @@ -310,9 +347,19 @@ Dali::Layer Window::GetLayer(uint32_t depth) const return mScene.GetLayer(depth); } -Dali::RenderTaskList Window::GetRenderTaskList() const +void Window::KeepRendering(float durationSeconds) { - return mScene.GetRenderTaskList(); + mScene.KeepRendering(durationSeconds); +} + +void Window::SetPartialUpdateEnabled(bool enabled) +{ + mScene.SetPartialUpdateEnabled(enabled); +} + +bool Window::IsPartialUpdateEnabled() const +{ + return mScene.IsPartialUpdateEnabled(); } std::string Window::GetNativeResourceId() const @@ -594,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) @@ -683,6 +727,8 @@ void Window::SetSize(Dali::Window::WindowSize size) newRect.width = size.GetWidth(); newRect.height = size.GetHeight(); + SetUserGeometryPolicy(); + // When surface size is updated, inform adaptor of resizing and emit ResizeSignal if((oldRect.width != newRect.width) || (oldRect.height != newRect.height)) { @@ -721,7 +767,9 @@ void Window::SetPosition(Dali::Window::WindowPosition position) int32_t newX = position.GetX(); int32_t newY = position.GetY(); - mWindowSurface->MoveResize(PositionSize(newX, newY, oldRect.width, oldRect.height)); + SetUserGeometryPolicy(); + + mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height)); if((oldRect.x != newX) || (oldRect.y != newY)) { @@ -759,6 +807,8 @@ void Window::SetPositionSize(PositionSize positionSize) PositionSize oldRect = GetPositionSize(); Dali::Window handle(this); + SetUserGeometryPolicy(); + if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y)) { moved = true; @@ -805,6 +855,12 @@ void Window::SetPositionSize(PositionSize positionSize) 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 { return mScene.GetRootLayer(); @@ -1016,7 +1072,6 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) { - mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point); FeedTouchPoint(point, timeStamp); } @@ -1031,6 +1086,30 @@ void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) 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); @@ -1087,6 +1166,11 @@ void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value mAuxiliaryMessageSignal.Emit(key, value, options); } +void Window::OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets) +{ + mInsetsChangedSignal.Emit(partType, partState, insets); +} + void Window::OnAccessibilityEnabled() { auto bridge = Accessibility::Bridge::GetCurrentBridge(); @@ -1094,16 +1178,26 @@ void Window::OnAccessibilityEnabled() 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; } - Dali::Window handle(this); bridge->WindowShown(handle); if(mFocused) { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Emit Accessbility Window Focused Event\n", this, mNativeWindowId); bridge->WindowFocused(handle); } } @@ -1114,6 +1208,19 @@ void Window::OnAccessibilityDisabled() 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) @@ -1256,11 +1363,13 @@ int32_t Window::GetNativeId() const void Window::RequestMoveToServer() { + SetUserGeometryPolicy(); mWindowBase->RequestMoveToServer(); } void Window::RequestResizeToServer(WindowResizeDirection direction) { + SetUserGeometryPolicy(); mWindowBase->RequestResizeToServer(direction); } @@ -1269,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) @@ -1349,9 +1421,77 @@ const Dali::KeyEvent& Window::GetLastKeyEvent() const return mLastKeyEvent; } -const Dali::TouchEvent& Window::GetLastTouchEvent() const +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 mLastTouchEvent; + return mWindowBase->GetFrontBufferRendering(); } } // namespace Adaptor