From c4e3e3c0457f912b1a625598ff253f8011b5636b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 5 Nov 2019 20:15:28 +0100 Subject: [PATCH] Platform: deprecate Sdl2Application::setMouseLocked(). Now also handled by the new setCursor() APIs. --- doc/changelog.dox | 4 ++++ src/Magnum/Platform/Sdl2Application.cpp | 2 ++ src/Magnum/Platform/Sdl2Application.h | 23 +++++++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 4a4df3966..e6b6513cc 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -79,6 +79,10 @@ See also: related enum & getter are deprecated in favor of the new extended and more flexible @ref Platform::GlfwApplication::setCursor(). The setting didn't allow changing the cursor later, which made it pretty useless. +- @cpp Platform::Sdl2Application::Configuration::setMouseLocked() @ce and + @cpp Platform::Sdl2Application::Configuration::isMouseLocked() @ce is + deprecated in favor of the new @ref Platform::Sdl2Application::setCursor() + together with @ref Platform::Sdl2Application::Cursor::HiddenLocked @section changelog-2019-10 2019.10 diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 84b260731..3388dc1f2 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -974,6 +974,7 @@ Sdl2Application::Cursor Sdl2Application::cursor() { #endif } +#ifdef MAGNUM_BUILD_DEPRECATED void Sdl2Application::setMouseLocked(bool enabled) { /** @todo Implement this in Emscripten */ #ifndef CORRADE_TARGET_EMSCRIPTEN @@ -984,6 +985,7 @@ void Sdl2Application::setMouseLocked(bool enabled) { static_cast(enabled); #endif } +#endif bool Sdl2Application::isTextInputActive() { #ifndef CORRADE_TARGET_EMSCRIPTEN diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 1d402bf52..be0a33f89 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -854,8 +854,9 @@ class Sdl2Application { #ifndef CORRADE_TARGET_EMSCRIPTEN /** - * Hidden and locked. - * + * Hidden and locked. When the mouse is locked, only + * @ref MouseMoveEvent::relativePosition() is changing, absolute + * position stays the same. * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". */ HiddenLocked @@ -883,17 +884,23 @@ class Sdl2Application { } #endif - /** @brief Whether mouse is locked */ - bool isMouseLocked() const { return SDL_GetRelativeMouseMode(); } + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @brief Whether mouse is locked + * + * @deprecated Use @ref cursor() together with + * @ref Cursor::HiddenLocked instead. + */ + CORRADE_DEPRECATED("use cursor() together with Cursor::HiddenLocked instead") bool isMouseLocked() const { return SDL_GetRelativeMouseMode(); } /** * @brief Enable or disable mouse locking * - * When mouse is locked, the cursor is hidden and only - * @ref MouseMoveEvent::relativePosition() is changing, absolute - * position stays the same. + * @deprecated Use @ref setCursor() together with + * @ref Cursor::HiddenLocked instead. */ - void setMouseLocked(bool enabled); + CORRADE_DEPRECATED("use setCursor() together with Cursor::HiddenLocked instead") void setMouseLocked(bool enabled); + #endif private: /**