From 8abaa77121d12f8a59737c03d581e00b7dd90b16 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 10 Apr 2024 10:22:31 +0200 Subject: Fixed the scaling of the custom cursor It appears that either SDL or the system is already taking care of scaling the cursor to the display scale (observed on both macOS and Wayland). Hence, we should only scale the cursor by the user scale and not by both. Follow-up to 6eca1b485dba7355d827745284ed2f0072f9e370. --- src/gui/gui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 93037db2..92dab954 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -56,7 +56,7 @@ gcn::Font *monoFont = nullptr; bool Gui::debugDraw; Gui::Gui(Graphics *graphics) - : mCustomCursorScale(graphics->getScale()) + : mCustomCursorScale(Client::getVideo().settings().scale()) { logger->log("Initializing GUI..."); // Set graphics @@ -186,13 +186,14 @@ void Gui::event(Event::Channel channel, const Event &event) bool Gui::videoResized(int width, int height) { - const float scale = static_cast(mGraphics)->getScale(); + const float graphicsScale = static_cast(mGraphics)->getScale(); + const float userScale = Client::getVideo().settings().scale(); - TrueTypeFont::updateFontScale(scale); + TrueTypeFont::updateFontScale(graphicsScale); - if (mCustomCursorScale != scale) + if (mCustomCursorScale != userScale) { - mCustomCursorScale = scale; + mCustomCursorScale = userScale; loadCustomCursors(); updateCursor(); } -- cgit v1.2.3-70-g09d2