From 3e6e7ff10d793c28b73fef596c63330167fafcf9 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Sat, 27 May 2023 16:01:03 +0900 Subject: [PATCH] Change window User.Geometry policy. Window is created with default size or not. If window is not created with default size or the window geometry is changed by user, the client should inform to server to use user.geometry flag. Change-Id: I19b3894fcf1cea5ac6010035dd38eb29e4c36985 --- dali/internal/window-system/common/window-impl.cpp | 44 +++++++++++++++++----- dali/internal/window-system/common/window-impl.h | 19 +++++++--- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index f1c4ac9..336fe7e 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -105,7 +105,8 @@ Window::Window() mOpaqueState(false), mWindowRotationAcknowledgement(false), mFocused(false), - mIsWindowRotating(false) + mIsWindowRotating(false), + mIsEnabledUserGeometry(false) { } @@ -169,8 +170,6 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed); mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished); - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); - SetClass(name, className); mOrientation = Orientation::New(this); @@ -187,15 +186,21 @@ 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 @@ -701,6 +706,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)) { @@ -739,6 +746,8 @@ void Window::SetPosition(Dali::Window::WindowPosition position) int32_t newX = position.GetX(); int32_t newY = position.GetY(); + SetUserGeometryPolicy(); + mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height)); if((oldRect.x != newX) || (oldRect.y != newY)) @@ -777,6 +786,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; @@ -825,6 +836,7 @@ void Window::SetPositionSize(PositionSize positionSize) 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); } @@ -1298,11 +1310,13 @@ int32_t Window::GetNativeId() const void Window::RequestMoveToServer() { + SetUserGeometryPolicy(); mWindowBase->RequestMoveToServer(); } void Window::RequestResizeToServer(WindowResizeDirection direction) { + SetUserGeometryPolicy(); mWindowBase->RequestResizeToServer(direction); } @@ -1354,6 +1368,18 @@ const Dali::TouchEvent& Window::GetLastTouchEvent() const return mLastTouchEvent; } +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); +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 407e966..3ca4cfd 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -650,6 +650,14 @@ private: */ bool IsOrientationAvailable(WindowOrientation orientation) const; + /** + * @brief Sets user geometry flag when window's geometry is changed. + * Window is created with screen size or not. + * If window is created with screen size or the geometry is changed by user, + * client should inform to server setting user.geometry flag + */ + void SetUserGeometryPolicy(); + private: // Dali::Internal::Adaptor::SceneHolder /** * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet @@ -821,10 +829,10 @@ private: std::vector mAvailableAngles; int mPreferredAngle; - int mRotationAngle; ///< The angle of the rotation - int mWindowWidth; ///< The width of the window - int mWindowHeight; ///< The height of the window - int mNativeWindowId; ///< The Native Window Id + int mRotationAngle; ///< The angle of the rotation + int mWindowWidth; ///< The width of the window + int mWindowHeight; ///< The height of the window + int mNativeWindowId; ///< The Native Window Id EventHandlerPtr mEventHandler; ///< The window events handler OrientationMode mOrientationMode; ///< The physical screen mode is portrait or landscape @@ -854,7 +862,8 @@ private: bool mOpaqueState : 1; bool mWindowRotationAcknowledgement : 1; bool mFocused : 1; - bool mIsWindowRotating : 1; ///< The window rotating flag. + bool mIsWindowRotating : 1; ///< The window rotating flag. + bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag. }; } // namespace Adaptor -- 2.7.4