From 76023088351e698316c8898e6b799f7173a93592 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 26 Feb 2025 17:55:31 +0100 Subject: [PATCH] Revert "Restrict relative mouse mode to Wayland users (#15697)" see #15761 SDL is the only device that supports relative mode and mouse input is actually somewhat broken if it's *not* enabled. This reverts commit 45c5ef87985bbaec14e8ccaa1d7ca4c9efe00260 and 88b007907a8f1a645daa850597083b796e89510e. --- irr/include/IrrlichtDevice.h | 3 --- irr/src/CIrrDeviceSDL.cpp | 9 --------- irr/src/CIrrDeviceSDL.h | 3 --- src/client/game.cpp | 16 ++-------------- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/irr/include/IrrlichtDevice.h b/irr/include/IrrlichtDevice.h index 0c422ea89..edc6ead61 100644 --- a/irr/include/IrrlichtDevice.h +++ b/irr/include/IrrlichtDevice.h @@ -198,9 +198,6 @@ public: or similar. */ virtual bool supportsTouchEvents() const { return false; } - //! Checks whether windowing uses the Wayland protocol. - virtual bool isUsingWayland() const { return false; } - //! Get the current color format of the window /** \return Color format of the window. */ virtual video::ECOLOR_FORMAT getColorFormat() const = 0; diff --git a/irr/src/CIrrDeviceSDL.cpp b/irr/src/CIrrDeviceSDL.cpp index f0f0db577..6c6b2c00f 100644 --- a/irr/src/CIrrDeviceSDL.cpp +++ b/irr/src/CIrrDeviceSDL.cpp @@ -1256,15 +1256,6 @@ bool CIrrDeviceSDL::supportsTouchEvents() const return true; } -//! Checks whether windowing uses the Wayland protocol. -bool CIrrDeviceSDL::isUsingWayland() const -{ - if (!Window) - return false; - auto *name = SDL_GetCurrentVideoDriver(); - return name && !strcmp(name, "wayland"); -} - //! returns if window is active. if not, nothing need to be drawn bool CIrrDeviceSDL::isWindowActive() const { diff --git a/irr/src/CIrrDeviceSDL.h b/irr/src/CIrrDeviceSDL.h index fcf4608be..4e7a53d9c 100644 --- a/irr/src/CIrrDeviceSDL.h +++ b/irr/src/CIrrDeviceSDL.h @@ -96,9 +96,6 @@ public: //! Checks if the Irrlicht device supports touch events. bool supportsTouchEvents() const override; - //! Checks whether windowing uses the Wayland protocol. - bool isUsingWayland() const override; - //! Get the position of this window on screen core::position2di getWindowPosition() override; diff --git a/src/client/game.cpp b/src/client/game.cpp index 968cddf01..4ad93e1ca 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -756,7 +756,6 @@ private: f32 m_repeat_dig_time; f32 m_cache_cam_smoothing; - bool m_enable_relative_mode = false; bool m_invert_mouse; bool m_enable_hotbar_mouse_wheel; bool m_invert_hotbar_mouse_wheel; @@ -900,15 +899,6 @@ bool Game::startup(bool *kill, m_first_loop_after_window_activation = true; - // In principle we could always enable relative mouse mode, but it causes weird - // bugs on some setups (e.g. #14932), so we enable it only when it's required. - // That is: on Wayland or Android, because it does not support mouse repositioning -#ifdef __ANDROID__ - m_enable_relative_mode = true; -#else - m_enable_relative_mode = device->isUsingWayland(); -#endif - g_client_translations->clear(); // address can change if simple_singleplayer_mode @@ -2361,10 +2351,8 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime) Since Minetest has its own code to synthesize mouse events from touch events, this results in duplicated input. To avoid that, we don't enable relative mouse mode if we're in touchscreen mode. */ - if (cur_control) { - cur_control->setRelativeMode(m_enable_relative_mode && - !g_touchcontrols && !isMenuActive()); - } + if (cur_control) + cur_control->setRelativeMode(!g_touchcontrols && !isMenuActive()); if ((device->isWindowActive() && device->isWindowFocused() && !isMenuActive()) || input->isRandom()) {