diff --git a/borders-plus-plus/borderDeco.cpp b/borders-plus-plus/borderDeco.cpp index df57c4c..dc95a2c 100644 --- a/borders-plus-plus/borderDeco.cpp +++ b/borders-plus-plus/borderDeco.cpp @@ -59,7 +59,7 @@ std::string CBordersPlusPlus::getDisplayName() { return "Borders++"; } -void CBordersPlusPlus::draw(CMonitor* pMonitor, float a) { +void CBordersPlusPlus::draw(PHLMONITOR pMonitor, float a) { if (!validMapped(m_pWindow)) return; @@ -91,18 +91,18 @@ void CBordersPlusPlus::draw(CMonitor* pMonitor, float a) { auto rounding = PWINDOW->rounding() == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale; const auto ORIGINALROUND = rounding == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale; - CBox fullBox = m_bAssignedGeometry; + CBox fullBox = m_bAssignedGeometry; fullBox.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_pWindow.lock())); fullBox.translate(PWINDOW->m_vFloatingOffset - pMonitor->vecPosition + WORKSPACEOFFSET); if (fullBox.width < 1 || fullBox.height < 1) - return; + return; double fullThickness = 0; for (size_t i = 0; i < **PBORDERS; ++i) { - const int THISBORDERSIZE = **(PSIZES[i]) == -1 ? **PBORDERSIZE : (**PSIZES[i]); + const int THISBORDERSIZE = **(PSIZES[i]) == -1 ? **PBORDERSIZE : (**PSIZES[i]); fullThickness += THISBORDERSIZE; } diff --git a/borders-plus-plus/borderDeco.hpp b/borders-plus-plus/borderDeco.hpp index 2f0b2f1..7a61333 100644 --- a/borders-plus-plus/borderDeco.hpp +++ b/borders-plus-plus/borderDeco.hpp @@ -13,7 +13,7 @@ class CBordersPlusPlus : public IHyprWindowDecoration { virtual void onPositioningReply(const SDecorationPositioningReply& reply); - virtual void draw(CMonitor*, float a); + virtual void draw(PHLMONITOR, float a); virtual eDecorationType getDecorationType(); diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 0cc7514..1e9e1d3 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -383,7 +383,7 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float } } -void CHyprBar::draw(CMonitor* pMonitor, float a) { +void CHyprBar::draw(PHLMONITOR pMonitor, float a) { if (m_bHidden || !validMapped(m_pWindow)) return; diff --git a/hyprbars/barDeco.hpp b/hyprbars/barDeco.hpp index c75d0ec..8f34c32 100644 --- a/hyprbars/barDeco.hpp +++ b/hyprbars/barDeco.hpp @@ -16,7 +16,7 @@ class CHyprBar : public IHyprWindowDecoration { virtual void onPositioningReply(const SDecorationPositioningReply& reply); - virtual void draw(CMonitor*, float a); + virtual void draw(PHLMONITOR, float a); virtual eDecorationType getDecorationType(); diff --git a/hyprexpo/main.cpp b/hyprexpo/main.cpp index b5d8da8..ef52f0a 100644 --- a/hyprexpo/main.cpp +++ b/hyprexpo/main.cpp @@ -14,9 +14,9 @@ inline CFunctionHook* g_pRenderWorkspaceHook = nullptr; inline CFunctionHook* g_pAddDamageHookA = nullptr; inline CFunctionHook* g_pAddDamageHookB = nullptr; -typedef void (*origRenderWorkspace)(void*, CMonitor*, PHLWORKSPACE, timespec*, const CBox&); -typedef void (*origAddDamageA)(void*, const CBox*); -typedef void (*origAddDamageB)(void*, const pixman_region32_t*); +typedef void (*origRenderWorkspace)(void*, PHLMONITOR, PHLWORKSPACE, timespec*, const CBox&); +typedef void (*origAddDamageA)(void*, const CBox*); +typedef void (*origAddDamageB)(void*, const pixman_region32_t*); // Do NOT change this function. APICALL EXPORT std::string PLUGIN_API_VERSION() { @@ -26,7 +26,7 @@ APICALL EXPORT std::string PLUGIN_API_VERSION() { static bool renderingOverview = false; // -static void hkRenderWorkspace(void* thisptr, CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* now, const CBox& geometry) { +static void hkRenderWorkspace(void* thisptr, PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, timespec* now, const CBox& geometry) { if (!g_pOverview || renderingOverview || g_pOverview->blockOverviewRendering || g_pOverview->pMonitor != pMonitor) ((origRenderWorkspace)(g_pRenderWorkspaceHook->m_pOriginal))(thisptr, pMonitor, pWorkspace, now, geometry); else @@ -36,7 +36,7 @@ static void hkRenderWorkspace(void* thisptr, CMonitor* pMonitor, PHLWORKSPACE pW static void hkAddDamageA(void* thisptr, const CBox* box) { const auto PMONITOR = (CMonitor*)thisptr; - if (!g_pOverview || g_pOverview->pMonitor != PMONITOR || g_pOverview->blockDamageReporting) { + if (!g_pOverview || g_pOverview->pMonitor != PMONITOR->self || g_pOverview->blockDamageReporting) { ((origAddDamageA)g_pAddDamageHookA->m_pOriginal)(thisptr, box); return; } @@ -47,7 +47,7 @@ static void hkAddDamageA(void* thisptr, const CBox* box) { static void hkAddDamageB(void* thisptr, const pixman_region32_t* rg) { const auto PMONITOR = (CMonitor*)thisptr; - if (!g_pOverview || g_pOverview->pMonitor != PMONITOR || g_pOverview->blockDamageReporting) { + if (!g_pOverview || g_pOverview->pMonitor != PMONITOR->self || g_pOverview->blockDamageReporting) { ((origAddDamageB)g_pAddDamageHookB->m_pOriginal)(thisptr, rg); return; } diff --git a/hyprexpo/overview.cpp b/hyprexpo/overview.cpp index 63f123d..12b7ed1 100644 --- a/hyprexpo/overview.cpp +++ b/hyprexpo/overview.cpp @@ -18,11 +18,11 @@ COverview::~COverview() { g_pHyprRenderer->makeEGLCurrent(); images.clear(); // otherwise we get a vram leak g_pInputManager->unsetCursorImage(); - g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor); + g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor.lock()); } COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn_), swipe(swipe_) { - const auto PMONITOR = g_pCompositor->m_pLastMonitor.get(); + const auto PMONITOR = g_pCompositor->m_pLastMonitor.lock(); pMonitor = PMONITOR; static auto* const* PCOLUMNS = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprexpo:columns")->getDataStaticPtr(); @@ -242,7 +242,7 @@ void COverview::redrawID(int id, bool forcelowres) { } CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX}; - g_pHyprRenderer->beginRender(pMonitor, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb); + g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &image.fb); g_pHyprOpenGL->clear(CColor{0, 0, 0, 1.0}); @@ -262,7 +262,7 @@ void COverview::redrawID(int id, bool forcelowres) { if (PWORKSPACE == startedOn) pMonitor->activeSpecialWorkspace = openSpecial; - g_pHyprRenderer->renderWorkspace(pMonitor, PWORKSPACE, &now, monbox); + g_pHyprRenderer->renderWorkspace(pMonitor.lock(), PWORKSPACE, &now, monbox); PWORKSPACE->m_bVisible = false; PWORKSPACE->startAnim(false, false, true); @@ -270,7 +270,7 @@ void COverview::redrawID(int id, bool forcelowres) { if (PWORKSPACE == startedOn) pMonitor->activeSpecialWorkspace.reset(); } else - g_pHyprRenderer->renderWorkspace(pMonitor, PWORKSPACE, &now, monbox); + g_pHyprRenderer->renderWorkspace(pMonitor.lock(), PWORKSPACE, &now, monbox); g_pHyprOpenGL->m_RenderData.blockScreenShader = true; g_pHyprRenderer->endRender(); @@ -291,7 +291,7 @@ void COverview::redrawAll(bool forcelowres) { void COverview::damage() { blockDamageReporting = true; - g_pHyprRenderer->damageMonitor(pMonitor); + g_pHyprRenderer->damageMonitor(pMonitor.lock()); blockDamageReporting = false; } @@ -312,7 +312,7 @@ void COverview::onDamageReported() { blockDamageReporting = true; g_pHyprRenderer->damageBox(&texbox); blockDamageReporting = false; - g_pCompositor->scheduleFrameForMonitor(pMonitor); + g_pCompositor->scheduleFrameForMonitor(pMonitor.lock()); } void COverview::close() { diff --git a/hyprexpo/overview.hpp b/hyprexpo/overview.hpp index 6a862f9..46473da 100644 --- a/hyprexpo/overview.hpp +++ b/hyprexpo/overview.hpp @@ -29,12 +29,12 @@ class COverview { void onSwipeEnd(); // close without a selection - void close(); + void close(); - bool blockOverviewRendering = false; - bool blockDamageReporting = false; + bool blockOverviewRendering = false; + bool blockDamageReporting = false; - CMonitor* pMonitor = nullptr; + PHLMONITORREF pMonitor; private: void redrawID(int id, bool forcelowres = false); diff --git a/hyprtrails/trail.cpp b/hyprtrails/trail.cpp index 9615256..bb4afd0 100644 --- a/hyprtrails/trail.cpp +++ b/hyprtrails/trail.cpp @@ -78,7 +78,7 @@ Vector2D vecForBezierT(const float& t, const std::vector& verts) { return pts[0]; } -void CTrail::draw(CMonitor* pMonitor, float a) { +void CTrail::draw(PHLMONITOR pMonitor, float a) { if (!validMapped(m_pWindow)) return; diff --git a/hyprtrails/trail.hpp b/hyprtrails/trail.hpp index 8ac531c..df8e63a 100644 --- a/hyprtrails/trail.hpp +++ b/hyprtrails/trail.hpp @@ -37,7 +37,7 @@ class CTrail : public IHyprWindowDecoration { virtual void onPositioningReply(const SDecorationPositioningReply& reply); - virtual void draw(CMonitor*, float a); + virtual void draw(PHLMONITOR, float a); virtual eDecorationType getDecorationType(); diff --git a/hyprwinwrap/main.cpp b/hyprwinwrap/main.cpp index 2bcf870..4d8ed98 100644 --- a/hyprwinwrap/main.cpp +++ b/hyprwinwrap/main.cpp @@ -82,7 +82,7 @@ void onRenderStage(eRenderStage stage) { // cant use setHidden cuz that sends suspended and shit too that would be laggy bgw->m_bHidden = false; - g_pHyprRenderer->renderWindow(bgw, g_pHyprOpenGL->m_RenderData.pMonitor, &now, false, RENDER_PASS_ALL, false, true); + g_pHyprRenderer->renderWindow(bgw, g_pHyprOpenGL->m_RenderData.pMonitor.lock(), &now, false, RENDER_PASS_ALL, false, true); bgw->m_bHidden = true; }