From a162987791f2e5dec29f91f20e1ab8b9d024ce0f Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Tue, 31 May 2022 20:57:39 +0900 Subject: [PATCH] Add function to set maximum/minimum size It is to set the maximized size when window is maximized or the size is increased by RequestResizeToServer. Although the limitation is set by this function, window's size can be over the limitation by SetPositionSize() or SetSize(). The Set minimum size is similar to set maximum size. Also it is only useful for tizen world. Change-Id: Ife4e7709cc7e082ae866a187a681c0e70a488ead --- .../src/dali-adaptor/utc-Dali-Window.cpp | 34 ++++++++++++++++++++++ dali/devel-api/adaptor-framework/window-devel.cpp | 10 +++++++ dali/devel-api/adaptor-framework/window-devel.h | 24 +++++++++++++++ .../window-system/android/window-base-android.cpp | 8 +++++ .../window-system/android/window-base-android.h | 10 +++++++ dali/internal/window-system/common/window-base.h | 10 +++++++ dali/internal/window-system/common/window-impl.cpp | 10 +++++++ dali/internal/window-system/common/window-impl.h | 10 +++++++ .../internal/window-system/macos/window-base-mac.h | 10 +++++++ .../window-system/macos/window-base-mac.mm | 8 +++++ .../ecore-wl/window-base-ecore-wl.cpp | 8 +++++ .../tizen-wayland/ecore-wl/window-base-ecore-wl.h | 10 +++++++ .../ecore-wl2/window-base-ecore-wl2.cpp | 12 ++++++++ .../ecore-wl2/window-base-ecore-wl2.h | 10 +++++++ .../ubuntu-x11/window-base-ecore-x.cpp | 8 +++++ .../window-system/ubuntu-x11/window-base-ecore-x.h | 10 +++++++ .../window-system/windows/window-base-win.cpp | 8 +++++ .../window-system/windows/window-base-win.h | 10 +++++++ 18 files changed, 210 insertions(+) diff --git a/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp b/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp index 7386246..db45460 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-Window.cpp @@ -230,6 +230,23 @@ int UtcDaliWindowIsMaximizedN(void) END_TEST; } +int UtcDaliWindowSetMaximumSizeN(void) +{ + try + { + Dali::Window instance; + Dali::Window::WindowSize size(100, 100); + DevelWindow::SetMaximumSize(instance, size); + DALI_TEST_CHECK(false); // Should not reach here! + } + catch(...) + { + DALI_TEST_CHECK(true); + } + + END_TEST; +} + int UtcDaliWindowMinimizeN(void) { try @@ -262,6 +279,23 @@ int UtcDaliWindowIsMinimizedN(void) END_TEST; } +int UtcDaliWindowSetMimimumSizeN(void) +{ + try + { + Dali::Window instance; + Dali::Window::WindowSize size(100, 100); + DevelWindow::SetMimimumSize(instance, size); + DALI_TEST_CHECK(false); // Should not reach here! + } + catch(...) + { + DALI_TEST_CHECK(true); + } + + END_TEST; +} + int UtcDaliWindowAddAvailableOrientationN(void) { Dali::Window window; diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index ff7c519..c6ffb56 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -234,6 +234,11 @@ bool IsMaximized(Window window) return GetImplementation(window).IsMaximized(); } +void SetMaximumSize(Window window, Dali::Window::WindowSize size) +{ + GetImplementation(window).SetMaximumSize(size); +} + void Minimize(Window window, bool miniimize) { GetImplementation(window).Minimize(miniimize); @@ -244,6 +249,11 @@ bool IsMinimized(Window window) return GetImplementation(window).IsMinimized(); } +void SetMimimumSize(Window window, Dali::Window::WindowSize size) +{ + GetImplementation(window).SetMimimumSize(size); +} + bool IsWindowRotating(Window window) { return GetImplementation(window).IsWindowRotating(); diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 28b642c..20bcc75 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -458,6 +458,19 @@ DALI_ADAPTOR_API void Maximize(Window window, bool maximize); DALI_ADAPTOR_API bool IsMaximized(Window window); /** + * @brief Sets window's maximum size. + * + * It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer(). + * Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize(). + * + * After setting, if Maximize() is called, window is resized with the setting size and move the center. + * + * @param[in] window The window instance. + * @param[in] size the maximum size + */ +DALI_ADAPTOR_API void SetMaximumSize(Window window, Dali::Window::WindowSize size); + +/** * @brief Minimizes window's size. * If this function is called with true, window will be iconified. * Otherwise window will be activated. @@ -480,6 +493,17 @@ DALI_ADAPTOR_API void Minimize(Window window, bool minimize); DALI_ADAPTOR_API bool IsMinimized(Window window); /** + * @brief Sets window's minimum size. + * + * It is to set the minimum size when window's size is decreased by RequestResizeToServer(). + * Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize(). + * + * @param[in] window The window instance. + * @param[in] size the minimum size + */ +DALI_ADAPTOR_API void SetMimimumSize(Window window, Dali::Window::WindowSize size); + +/** * @brief Query whether window is rotating or not. * * @param[in] window The window instance. diff --git a/dali/internal/window-system/android/window-base-android.cpp b/dali/internal/window-system/android/window-base-android.cpp index 1693b34..004af89 100644 --- a/dali/internal/window-system/android/window-base-android.cpp +++ b/dali/internal/window-system/android/window-base-android.cpp @@ -201,6 +201,10 @@ bool WindowBaseAndroid::IsMaximized() const return false; } +void WindowBaseAndroid::SetMaximumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseAndroid::Minimize(bool minimize) { } @@ -210,6 +214,10 @@ bool WindowBaseAndroid::IsMinimized() const return false; } +void WindowBaseAndroid::SetMimimumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseAndroid::SetAvailableAnlges(const std::vector& angles) { } diff --git a/dali/internal/window-system/android/window-base-android.h b/dali/internal/window-system/android/window-base-android.h index cb80b83..9f1b797 100644 --- a/dali/internal/window-system/android/window-base-android.h +++ b/dali/internal/window-system/android/window-base-android.h @@ -209,6 +209,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -219,6 +224,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index 6553348..0e0091a 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -196,6 +196,11 @@ public: virtual bool IsMaximized() const = 0; /** + * @copydoc Dali::DevelWindow::SetMaximumSize() + */ + virtual void SetMaximumSize(Dali::Window::WindowSize size) = 0; + + /** * @copydoc Dali::DevelWindow::Minimize() */ virtual void Minimize(bool minimize) = 0; @@ -206,6 +211,11 @@ public: virtual bool IsMinimized() const = 0; /** + * @copydoc Dali::DevelWindow::SetMimimumSize() + */ + virtual void SetMimimumSize(Dali::Window::WindowSize size) = 0; + + /** * @copydoc Dali::Window::SetAvailableOrientations() */ virtual void SetAvailableAnlges(const std::vector& angles) = 0; diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 8b0f1f0..fa8c7c1 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -257,6 +257,11 @@ bool Window::IsMaximized() const return mWindowBase->IsMaximized(); } +void Window::SetMaximumSize(Dali::Window::WindowSize size) +{ + mWindowBase->SetMaximumSize(size); +} + void Window::Minimize(bool minimize) { mWindowBase->Minimize(minimize); @@ -269,6 +274,11 @@ bool Window::IsMinimized() const return mWindowBase->IsMinimized(); } +void Window::SetMimimumSize(Dali::Window::WindowSize size) +{ + mWindowBase->SetMimimumSize(size); +} + uint32_t Window::GetLayerCount() const { return mScene.GetLayerCount(); diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index b1fa39a..fe61dfe 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -129,6 +129,11 @@ public: bool IsMaximized() const; /** + * @copydoc Dali::DevelWindow::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size); + + /** * @copydoc Dali::DevelWindow::Minimize() */ void Minimize(bool minimize); @@ -139,6 +144,11 @@ public: bool IsMinimized() const; /** + * @copydoc Dali::DevelWindow::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size); + + /** * @copydoc Dali::Window::GetLayerCount() */ uint32_t GetLayerCount() const; diff --git a/dali/internal/window-system/macos/window-base-mac.h b/dali/internal/window-system/macos/window-base-mac.h index ef88a7b..a1d6e2d 100644 --- a/dali/internal/window-system/macos/window-base-mac.h +++ b/dali/internal/window-system/macos/window-base-mac.h @@ -138,6 +138,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -148,6 +153,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; diff --git a/dali/internal/window-system/macos/window-base-mac.mm b/dali/internal/window-system/macos/window-base-mac.mm index efadeda..7c1de56 100644 --- a/dali/internal/window-system/macos/window-base-mac.mm +++ b/dali/internal/window-system/macos/window-base-mac.mm @@ -484,6 +484,10 @@ bool WindowBaseCocoa::IsMaximized() const return false; } +void WindowBaseCocoa::SetMaximumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseCocoa::Minimize(bool minimize) { } @@ -493,6 +497,10 @@ bool WindowBaseCocoa::IsMinimized() const return false; } +void WindowBaseCocoa::SetMimimumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseCocoa::SetAvailableAnlges( const std::vector< int >& angles ) { } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp index c0b56f8..ccef811 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp @@ -1337,6 +1337,10 @@ bool WindowBaseEcoreWl::IsMaximized() const return false; } +void WindowBaseEcoreWl::SetMaximumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseEcoreWl::Minimize(bool minimize) { } @@ -1346,6 +1350,10 @@ bool WindowBaseEcoreWl::IsMinimized() const return false; } +void WindowBaseEcoreWl::SetMimimumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseEcoreWl::SetAvailableAnlges(const std::vector& angles) { int rotations[4] = {0}; diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h index f44b0c1..741224d 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h @@ -265,6 +265,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -275,6 +280,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; 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 9bc72f5..6c15aad 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 @@ -1779,6 +1779,12 @@ bool WindowBaseEcoreWl2::IsMaximized() const return ecore_wl2_window_maximized_get(mEcoreWindow); } +void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size) +{ + DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight()); + ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight()); +} + void WindowBaseEcoreWl2::Minimize(bool minimize) { ecore_wl2_window_iconified_set(mEcoreWindow, minimize); @@ -1789,6 +1795,12 @@ bool WindowBaseEcoreWl2::IsMinimized() const return ecore_wl2_window_iconified_get(mEcoreWindow); } +void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size) +{ + DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight()); + ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight()); +} + void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector& angles) { int rotations[4] = {0}; diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h index c51b563..78e2e8b 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h @@ -304,6 +304,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -314,6 +319,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp index bb1a9cb..3afc70e 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp @@ -717,6 +717,10 @@ bool WindowBaseEcoreX::IsMaximized() const return false; } +void WindowBaseEcoreX::SetMaximumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseEcoreX::Minimize(bool minimize) { } @@ -726,6 +730,10 @@ bool WindowBaseEcoreX::IsMinimized() const return false; } +void WindowBaseEcoreX::SetMimimumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseEcoreX::SetAvailableAnlges(const std::vector& angles) { } diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h index 1fff77f..5739c19 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h @@ -210,6 +210,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -220,6 +225,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index 2837754..0a66241 100644 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -323,6 +323,10 @@ bool WindowBaseWin::IsMaximized() const return false; } +void WindowBaseWin::SetMaximumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseWin::Minimize(bool minimize) { } @@ -332,6 +336,10 @@ bool WindowBaseWin::IsMinimized() const return false; } +void WindowBaseWin::SetMimimumSize(Dali::Window::WindowSize size) +{ +} + void WindowBaseWin::SetAvailableAnlges(const std::vector& angles) { } diff --git a/dali/internal/window-system/windows/window-base-win.h b/dali/internal/window-system/windows/window-base-win.h index bbc403f..1a8404a 100644 --- a/dali/internal/window-system/windows/window-base-win.h +++ b/dali/internal/window-system/windows/window-base-win.h @@ -197,6 +197,11 @@ public: bool IsMaximized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize() + */ + void SetMaximumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize() */ void Minimize(bool minimize) override; @@ -207,6 +212,11 @@ public: bool IsMinimized() const override; /** + * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize() + */ + void SetMimimumSize(Dali::Window::WindowSize size) override; + + /** * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges() */ void SetAvailableAnlges(const std::vector& angles) override; -- 2.7.4