From 0f54ce22bb81adbcb55c4b2e07f546d80d8c8e22 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Artur=20=C5=9Awigo=C5=84?= Date: Tue, 2 Jan 2024 10:57:57 +0100 Subject: [PATCH] [AT-SPI] Emit fewer BoundsChanged events for Window 1. Check whether the window geometry has really changed before emitting events. 2. Also check Accessibility::IsUp() beforehand. This condition is also checked internally by EmitBoundsChanged(), but too much of the Accessibility D-Bus infrastructure will have to be initialized before reaching that point in the code, and this initialization is not always needed, e.g. during early application initialization. Change-Id: I9c3898812380a4d98a0adcbe56445e6af31bf465 --- dali/internal/window-system/common/window-impl.cpp | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 3ff5ecd..e77d63e 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -757,11 +757,14 @@ void Window::SetSize(Dali::Window::WindowSize size) mResizeSignal.Emit(handle, newSize); mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize); + + if(Dali::Accessibility::IsUp()) + { + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight())); + } } mSurface->SetFullSwapNextFrame(); - - Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight())); } Dali::Window::WindowSize Window::GetSize() const @@ -786,11 +789,14 @@ void Window::SetPosition(Dali::Window::WindowPosition position) DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY()); mMovedSignal.Emit(handle, newPosition); + + if(Dali::Accessibility::IsUp()) + { + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); + } } mSurface->SetFullSwapNextFrame(); - - Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); } Dali::Window::WindowPosition Window::GetPosition() const @@ -858,9 +864,12 @@ void Window::SetPositionSize(PositionSize positionSize) mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize); } - mSurface->SetFullSwapNextFrame(); + if((moved || resize) && Dali::Accessibility::IsUp()) + { + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->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)); + mSurface->SetFullSwapNextFrame(); } void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) @@ -1073,9 +1082,12 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize); } - mSurface->SetFullSwapNextFrame(); + if((moved || resize) && Dali::Accessibility::IsUp()) + { + Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->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)); + mSurface->SetFullSwapNextFrame(); } void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) -- 2.7.4