diff options
author | Tom Englund <[email protected]> | 2024-08-05 19:58:21 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-05 19:58:21 +0200 |
commit | 0e86808e5912823f1c6bea1b6d5fcae297fc9f57 (patch) | |
tree | 261ff4c9a108ef9d2de1c151685d52d85405497d /src/managers/CursorManager.hpp | |
parent | 2b520571e897be2a0e88c8692da607b062000038 (diff) | |
download | Hyprland-0e86808e5912823f1c6bea1b6d5fcae297fc9f57.tar.gz Hyprland-0e86808e5912823f1c6bea1b6d5fcae297fc9f57.zip |
cursor: Better xcursor implementation (#7178)
* xcursor: bootleg xcursors into its own manager
implent XCursorManager and load themes based on librarypath and its
dir, now we catch all supplied theme files. and also implent animated
cursors. also refactor a bit of spaghetti regarding xcursors in
CursorManager.
* hyprcursor: fix buffer leak
animated cursors are creating a new buffer for each image, ensure we
drop the buffers so it continously doesnt build up in infinity.
* cursormgr: use eventloopmgr for animation
use EvenloopManager for timers instead of adding it directly to
m_sWLEventLoop and using its related wl_* functions.
Diffstat (limited to 'src/managers/CursorManager.hpp')
-rw-r--r-- | src/managers/CursorManager.hpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/managers/CursorManager.hpp b/src/managers/CursorManager.hpp index 44ab2e7b..a114b6c2 100644 --- a/src/managers/CursorManager.hpp +++ b/src/managers/CursorManager.hpp @@ -7,6 +7,8 @@ #include "../helpers/math/Math.hpp" #include "../helpers/memory/Memory.hpp" #include "../macros.hpp" +#include "managers/eventLoop/EventLoopManager.hpp" +#include "managers/XCursorManager.hpp" #include <aquamarine/buffer/Buffer.hpp> class CWLSurface; @@ -63,6 +65,8 @@ class CCursorManager { std::vector<SP<CCursorBuffer>> m_vCursorBuffers; std::unique_ptr<Hyprcursor::CHyprcursorManager> m_pHyprcursor; + std::unique_ptr<CXCursorManager> m_pXcursor; + SP<SXCursors> m_currentXcursor; std::string m_szTheme = ""; int m_iSize = 0; @@ -70,29 +74,9 @@ class CCursorManager { Hyprcursor::SCursorStyleInfo m_sCurrentStyleInfo; - wl_event_source* m_pAnimationTimer = nullptr; + SP<CEventLoopTimer> m_pAnimationTimer; int m_iCurrentAnimationFrame = 0; Hyprcursor::SCursorShapeData m_sCurrentCursorShapeData; - - // gangsta bootleg XCursor impl. Whenever Hyprland has to use - // an xcursor, just use the pointer. - struct SXCursor { - Vector2D size; - Vector2D hotspot; - std::vector<uint32_t> pixels; // XPixel is a u32 - }; - - struct SXCursorManager { - void loadTheme(const std::string& name, int size); - std::string getLegacyShapeName(std::string const& shape); - SP<SXCursor> createDefaultCursor(); - - int lastLoadSize = 0; - bool themeLoaded = false; - std::string themeName = ""; - SP<SXCursor> defaultCursor; - std::vector<std::pair<std::string, SP<SXCursor>>> cursors; - } xcursor; }; inline std::unique_ptr<CCursorManager> g_pCursorManager;
\ No newline at end of file |