From: Wonsik Jung Date: Fri, 8 Oct 2021 10:53:46 +0000 (+0900) Subject: Support to get the rect value to recalulate with the default system coordinates. X-Git-Tag: dali_2.0.50~5^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=07579c03b20ab6684f57810ddc1a889f9adcc6f9 Support to get the rect value to recalulate with the default system coordinates. Some native window APIs ask the geometry value based on the default system coordinates. when the surface is rotated, current window's geometry already were set with the rotated angle. So, re-calculation is needed. Change-Id: I3b6de8acffefc9e5939a801be9badd8f608d8a98 --- diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index ce7a6a7..2396704 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -507,9 +507,11 @@ unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const void Window::SetInputRegion(const Rect& inputRegion) { - mWindowBase->SetInputRegion(inputRegion); + Rect convertRegion = RecalculateRect(inputRegion); - DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + 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); } void Window::SetType(WindowType type) @@ -1011,14 +1013,58 @@ void Window::EnableFloatingMode(bool enable) mWindowBase->EnableFloatingMode(enable); } +Rect Window::RecalculateRect(const Rect& rect) +{ + Rect 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; +} + void Window::IncludeInputRegion(const Rect& inputRegion) { - mWindowBase->IncludeInputRegion(inputRegion); + Rect 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); } void Window::ExcludeInputRegion(const Rect& inputRegion) { - mWindowBase->ExcludeInputRegion(inputRegion); + Rect 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); } void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement) diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 4287126..ef258cb 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -483,7 +483,7 @@ private: /** * @brief Called when the window is resized or moved by display server. * - * @param positionSize the updated window's position and size. + * @param[in] positionSize the updated window's position and size. */ void OnUpdatePositionSize(Dali::PositionSize& positionSize); @@ -507,6 +507,20 @@ private: */ bool IsOrientationAvailable(WindowOrientation orientation) const; + /** + * @brief Return the rect value to recalulate with the default system coordinates. + * + * Some native window APIs work the geometry value based on the default system coordinates. + * IncludeInputRegion() and ExcludeInputRegion() are one of them. + * When the window is rotated, current window's geometry already were set with the rotated angle. + * If IncludeInputRegion() or ExcludeInputRegion() are called with rotated angle by application, + * the rect's area should be re-calcuated on the default system coordinates. + * + * @param[in] rect the window's current position and size with current window rotation angle. + * @return the re-calculated rect on the default system coordinates. + */ + Rect RecalculateRect(const Rect& rect); + private: // Dali::Internal::Adaptor::SceneHolder /** * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet