From f044e4c9514ec89c4c1fc8a523ca90b8cb907fb7 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 19 Oct 2024 23:03:29 +0100 Subject: internal: Move CMonitor to SP (#8178) * move monitors to sp * XD --- src/protocols/ForeignToplevelWlr.cpp | 4 ++-- src/protocols/ForeignToplevelWlr.hpp | 2 +- src/protocols/GammaControl.cpp | 8 ++++---- src/protocols/GammaControl.hpp | 10 +++++----- src/protocols/LayerShell.cpp | 6 +++--- src/protocols/LayerShell.hpp | 2 +- src/protocols/LinuxDMABUF.cpp | 4 ++-- src/protocols/OutputManagement.cpp | 22 ++++++++++------------ src/protocols/OutputManagement.hpp | 24 ++++++++++-------------- src/protocols/OutputPower.cpp | 6 +++--- src/protocols/OutputPower.hpp | 4 ++-- src/protocols/PresentationTime.cpp | 4 ++-- src/protocols/Screencopy.cpp | 16 ++++++++-------- src/protocols/Screencopy.hpp | 6 +++--- src/protocols/SessionLock.cpp | 8 ++++---- src/protocols/SessionLock.hpp | 6 +++--- src/protocols/ToplevelExport.cpp | 2 +- src/protocols/ToplevelExport.hpp | 2 +- src/protocols/core/DataDevice.cpp | 2 +- src/protocols/core/DataDevice.hpp | 2 +- 20 files changed, 67 insertions(+), 73 deletions(-) (limited to 'src/protocols') diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index 1163a5e7..ffc335c9 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -44,7 +44,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SPm_pWorkspace != monitor->activeWorkspace) { g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->activeWorkspace); - g_pCompositor->setActiveMonitor(monitor.get()); + g_pCompositor->setActiveMonitor(monitor); } } } @@ -116,7 +116,7 @@ wl_resource* CForeignToplevelHandleWlr::res() { return resource->resource(); } -void CForeignToplevelHandleWlr::sendMonitor(CMonitor* pMonitor) { +void CForeignToplevelHandleWlr::sendMonitor(PHLMONITOR pMonitor) { if (lastMonitorID == pMonitor->ID) return; diff --git a/src/protocols/ForeignToplevelWlr.hpp b/src/protocols/ForeignToplevelWlr.hpp index e726707d..880b7a14 100644 --- a/src/protocols/ForeignToplevelWlr.hpp +++ b/src/protocols/ForeignToplevelWlr.hpp @@ -22,7 +22,7 @@ class CForeignToplevelHandleWlr { bool closed = false; MONITORID lastMonitorID = MONITOR_INVALID; - void sendMonitor(CMonitor* pMonitor); + void sendMonitor(PHLMONITOR pMonitor); void sendState(); friend class CForeignToplevelWlrManager; diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp index e794e543..14c6596f 100644 --- a/src/protocols/GammaControl.cpp +++ b/src/protocols/GammaControl.cpp @@ -143,11 +143,11 @@ void CGammaControl::applyToMonitor() { pMonitor->output->state->setGammaLut({}); } - g_pHyprRenderer->damageMonitor(pMonitor.get()); + g_pHyprRenderer->damageMonitor(pMonitor.lock()); } -CMonitor* CGammaControl::getMonitor() { - return pMonitor ? pMonitor.get() : nullptr; +PHLMONITOR CGammaControl::getMonitor() { + return pMonitor ? pMonitor.lock() : nullptr; } void CGammaControl::onMonitorDestroy() { @@ -186,7 +186,7 @@ void CGammaControlProtocol::onGetGammaControl(CZwlrGammaControlManagerV1* pMgr, } } -void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) { +void CGammaControlProtocol::applyGammaToState(PHLMONITOR pMonitor) { for (auto const& g : m_vGammaControllers) { if (g->getMonitor() != pMonitor) continue; diff --git a/src/protocols/GammaControl.hpp b/src/protocols/GammaControl.hpp index bbdc0139..5cfcd60a 100644 --- a/src/protocols/GammaControl.hpp +++ b/src/protocols/GammaControl.hpp @@ -14,13 +14,13 @@ class CGammaControl { CGammaControl(SP resource_, wl_resource* output); ~CGammaControl(); - bool good(); - void applyToMonitor(); - CMonitor* getMonitor(); + bool good(); + void applyToMonitor(); + PHLMONITOR getMonitor(); private: SP resource; - WP pMonitor; + PHLMONITORREF pMonitor; size_t gammaSize = 0; bool gammaTableSet = false; std::vector gammaTable; // [r,g,b]+ @@ -39,7 +39,7 @@ class CGammaControlProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); - void applyGammaToState(CMonitor* pMonitor); + void applyGammaToState(PHLMONITOR pMonitor); private: void onManagerResourceDestroy(wl_resource* res); diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp index c02d23f3..5ceae5f2 100644 --- a/src/protocols/LayerShell.cpp +++ b/src/protocols/LayerShell.cpp @@ -14,8 +14,8 @@ void CLayerShellResource::SState::reset() { margin = {0, 0, 0, 0}; } -CLayerShellResource::CLayerShellResource(SP resource_, SP surf_, std::string namespace_, CMonitor* pMonitor, zwlrLayerShellV1Layer layer) : - layerNamespace(namespace_), surface(surf_), resource(resource_) { +CLayerShellResource::CLayerShellResource(SP resource_, SP surf_, std::string namespace_, PHLMONITOR pMonitor, + zwlrLayerShellV1Layer layer) : layerNamespace(namespace_), surface(surf_), resource(resource_) { if (!good()) return; @@ -218,7 +218,7 @@ void CLayerShellProtocol::destroyResource(CLayerShellResource* surf) { void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id, wl_resource* surface, wl_resource* output, zwlrLayerShellV1Layer layer, std::string namespace_) { const auto CLIENT = pMgr->client(); - const auto PMONITOR = output ? CWLOutputResource::fromResource(output)->monitor.get() : nullptr; + const auto PMONITOR = output ? CWLOutputResource::fromResource(output)->monitor.lock() : nullptr; auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { diff --git a/src/protocols/LayerShell.hpp b/src/protocols/LayerShell.hpp index 801bdfd6..ad6c1a75 100644 --- a/src/protocols/LayerShell.hpp +++ b/src/protocols/LayerShell.hpp @@ -26,7 +26,7 @@ class CLayerShellRole : public ISurfaceRole { }; class CLayerShellResource { public: - CLayerShellResource(SP resource_, SP surf_, std::string namespace_, CMonitor* pMonitor, zwlrLayerShellV1Layer layer); + CLayerShellResource(SP resource_, SP surf_, std::string namespace_, PHLMONITOR pMonitor, zwlrLayerShellV1Layer layer); ~CLayerShellResource(); bool good(); diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index d9dd1d01..8e26c74f 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -452,7 +452,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const } static auto monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any param) { - auto pMonitor = std::any_cast(param); + auto pMonitor = std::any_cast(param); auto mon = pMonitor->self.lock(); auto tranche = SDMABUFTranche{ .device = mainDevice, @@ -464,7 +464,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const }); static auto monitorRemoved = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) { - auto pMonitor = std::any_cast(param); + auto pMonitor = std::any_cast(param); auto mon = pMonitor->self.lock(); std::erase_if(formatTable->monitorTranches, [mon](std::pair, SDMABUFTranche> pair) { return pair.first == mon; }); resetFormatTable(); diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp index 3fd0cf6c..77cedd41 100644 --- a/src/protocols/OutputManagement.cpp +++ b/src/protocols/OutputManagement.cpp @@ -29,12 +29,12 @@ COutputManager::COutputManager(SP resource_) : resource(re // send all heads at start for (auto const& m : g_pCompositor->m_vRealMonitors) { - if (m.get() == g_pCompositor->m_pUnsafeOutput) + if (m == g_pCompositor->m_pUnsafeOutput) continue; LOGM(LOG, " | sending output head for {}", m->szName); - makeAndSendNewHead(m.get()); + makeAndSendNewHead(m); } sendDone(); @@ -44,7 +44,7 @@ bool COutputManager::good() { return resource->resource(); } -void COutputManager::makeAndSendNewHead(CMonitor* pMonitor) { +void COutputManager::makeAndSendNewHead(PHLMONITOR pMonitor) { if (stopped) return; @@ -63,7 +63,7 @@ void COutputManager::makeAndSendNewHead(CMonitor* pMonitor) { RESOURCE->sendAllData(); } -void COutputManager::ensureMonitorSent(CMonitor* pMonitor) { +void COutputManager::ensureMonitorSent(PHLMONITOR pMonitor) { if (pMonitor == g_pCompositor->m_pUnsafeOutput) return; @@ -86,7 +86,7 @@ void COutputManager::sendDone() { resource->sendDone(wl_display_next_serial(g_pCompositor->m_sWLDisplay)); } -COutputHead::COutputHead(SP resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) { +COutputHead::COutputHead(SP resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) { if (!good()) return; @@ -105,7 +105,7 @@ COutputHead::COutputHead(SP resource_, CMonitor* pMonitor_) : m->resource->sendFinished(); } - pMonitor = nullptr; + pMonitor.reset(); for (auto const& m : PROTO::outputManagement->m_vManagers) { m->sendDone(); } @@ -221,8 +221,8 @@ void COutputHead::makeAndSendNewMode(SP mode) { RESOURCE->sendAllData(); } -CMonitor* COutputHead::monitor() { - return pMonitor; +PHLMONITOR COutputHead::monitor() { + return pMonitor.lock(); } COutputMode::COutputMode(SP resource_, SP mode_) : resource(resource_), mode(mode_) { @@ -424,14 +424,12 @@ bool COutputConfiguration::applyTestConfiguration(bool test) { return true; } -COutputConfigurationHead::COutputConfigurationHead(SP resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) { +COutputConfigurationHead::COutputConfigurationHead(SP resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) { if (!good()) return; resource->setOnDestroy([this](CZwlrOutputConfigurationHeadV1* r) { PROTO::outputManagement->destroyResource(this); }); - listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) { pMonitor = nullptr; }); - resource->setSetMode([this](CZwlrOutputConfigurationHeadV1* r, wl_resource* outputMode) { const auto MODE = PROTO::outputManagement->modeFromResource(outputMode); @@ -612,7 +610,7 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour void COutputManagementProtocol::updateAllOutputs() { for (auto const& m : g_pCompositor->m_vRealMonitors) { for (auto const& mgr : m_vManagers) { - mgr->ensureMonitorSent(m.get()); + mgr->ensureMonitorSent(m); } } } diff --git a/src/protocols/OutputManagement.hpp b/src/protocols/OutputManagement.hpp index f4a84475..6deab017 100644 --- a/src/protocols/OutputManagement.hpp +++ b/src/protocols/OutputManagement.hpp @@ -56,7 +56,7 @@ class COutputManager { COutputManager(SP resource_); bool good(); - void ensureMonitorSent(CMonitor* pMonitor); + void ensureMonitorSent(PHLMONITOR pMonitor); void sendDone(); // holds the states for this manager. @@ -70,7 +70,7 @@ class COutputManager { std::vector> heads; - void makeAndSendNewHead(CMonitor* pMonitor); + void makeAndSendNewHead(PHLMONITOR pMonitor); friend class COutputManagementProtocol; }; @@ -92,16 +92,16 @@ class COutputMode { class COutputHead { public: - COutputHead(SP resource_, CMonitor* pMonitor_); + COutputHead(SP resource_, PHLMONITOR pMonitor_); - bool good(); - void sendAllData(); // this has to be separate as we need to send the head first, then set the data - void updateMode(); - CMonitor* monitor(); + bool good(); + void sendAllData(); // this has to be separate as we need to send the head first, then set the data + void updateMode(); + PHLMONITOR monitor(); private: SP resource; - CMonitor* pMonitor = nullptr; + PHLMONITORREF pMonitor; void makeAndSendNewMode(SP mode); void sendCurrentMode(); @@ -119,7 +119,7 @@ class COutputHead { class COutputConfigurationHead { public: - COutputConfigurationHead(SP resource_, CMonitor* pMonitor_); + COutputConfigurationHead(SP resource_, PHLMONITOR pMonitor_); bool good(); @@ -127,11 +127,7 @@ class COutputConfigurationHead { private: SP resource; - CMonitor* pMonitor = nullptr; - - struct { - CHyprSignalListener monitorDestroy; - } listeners; + PHLMONITORREF pMonitor; friend class COutputConfiguration; }; diff --git a/src/protocols/OutputPower.cpp b/src/protocols/OutputPower.cpp index 0c324bf0..257155e4 100644 --- a/src/protocols/OutputPower.cpp +++ b/src/protocols/OutputPower.cpp @@ -2,7 +2,7 @@ #include "../Compositor.hpp" #include "core/Output.hpp" -COutputPower::COutputPower(SP resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) { +COutputPower::COutputPower(SP resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) { if (!resource->resource()) return; @@ -24,7 +24,7 @@ COutputPower::COutputPower(SP resource_, CMonitor* pMonitor_ resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any v) { - pMonitor = nullptr; + pMonitor.reset(); resource->sendFailed(); }); @@ -68,7 +68,7 @@ void COutputPowerProtocol::onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uin } const auto CLIENT = pMgr->client(); - const auto RESOURCE = m_vOutputPowers.emplace_back(std::make_unique(makeShared(CLIENT, pMgr->version(), id), OUTPUT->monitor.get())).get(); + const auto RESOURCE = m_vOutputPowers.emplace_back(std::make_unique(makeShared(CLIENT, pMgr->version(), id), OUTPUT->monitor.lock())).get(); if (!RESOURCE->good()) { pMgr->noMemory(); diff --git a/src/protocols/OutputPower.hpp b/src/protocols/OutputPower.hpp index 410742ca..91f2c5f3 100644 --- a/src/protocols/OutputPower.hpp +++ b/src/protocols/OutputPower.hpp @@ -11,14 +11,14 @@ class CMonitor; class COutputPower { public: - COutputPower(SP resource_, CMonitor* pMonitor); + COutputPower(SP resource_, PHLMONITOR pMonitor); bool good(); private: SP resource; - CMonitor* pMonitor = nullptr; + PHLMONITORREF pMonitor; struct { CHyprSignalListener monitorDestroy; diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp index 71f74cd5..b66694bf 100644 --- a/src/protocols/PresentationTime.cpp +++ b/src/protocols/PresentationTime.cpp @@ -73,8 +73,8 @@ void CPresentationFeedback::sendQueued(SP data, timespe CPresentationProtocol::CPresentationProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { static auto P = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) { - const auto PMONITOR = std::any_cast(param); - std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor.get() == PMONITOR; }); + const auto PMONITOR = std::any_cast(param); + std::erase_if(m_vQueue, [PMONITOR](const auto& other) { return !other->surface || other->pMonitor == PMONITOR; }); }); } diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 1b06a1fa..780c081d 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -19,7 +19,7 @@ CScreencopyFrame::CScreencopyFrame(SP resource_, int32_t return; overlayCursor = !!overlay_cursor; - pMonitor = CWLOutputResource::fromResource(output)->monitor.get(); + pMonitor = CWLOutputResource::fromResource(output)->monitor; if (!pMonitor) { LOGM(ERR, "Client requested sharing of a monitor that doesnt exist"); @@ -38,7 +38,7 @@ CScreencopyFrame::CScreencopyFrame(SP resource_, int32_t g_pHyprRenderer->makeEGLCurrent(); - shmFormat = g_pHyprOpenGL->getPreferredReadFormat(pMonitor); + shmFormat = g_pHyprOpenGL->getPreferredReadFormat(pMonitor.lock()); if (shmFormat == DRM_FORMAT_INVALID) { LOGM(ERR, "No format supported by renderer in capture output"); resource->sendFailed(); @@ -87,7 +87,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_ return; } - if (!g_pCompositor->monitorExists(pMonitor)) { + if (!g_pCompositor->monitorExists(pMonitor.lock())) { LOGM(ERR, "Client requested sharing of a monitor that is gone"); resource->sendFailed(); PROTO::screencopy->destroyResource(this); @@ -165,7 +165,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_ } if (!withDamage) - g_pHyprRenderer->damageMonitor(pMonitor); + g_pHyprRenderer->damageMonitor(pMonitor.lock()); } void CScreencopyFrame::share() { @@ -205,7 +205,7 @@ bool CScreencopyFrame::copyDmabuf() { CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX}; - if (!g_pHyprRenderer->beginRender(pMonitor, fakeDamage, RENDER_MODE_TO_BUFFER, buffer.lock(), nullptr, true)) { + if (!g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_TO_BUFFER, buffer.lock(), nullptr, true)) { LOGM(ERR, "Can't copy: failed to begin rendering to dma frame"); return false; } @@ -240,7 +240,7 @@ bool CScreencopyFrame::copyShm() { CFramebuffer fb; fb.alloc(box.w, box.h, pMonitor->output->state->state().drmFormat); - if (!g_pHyprRenderer->beginRender(pMonitor, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb, true)) { + if (!g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb, true)) { LOGM(ERR, "Can't copy: failed to begin rendering"); return false; } @@ -288,7 +288,7 @@ bool CScreencopyFrame::copyShm() { } } - g_pHyprOpenGL->m_RenderData.pMonitor = nullptr; + g_pHyprOpenGL->m_RenderData.pMonitor.reset(); LOGM(TRACE, "Copied frame via shm"); @@ -402,7 +402,7 @@ void CScreencopyProtocol::destroyResource(CScreencopyFrame* frame) { std::erase_if(m_vFramesAwaitingWrite, [&](const auto& other) { return !other || other.get() == frame; }); } -void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) { +void CScreencopyProtocol::onOutputCommit(PHLMONITOR pMonitor) { if (m_vFramesAwaitingWrite.empty()) { g_pHyprRenderer->m_bDirectScanoutBlocked = false; return; // nothing to share diff --git a/src/protocols/Screencopy.hpp b/src/protocols/Screencopy.hpp index e121d0fd..62c9f8b8 100644 --- a/src/protocols/Screencopy.hpp +++ b/src/protocols/Screencopy.hpp @@ -60,7 +60,7 @@ class CScreencopyFrame { private: SP resource; - CMonitor* pMonitor = nullptr; + PHLMONITORREF pMonitor; bool overlayCursor = false; bool withDamage = false; bool lockedSWCursors = false; @@ -88,7 +88,7 @@ class CScreencopyProtocol : public IWaylandProtocol { void destroyResource(CScreencopyClient* resource); void destroyResource(CScreencopyFrame* resource); - void onOutputCommit(CMonitor* pMonitor); + void onOutputCommit(PHLMONITOR pMonitor); private: std::vector> m_vFrames; @@ -98,7 +98,7 @@ class CScreencopyProtocol : public IWaylandProtocol { SP m_pSoftwareCursorTimer; bool m_bTimerArmed = false; - void shareAllFrames(CMonitor* pMonitor); + void shareAllFrames(PHLMONITOR pMonitor); void shareFrame(CScreencopyFrame* frame); void sendFrameDamage(CScreencopyFrame* frame); bool copyFrameDmabuf(CScreencopyFrame* frame); diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp index b1f701bf..642a5b89 100644 --- a/src/protocols/SessionLock.cpp +++ b/src/protocols/SessionLock.cpp @@ -5,7 +5,7 @@ #include "core/Compositor.hpp" #include "core/Output.hpp" -CSessionLockSurface::CSessionLockSurface(SP resource_, SP surface_, CMonitor* pMonitor_, WP owner_) : +CSessionLockSurface::CSessionLockSurface(SP resource_, SP surface_, PHLMONITOR pMonitor_, WP owner_) : resource(resource_), sessionLock(owner_), pSurface(surface_), pMonitor(pMonitor_) { if (!resource->resource()) return; @@ -82,8 +82,8 @@ bool CSessionLockSurface::inert() { return sessionLock.expired(); } -CMonitor* CSessionLockSurface::monitor() { - return pMonitor; +PHLMONITOR CSessionLockSurface::monitor() { + return pMonitor.lock(); } SP CSessionLockSurface::surface() { @@ -184,7 +184,7 @@ void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id LOGM(LOG, "New sessionLockSurface with id {}", id); auto PSURFACE = CWLSurfaceResource::fromResource(surface); - auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.get(); + auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.lock(); SP sessionLock; for (auto const& l : m_vLocks) { diff --git a/src/protocols/SessionLock.hpp b/src/protocols/SessionLock.hpp index a0c67e88..a1df6fcf 100644 --- a/src/protocols/SessionLock.hpp +++ b/src/protocols/SessionLock.hpp @@ -13,12 +13,12 @@ class CWLSurfaceResource; class CSessionLockSurface { public: - CSessionLockSurface(SP resource_, SP surface_, CMonitor* pMonitor_, WP owner_); + CSessionLockSurface(SP resource_, SP surface_, PHLMONITOR pMonitor_, WP owner_); ~CSessionLockSurface(); bool good(); bool inert(); - CMonitor* monitor(); + PHLMONITOR monitor(); SP surface(); struct { @@ -31,7 +31,7 @@ class CSessionLockSurface { SP resource; WP sessionLock; WP pSurface; - CMonitor* pMonitor = nullptr; + PHLMONITORREF pMonitor; bool ackdConfigure = false; bool committed = false; diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 66df5926..8b6208be 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -362,7 +362,7 @@ void CToplevelExportProtocol::destroyResource(CToplevelExportFrame* frame) { std::erase_if(m_vFramesAwaitingWrite, [&](const auto& other) { return !other || other.get() == frame; }); } -void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) { +void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) { if (m_vFramesAwaitingWrite.empty()) return; // nothing to share diff --git a/src/protocols/ToplevelExport.hpp b/src/protocols/ToplevelExport.hpp index 9686431b..bcfa161c 100644 --- a/src/protocols/ToplevelExport.hpp +++ b/src/protocols/ToplevelExport.hpp @@ -80,7 +80,7 @@ class CToplevelExportProtocol : IWaylandProtocol { void destroyResource(CToplevelExportFrame* frame); void onWindowUnmap(PHLWINDOW pWindow); - void onOutputCommit(CMonitor* pMonitor); + void onOutputCommit(PHLMONITOR pMonitor); private: std::vector> m_vClients; diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index 5644f243..056a72c4 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -681,7 +681,7 @@ void CWLDataDeviceProtocol::abortDrag() { g_pSeatManager->resendEnterEvents(); } -void CWLDataDeviceProtocol::renderDND(CMonitor* pMonitor, timespec* when) { +void CWLDataDeviceProtocol::renderDND(PHLMONITOR pMonitor, timespec* when) { if (!dnd.dndSurface || !dnd.dndSurface->current.texture) return; diff --git a/src/protocols/core/DataDevice.hpp b/src/protocols/core/DataDevice.hpp index 50e9ac61..81ca1b11 100644 --- a/src/protocols/core/DataDevice.hpp +++ b/src/protocols/core/DataDevice.hpp @@ -131,7 +131,7 @@ class CWLDataDeviceProtocol : public IWaylandProtocol { virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); // renders and damages the dnd icon, if present - void renderDND(CMonitor* pMonitor, timespec* when); + void renderDND(PHLMONITOR pMonitor, timespec* when); // for inputmgr to force refocus // TODO: move handling to seatmgr bool dndActive(); -- cgit v1.2.3