From: Wonsik Jung Date: Fri, 23 May 2025 08:57:20 +0000 (+0900) Subject: Fix the bug about window resize/move completed signal. X-Git-Tag: dali_2.4.21~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F324708%2F7;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Fix the bug about window resize/move completed signal. Fix the bug about window resize/move completed signal. When the window resize/move completed signal work, application can not get the changed window geometry in the related signal callbacks. This patch is to fix the related bug. Change-Id: I3d0a6cc9eb7a97ee92a17d63b68512d651959e8f --- diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 0a81983eb..5d3e22ef7 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -820,64 +820,11 @@ PositionSize Window::GetPositionSize() const void Window::SetPositionSize(PositionSize positionSize) { - bool moved = false; - bool resize = false; - - PositionSize oldRect = GetPositionSize(); - Dali::Window handle(this); - 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(resize) - { - Uint16Pair newSize(positionSize.width, positionSize.height); - - mWindowWidth = positionSize.width; - mWindowHeight = positionSize.height; - - SurfaceResized(static_cast(mWindowWidth), static_cast(mWindowHeight)); - - mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize); - - 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); - } - - if((moved || resize) && Dali::Accessibility::IsUp()) - { - if(auto accessible = dynamic_cast(Accessibility::Accessible::Get(mScene.GetRootLayer()))) - { - accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); - } - } - - mSurface->SetFullSwapNextFrame(); + // It is asked by application to change window position and size. + // The related API is called to ask to display server in the backend. + UpdatePositionSize(positionSize, true); } void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) @@ -1079,63 +1026,9 @@ void Window::OnWindowRedrawRequest() void Window::OnUpdatePositionSize(Dali::PositionSize& 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); - } - - if((moved || resize) && Dali::Accessibility::IsUp()) - { - if(auto accessible = dynamic_cast(Accessibility::Accessible::Get(mScene.GetRootLayer()))) - { - accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); - } - } - - mSurface->SetFullSwapNextFrame(); + // It is from configure notification event, window move/resize signal will be emit. + // Just Update position size in window render surface without emit move/resize signal. + UpdatePositionSize(positionSize, false); } void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) @@ -1318,12 +1211,36 @@ bool Window::OnAccessibilityInterceptKeyEvent(const Dali::KeyEvent& keyEvent) void Window::OnMoveCompleted(Dali::Window::WindowPosition& position) { Dali::Window handle(this); + + PositionSize positionSize = GetPositionSize(); + positionSize.x = position.GetX(); + positionSize.y = position.GetY(); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Window move completed, (%d, %d)\n", this, mNativeWindowId, positionSize.x, positionSize.y); + + // It is from window move completed event. This event is generated by displayer server + // Window move signal is emitted, too. + // Just Update position size in window render surface without emit move/resize signal. + UpdatePositionSize(positionSize, false); + mMoveCompletedSignal.Emit(handle, position); } void Window::OnResizeCompleted(Dali::Window::WindowSize& size) { Dali::Window handle(this); + + PositionSize positionSize = GetPositionSize(); + positionSize.width = size.GetWidth(); + positionSize.height = size.GetHeight(); + + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Window resize completed, (%d x %d)\n", this, mNativeWindowId, positionSize.width, positionSize.height); + + // It is from window resized completed event. This event is generated by displayer server. + // Window resize signal is emitted, too. + // Just Update position size in window render surface without emit move/resize signal. + UpdatePositionSize(positionSize, false); + mResizeCompletedSignal.Emit(handle, size); } @@ -1683,6 +1600,77 @@ int Window::GetCurrentScreenRotationAngle() const return mWindowBase->GetScreenRotationAngle(); } +void Window::UpdatePositionSize(Dali::PositionSize& positionSize, bool requestChangeGeometry) +{ + 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) + { + if(requestChangeGeometry) + { + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), position or size is updated by Application , (%d, %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.x, newRect.y, newRect.width, newRect.height); + mWindowSurface->MoveResize(positionSize); + } + else + { + 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(moved) + { + 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(resize) + { + 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); + } + + if((moved || resize) && Dali::Accessibility::IsUp()) + { + if(auto accessible = dynamic_cast(Accessibility::Accessible::Get(mScene.GetRootLayer()))) + { + accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height)); + } + } + + mSurface->SetFullSwapNextFrame(); +} + + } // 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 944fbbbda..bb7311274 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -866,6 +866,24 @@ private: */ void OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets); + /** + * @brief Window's position and size are updated. + * It is called when window's geometry is changed by display server or client. + * + * By server, the related events are window configure notification, window move completed and window resize completed event. + * When window configure notification event is emitted, window resize and move signals are emitted to application. + * + * When window move or resize completed event is emitted, window move or resize signal is emitted to application, too. + * + * By client, application calls SetPositionSize function. + * It means application requests to change window's geometry to display server. + * Window resize and move signals are emitted to application. + * + * @param[in] positionSize the updated window's position and size. + * @param[in] requestChangeGeometry the flag of whether requests to change window geometry to display server or just updating local geometry information. + */ + void UpdatePositionSize(Dali::PositionSize& positionSize, bool requestChangeGeometry); + private: // Dali::Internal::Adaptor::SceneHolder /** * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 0d94b239b..f806f82d8 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -1936,6 +1936,9 @@ void WindowBaseEcoreWl2::OnMoveCompleted(void* event) Dali::PositionSize orgPositionSize(movedDoneEvent->x, movedDoneEvent->y, movedDoneEvent->w, movedDoneEvent->h); Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize); Dali::Int32Pair newPosition(newPositionSize.x, newPositionSize.y); + + mWindowPositionSize.x = orgPositionSize.x; + mWindowPositionSize.y = orgPositionSize.y; DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnMoveCompleted, window(%p) has been moved by server[%d, %d]\n", mEcoreWindow, newPositionSize.x, newPositionSize.y); mMoveCompletedSignal.Emit(newPosition); } @@ -1949,6 +1952,9 @@ void WindowBaseEcoreWl2::OnResizeCompleted(void* event) Dali::PositionSize orgPositionSize(resizedDoneEvent->x, resizedDoneEvent->y, resizedDoneEvent->w, resizedDoneEvent->h); Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize); Dali::Uint16Pair newSize(newPositionSize.width, newPositionSize.height); + + mWindowPositionSize.width = orgPositionSize.width; + mWindowPositionSize.height = orgPositionSize.height; DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnResizeCompleted, window(%p) has been resized by server[%d, %d]\n", mEcoreWindow, newPositionSize.width, newPositionSize.height); mResizeCompletedSignal.Emit(newSize); }