internal: cleanup CMonitor usage and fix a few ref hogs

ref #8221
This commit is contained in:
Vaxry 2024-10-26 02:06:13 +01:00
parent e5384774a8
commit d5689bb539
30 changed files with 116 additions and 118 deletions

View file

@ -43,18 +43,18 @@ class CPointerManager {
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
void resetCursorImage(bool apply = true);
void lockSoftwareForMonitor(SP<CMonitor> pMonitor);
void unlockSoftwareForMonitor(SP<CMonitor> pMonitor);
void lockSoftwareForMonitor(PHLMONITOR pMonitor);
void unlockSoftwareForMonitor(PHLMONITOR pMonitor);
void lockSoftwareAll();
void unlockSoftwareAll();
bool softwareLockedFor(SP<CMonitor> pMonitor);
bool softwareLockedFor(PHLMONITOR pMonitor);
void renderSoftwareCursorsFor(SP<CMonitor> pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
void renderSoftwareCursorsFor(PHLMONITOR pMonitor, timespec* now, CRegion& damage /* logical */, std::optional<Vector2D> overridePos = {} /* monitor-local */);
// this is needed e.g. during screensharing where
// the software cursors aren't locked during the cursor move, but they
// are rendered later.
void damageCursor(SP<CMonitor> pMonitor);
void damageCursor(PHLMONITOR pMonitor);
//
Vector2D position();
@ -78,13 +78,13 @@ class CPointerManager {
Vector2D closestValid(const Vector2D& pos);
// returns the thing in device coordinates. Is NOT offset by the hotspot, relies on set_cursor with hotspot.
Vector2D getCursorPosForMonitor(SP<CMonitor> pMonitor);
Vector2D getCursorPosForMonitor(PHLMONITOR pMonitor);
// returns the thing in logical coordinates of the monitor
CBox getCursorBoxLogicalForMonitor(SP<CMonitor> pMonitor);
CBox getCursorBoxLogicalForMonitor(PHLMONITOR pMonitor);
// returns the thing in global coords
CBox getCursorBoxGlobal();
Vector2D transformedHotspot(SP<CMonitor> pMonitor);
Vector2D transformedHotspot(PHLMONITOR pMonitor);
SP<CTexture> getCurrentCursorTexture();
@ -160,10 +160,10 @@ class CPointerManager {
Vector2D storedUnaccel = {0, 0};
struct SMonitorPointerState {
SMonitorPointerState(SP<CMonitor> m) : monitor(m) {}
SMonitorPointerState(PHLMONITOR m) : monitor(m) {}
~SMonitorPointerState() {}
WP<CMonitor> monitor;
PHLMONITORREF monitor;
int softwareLocks = 0;
bool hardwareFailed = false;
@ -176,7 +176,7 @@ class CPointerManager {
};
std::vector<SP<SMonitorPointerState>> monitorStates;
SP<SMonitorPointerState> stateFor(SP<CMonitor> mon);
SP<SMonitorPointerState> stateFor(PHLMONITOR mon);
bool attemptHardwareCursor(SP<SMonitorPointerState> state);
SP<Aquamarine::IBuffer> renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
bool setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquamarine::IBuffer> buf);