diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2024-08-16 18:00:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-16 17:00:59 +0100 |
| commit | c5feee1e357f3c3c59ebe406630601c627807963 (patch) | |
| tree | 70b2a70cb3df76787010a562ce2be6e396a69e8c /src/managers/XCursorManager.cpp | |
| parent | 1840a907a8c6b1f59cfa6738a8f46b320e8df8b1 (diff) | |
xcursormgr: dont apply scale on gsettings (#7316)
gtk scales the cursor size itself since its CSD so if we scale the size
its gonna get double scaled. incorporate the scale into xcursormanager
to keep track of it.
Diffstat (limited to 'src/managers/XCursorManager.cpp')
| -rw-r--r-- | src/managers/XCursorManager.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/managers/XCursorManager.cpp b/src/managers/XCursorManager.cpp index 0921bcd4..6f000f9f 100644 --- a/src/managers/XCursorManager.cpp +++ b/src/managers/XCursorManager.cpp @@ -100,12 +100,13 @@ CXCursorManager::CXCursorManager() { defaultCursor = hyprCursor; } -void CXCursorManager::loadTheme(std::string const& name, int size) { - if (lastLoadSize == size && themeName == name) +void CXCursorManager::loadTheme(std::string const& name, int size, float scale) { + if (lastLoadSize == (size * std::ceil(scale)) && themeName == name && lastLoadScale == scale) return; - lastLoadSize = size; - themeName = name.empty() ? "default" : name; + lastLoadSize = size * std::ceil(scale); + lastLoadScale = scale; + themeName = name.empty() ? "default" : name; defaultCursor.reset(); cursors.clear(); @@ -156,10 +157,10 @@ void CXCursorManager::loadTheme(std::string const& name, int size) { syncGsettings(); } -SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size) { +SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size, float scale) { // monitor scaling changed etc, so reload theme with new size. - if (size != lastLoadSize) - loadTheme(themeName, size); + if ((size * std::ceil(scale)) != lastLoadSize || scale != lastLoadScale) + loadTheme(themeName, size, scale); // try to get an icon we know if we have one for (auto const& c : cursors) { @@ -602,6 +603,7 @@ void CXCursorManager::syncGsettings() { g_object_unref(gsettings); }; + int unscaledSize = lastLoadSize / std::ceil(lastLoadScale); setValue("cursor-theme", themeName, "org.gnome.desktop.interface"); - setValue("cursor-size", lastLoadSize, "org.gnome.desktop.interface"); + setValue("cursor-size", unscaledSize, "org.gnome.desktop.interface"); } |
