/*
- * 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.
mKeyboardRepeatSettingsChangedSignal(),
mAuxiliaryMessageSignal(),
mMovedSignal(),
+ mOrientationChangedSignal(),
+ mMouseInOutEventSignal(),
+ mMoveCompletedSignal(),
+ mResizeCompletedSignal(),
+ mInsetsChangedSignal(),
mLastKeyEvent(),
mLastTouchEvent(),
mIsTransparent(false),
bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
}
- if(mAdaptor)
+ if(DALI_LIKELY(mAdaptor))
{
mAdaptor->RemoveWindow(this);
}
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->MoveCompletedSignal().Connect(this, &Window::OnMoveCompleted);
+ mWindowBase->ResizeCompletedSignal().Connect(this, &Window::OnResizeCompleted);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
+ mWindowBase->InsetsChangedSignal().Connect(this, &Window::OnInsetsChanged);
+
AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
SetClass(name, className);
mNativeWindowId = mWindowBase->GetNativeWindowId();
}
+void Window::SetRenderNotification(TriggerEventInterface* renderNotification)
+{
+ if(!mWindowSurface)
+ {
+ return;
+ }
+
+ mWindowSurface->SetRenderNotification(renderNotification);
+}
+
void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
{
mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
void Window::SetInputRegion(const Rect<int>& inputRegion)
{
- Rect<int> 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)
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)
+{
+ mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
+}
+
Dali::Layer Window::GetRootLayer() const
{
return mScene.GetRootLayer();
mVisibilityChangedSignal.Emit(handle, false);
Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowHidden();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowHidden();
+ }
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
mVisibilityChangedSignal.Emit(handle, true);
Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
- WindowVisibilityObserver* observer(mAdaptor);
- observer->OnWindowShown();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ WindowVisibilityObserver* observer(mAdaptor);
+ observer->OnWindowShown();
+ }
}
DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(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));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ }
}
void Window::OnDeleteRequest()
void Window::OnWindowRedrawRequest()
{
- mAdaptor->RenderOnce();
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->RenderOnce();
+ }
}
void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
- mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
+ if(DALI_LIKELY(mAdaptor))
+ {
+ 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);
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
+ }
}
mSurface->SetFullSwapNextFrame();
- Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
+ if(DALI_LIKELY(mScene))
+ {
+ 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)
FeedKeyEvent(keyEvent);
}
+void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent)
+{
+ Dali::Window handle(this);
+
+ mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
+}
+
void Window::OnRotation(const RotationEvent& rotation)
{
PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
SurfaceRotated(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle());
- mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+ }
Dali::Window handle(this);
mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
+ mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
- mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+ if(DALI_LIKELY(mAdaptor))
+ {
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
+ }
}
void Window::OnRotationFinished()
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();
bridge->RemoveTopLevelWindow(accessible);
}
+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 convertedPosition;
mWindowBase->EnableFloatingMode(enable);
}
-Rect<int> Window::RecalculateRect(const Rect<int>& rect)
+bool Window::IsFloatingModeEnabled()
{
- 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;
+ return mWindowBase->IsFloatingModeEnabled();
}
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);
+ 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<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);
+ 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)