summaryrefslogtreecommitdiff
path: root/src/managers/PointerManager.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-07-21 13:09:54 +0200
committerGitHub <noreply@github.com>2024-07-21 13:09:54 +0200
commit016da234d0e852de3ef20eb2e89ac58d2a85f6e7 (patch)
tree496085987176551b0794fffc069877d44943e2f1 /src/managers/PointerManager.hpp
parentf642fb97df5c69267a03452533de383ff8023570 (diff)
Core: Move to aquamarine (#6608)
Moves Hyprland from wlroots to aquamarine for the backend. --------- Signed-off-by: Vaxry <vaxry@vaxry.net> Co-authored-by: Mihai Fufezan <mihai@fufexan.net> Co-authored-by: Jan Beich <jbeich@FreeBSD.org> Co-authored-by: vaxerski <vaxerski@users.noreply.github.com> Co-authored-by: UjinT34 <41110182+UjinT34@users.noreply.github.com> Co-authored-by: Tom Englund <tomenglund26@gmail.com> Co-authored-by: Ikalco <73481042+ikalco@users.noreply.github.com> Co-authored-by: diniamo <diniamo53@gmail.com>
Diffstat (limited to 'src/managers/PointerManager.hpp')
-rw-r--r--src/managers/PointerManager.hpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/managers/PointerManager.hpp b/src/managers/PointerManager.hpp
index da639340..cf4f1a94 100644
--- a/src/managers/PointerManager.hpp
+++ b/src/managers/PointerManager.hpp
@@ -6,13 +6,15 @@
#include "../helpers/math/Math.hpp"
#include "../helpers/math/Math.hpp"
#include "../desktop/WLSurface.hpp"
+#include "../helpers/sync/SyncTimeline.hpp"
#include <tuple>
class CMonitor;
-struct wlr_input_device;
class IHID;
class CTexture;
+AQUAMARINE_FORWARD(IBuffer);
+
/*
The naming here is a bit confusing.
CPointerManager manages the _position_ and _displaying_ of the cursor,
@@ -37,7 +39,7 @@ class CPointerManager {
void move(const Vector2D& deltaLogical);
void warpAbsolute(Vector2D abs, SP<IHID> dev);
- void setCursorBuffer(wlr_buffer* buf, const Vector2D& hotspot, const float& scale);
+ void setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2D& hotspot, const float& scale);
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
void resetCursorImage(bool apply = true);
@@ -47,6 +49,7 @@ class CPointerManager {
void unlockSoftwareForMonitor(CMonitor* pMonitor);
void lockSoftwareAll();
void unlockSoftwareAll();
+ bool softwareLockedFor(SP<CMonitor> pMonitor);
void renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
@@ -135,45 +138,42 @@ class CPointerManager {
} currentMonitorLayout;
struct {
- wlr_buffer* pBuffer = nullptr;
- SP<CTexture> bufferTex;
- WP<CWLSurface> surface;
- wlr_texture* pBufferTexture = nullptr;
-
- Vector2D hotspot;
- Vector2D size;
- float scale = 1.F;
-
- CHyprSignalListener destroySurface;
- CHyprSignalListener commitSurface;
- DYNLISTENER(destroyBuffer);
+ SP<Aquamarine::IBuffer> pBuffer;
+ SP<CTexture> bufferTex;
+ WP<CWLSurface> surface;
+
+ Vector2D hotspot;
+ Vector2D size;
+ float scale = 1.F;
+
+ CHyprSignalListener destroySurface;
+ CHyprSignalListener commitSurface;
+ SP<CSyncTimeline> waitTimeline = nullptr;
+ uint64_t waitPoint = 0;
} currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
Vector2D pointerPos = {0, 0};
struct SMonitorPointerState {
SMonitorPointerState(SP<CMonitor> m) : monitor(m) {}
- ~SMonitorPointerState() {
- if (cursorFrontBuffer)
- wlr_buffer_unlock(cursorFrontBuffer);
- }
+ ~SMonitorPointerState() {}
- WP<CMonitor> monitor;
+ WP<CMonitor> monitor;
- int softwareLocks = 0;
- bool hardwareFailed = false;
- CBox box; // logical
- bool entered = false;
- bool hwApplied = false;
+ int softwareLocks = 0;
+ bool hardwareFailed = false;
+ CBox box; // logical
+ bool entered = false;
+ bool hwApplied = false;
- wlr_buffer* cursorFrontBuffer = nullptr;
+ SP<Aquamarine::IBuffer> cursorFrontBuffer;
};
std::vector<SP<SMonitorPointerState>> monitorStates;
SP<SMonitorPointerState> stateFor(SP<CMonitor> mon);
bool attemptHardwareCursor(SP<SMonitorPointerState> state);
- wlr_buffer* renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
- bool setHWCursorBuffer(SP<SMonitorPointerState> state, wlr_buffer* buf);
+ SP<Aquamarine::IBuffer> renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
+ bool setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquamarine::IBuffer> buf);
struct {
SP<HOOK_CALLBACK_FN> monitorAdded;