summaryrefslogtreecommitdiff
path: root/src/managers/PointerManager.hpp
diff options
context:
space:
mode:
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;