all: chase hyprland

This commit is contained in:
Vaxry 2024-10-21 19:17:02 +01:00
parent d05eb1ffba
commit 082d5c1007
10 changed files with 27 additions and 27 deletions

View file

@ -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;
}

View file

@ -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();

View file

@ -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;

View file

@ -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();

View file

@ -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;
}

View file

@ -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() {

View file

@ -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);

View file

@ -78,7 +78,7 @@ Vector2D vecForBezierT(const float& t, const std::vector<Vector2D>& verts) {
return pts[0];
}
void CTrail::draw(CMonitor* pMonitor, float a) {
void CTrail::draw(PHLMONITOR pMonitor, float a) {
if (!validMapped(m_pWindow))
return;

View file

@ -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();

View file

@ -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;
}