From 935c0efc8a8f559eb3afad650e302219032fff24 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Thu, 13 May 2021 17:35:53 +0900 Subject: [PATCH] [Tizen] Modify window configure notification event callback Modify configure notification event callback for window is resized or moved. This evnet is sent from the display server. If the event has 0'size, the window is resized by client application. In this case, dali should ignore that. If the event has real size size, the window is resized by display server. In this case, dali should resize own's window buffer and re-render his contents. Change-Id: Ide3d7c0fb2ad133b444a9bc66f8281c6c2906c45 --- dali/internal/window-system/common/window-base.cpp | 9 +++++- dali/internal/window-system/common/window-base.h | 8 ++++++ dali/internal/window-system/common/window-impl.cpp | 31 +++++---------------- dali/internal/window-system/common/window-impl.h | 8 +++++- .../window-system/common/window-render-surface.cpp | 8 +++--- .../ecore-wl2/window-base-ecore-wl2.cpp | 32 +++++++++++++++++++++- 6 files changed, 65 insertions(+), 31 deletions(-) diff --git a/dali/internal/window-system/common/window-base.cpp b/dali/internal/window-system/common/window-base.cpp index 867b72a..659ad2c 100644 --- a/dali/internal/window-system/common/window-base.cpp +++ b/dali/internal/window-system/common/window-base.cpp @@ -39,7 +39,8 @@ WindowBase::WindowBase() mStyleChangedSignal(), mAccessibilitySignal(), mTransitionEffectEventSignal(), - mKeyboardRepeatSettingsChangedSignal() + mKeyboardRepeatSettingsChangedSignal(), + mUpdatePositionSizeSignal() { } @@ -127,6 +128,12 @@ WindowBase::WindowRedrawRequestSignalType& WindowBase::WindowRedrawRequestSignal return mWindowRedrawRequestSignal; } +WindowBase::UpdatePositionSizeType& WindowBase::UpdatePositionSizeSignal() +{ + return mUpdatePositionSizeSignal; +} + + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index 62a70ed..0c0d896 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -72,6 +72,7 @@ public: typedef Signal TransitionEffectEventSignalType; typedef Signal KeyboardRepeatSettingsChangedSignalType; typedef Signal WindowRedrawRequestSignalType; + typedef Signal UpdatePositionSizeType; // Input events typedef Signal TouchEventSignalType; @@ -435,6 +436,11 @@ public: */ WindowRedrawRequestSignalType& WindowRedrawRequestSignal(); + /** + * @brief This signal is emitted when the window is resized or moved by display server. + */ + UpdatePositionSizeType& UpdatePositionSizeSignal(); + protected: // Undefined WindowBase(const WindowBase&) = delete; @@ -459,6 +465,8 @@ protected: TransitionEffectEventSignalType mTransitionEffectEventSignal; KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal; WindowRedrawRequestSignalType mWindowRedrawRequestSignal; + UpdatePositionSizeType mUpdatePositionSizeSignal; + }; } // namespace Adaptor diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index fe37203..69e75de 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -79,7 +79,6 @@ Window::Window() mIsFocusAcceptable(true), mIconified(false), mOpaqueState(false), - mResizeEnabled(false), mType(WindowType::NORMAL), mParentWindow(NULL), mPreferredAngle(static_cast(WindowOrientation::NO_ORIENTATION_PREFERENCE)), @@ -132,14 +131,11 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent); mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged); mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest); + mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize); mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed); - if(!positionSize.IsEmpty()) - { - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); - mResizeEnabled = true; - } + AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); SetClass(name, className); @@ -579,12 +575,6 @@ int Window::GetBrightness() const void Window::SetSize(Dali::Window::WindowSize size) { - if(!mResizeEnabled) - { - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); - mResizeEnabled = true; - } - PositionSize oldRect = mSurface->GetPositionSize(); mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight())); @@ -620,12 +610,6 @@ Dali::Window::WindowSize Window::GetSize() const void Window::SetPosition(Dali::Window::WindowPosition position) { - if(!mResizeEnabled) - { - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); - mResizeEnabled = true; - } - PositionSize oldRect = mSurface->GetPositionSize(); mWindowSurface->MoveResize(PositionSize(position.GetX(), position.GetY(), oldRect.width, oldRect.height)); @@ -642,12 +626,6 @@ Dali::Window::WindowPosition Window::GetPosition() const void Window::SetPositionSize(PositionSize positionSize) { - if(!mResizeEnabled) - { - AddAuxiliaryHint("wm.policy.win.user.geometry", "1"); - mResizeEnabled = true; - } - PositionSize oldRect = mSurface->GetPositionSize(); mWindowSurface->MoveResize(positionSize); @@ -796,6 +774,11 @@ void Window::OnWindowRedrawRequest() mAdaptor->RenderOnce(); } +void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) +{ + SetPositionSize(positionSize); +} + void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) { FeedTouchPoint(point, timeStamp); diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index cb27eb1..7b20b58 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -434,6 +434,13 @@ private: void OnWindowRedrawRequest(); /** + * @brief Called when the window is resized or moved by display server. + * + * @param positionSize the updated window's position and size. + */ + void OnUpdatePositionSize(Dali::PositionSize& positionSize); + + /** * @brief Set available orientation to window base. */ void SetAvailableAnlges(const std::vector& angles); @@ -566,7 +573,6 @@ private: bool mIsFocusAcceptable : 1; bool mIconified : 1; bool mOpaqueState : 1; - bool mResizeEnabled : 1; WindowType mType; Dali::Window mParentWindow; diff --git a/dali/internal/window-system/common/window-render-surface.cpp b/dali/internal/window-system/common/window-render-surface.cpp index b5fffa8..98afcfc 100644 --- a/dali/internal/window-system/common/window-render-surface.cpp +++ b/dali/internal/window-system/common/window-render-surface.cpp @@ -344,15 +344,15 @@ void WindowRenderSurface::MoveResize(Dali::PositionSize positionSize) bool needToResize = false; // Check moving - if((fabs(positionSize.x - mPositionSize.x) > MINIMUM_DIMENSION_CHANGE) || - (fabs(positionSize.y - mPositionSize.y) > MINIMUM_DIMENSION_CHANGE)) + if((fabs(positionSize.x - mPositionSize.x) >= MINIMUM_DIMENSION_CHANGE) || + (fabs(positionSize.y - mPositionSize.y) >= MINIMUM_DIMENSION_CHANGE)) { needToMove = true; } // Check resizing - if((fabs(positionSize.width - mPositionSize.width) > MINIMUM_DIMENSION_CHANGE) || - (fabs(positionSize.height - mPositionSize.height) > MINIMUM_DIMENSION_CHANGE)) + if((fabs(positionSize.width - mPositionSize.width) >= MINIMUM_DIMENSION_CHANGE) || + (fabs(positionSize.height - mPositionSize.height) >= MINIMUM_DIMENSION_CHANGE)) { needToResize = true; } 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 4c91c35..f54c22b 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 @@ -1004,10 +1004,40 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event) { Ecore_Wl2_Event_Window_Configure* ev(static_cast(event)); - if(ev->win == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) + if(ev && ev->win == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) { // Note: To comply with the wayland protocol, Dali should make an ack_configure // by calling ecore_wl2_window_commit + + int tempWidth = static_cast(ev->w); + int tempHeight = static_cast(ev->h); + + // Initialize with previous size for skip resize when new size is 0. + // When window is just moved or window is resized by client application, + // The configure notification event's size will be 0. + // If new size is 0, the resized work should be skip. + int newWidth = mWindowPositionSize.width; + int newHeight = mWindowPositionSize.height; + bool windowMoved = false, windowResized = false; + + if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y) + { + windowMoved = true; + } + + if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height)) + { + windowResized = true; + newWidth = tempWidth; + newHeight = tempHeight; + } + + if(windowMoved || windowResized) + { + Dali::PositionSize newPositionSize(ev->x, ev->y, newWidth, newHeight); + mUpdatePositionSizeSignal.Emit(newPositionSize); + } + ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE); } } -- 2.7.4