From d224c84d8e99a4abb7ae05d7f2b75c4a6428b2c7 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Tue, 7 Jan 2025 19:30:33 +0100 Subject: [PATCH] all: chase hyprland --- borders-plus-plus/borderDeco.cpp | 10 +++---- hyprbars/barDeco.cpp | 10 +++---- hyprexpo/overview.cpp | 49 ++++++++++++++++---------------- hyprexpo/overview.hpp | 4 +-- hyprtrails/trail.cpp | 24 ++++++++-------- hyprwinwrap/main.cpp | 6 ++-- 6 files changed, 52 insertions(+), 51 deletions(-) diff --git a/borders-plus-plus/borderDeco.cpp b/borders-plus-plus/borderDeco.cpp index 45d99aa..7882cd0 100644 --- a/borders-plus-plus/borderDeco.cpp +++ b/borders-plus-plus/borderDeco.cpp @@ -8,8 +8,8 @@ #include "globals.hpp" CBordersPlusPlus::CBordersPlusPlus(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) { - m_vLastWindowPos = pWindow->m_vRealPosition.value(); - m_vLastWindowSize = pWindow->m_vRealSize.value(); + m_vLastWindowPos = pWindow->m_vRealPosition->value(); + m_vLastWindowSize = pWindow->m_vRealSize->value(); } CBordersPlusPlus::~CBordersPlusPlus() { @@ -97,7 +97,7 @@ void CBordersPlusPlus::drawPass(PHLMONITOR pMonitor, const float& a) { return; const auto PWORKSPACE = PWINDOW->m_pWorkspace; - const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D(); + const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D(); auto rounding = PWINDOW->rounding() == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale; const auto ORIGINALROUND = rounding == 0 ? 0 : (PWINDOW->rounding() + **PBORDERSIZE) * pMonitor->scale; @@ -155,8 +155,8 @@ eDecorationType CBordersPlusPlus::getDecorationType() { } void CBordersPlusPlus::updateWindow(PHLWINDOW pWindow) { - m_vLastWindowPos = pWindow->m_vRealPosition.value(); - m_vLastWindowSize = pWindow->m_vRealSize.value(); + m_vLastWindowPos = pWindow->m_vRealPosition->value(); + m_vLastWindowSize = pWindow->m_vRealSize->value(); damageEntire(); } diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 53dc2e8..9c4c784 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -430,7 +430,7 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) { } const auto PWORKSPACE = PWINDOW->m_pWorkspace; - const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D(); + const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D(); const auto ROUNDING = PWINDOW->rounding() + (*PPRECEDENCE ? 0 : PWINDOW->getRealBorderSize()); @@ -454,9 +454,9 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) { if (ROUNDING) { // the +1 is a shit garbage temp fix until renderRect supports an alpha matte - CBox windowBox = {PWINDOW->m_vRealPosition.value().x + PWINDOW->m_vFloatingOffset.x - pMonitor->vecPosition.x + 1, - PWINDOW->m_vRealPosition.value().y + PWINDOW->m_vFloatingOffset.y - pMonitor->vecPosition.y + 1, PWINDOW->m_vRealSize.value().x - 2, - PWINDOW->m_vRealSize.value().y - 2}; + CBox windowBox = {PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vFloatingOffset.x - pMonitor->vecPosition.x + 1, + PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vFloatingOffset.y - pMonitor->vecPosition.y + 1, PWINDOW->m_vRealSize->value().x - 2, + PWINDOW->m_vRealSize->value().y - 2}; if (windowBox.w < 1 || windowBox.h < 1) return; @@ -556,7 +556,7 @@ CBox CHyprBar::assignedBoxGlobal() { box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, PWINDOW)); const auto PWORKSPACE = PWINDOW->m_pWorkspace; - const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D(); + const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D(); return box.translate(WORKSPACEOFFSET); } diff --git a/hyprexpo/overview.cpp b/hyprexpo/overview.cpp index bfd7d54..75859aa 100644 --- a/hyprexpo/overview.cpp +++ b/hyprexpo/overview.cpp @@ -7,11 +7,11 @@ #undef private #include "OverviewPassElement.hpp" -static void damageMonitor(void*) { +static void damageMonitor(WP thisptr) { g_pOverview->damage(); } -static void removeOverview(void*) { +static void removeOverview(WP thisptr) { g_pOverview.reset(); } @@ -162,18 +162,19 @@ COverview::COverview(PHLWORKSPACE startedOn_, bool swipe_) : startedOn(startedOn // zoom on the current workspace. const auto& TILE = images[std::clamp(currentid, 0, SIDE_LENGTH * SIDE_LENGTH)]; - size.create(pMonitor->vecSize * pMonitor->vecSize / tileSize, g_pConfigManager->getAnimationPropertyConfig("windowsMove"), AVARDAMAGE_NONE); - pos.create((-((pMonitor->vecSize / (double)SIDE_LENGTH) * Vector2D{currentid % SIDE_LENGTH, currentid / SIDE_LENGTH}) * pMonitor->scale) * (pMonitor->vecSize / tileSize), - g_pConfigManager->getAnimationPropertyConfig("windowsMove"), AVARDAMAGE_NONE); + g_pAnimationManager->createAnimation(pMonitor->vecSize * pMonitor->vecSize / tileSize, size, g_pConfigManager->getAnimationPropertyConfig("windowsMove"), AVARDAMAGE_NONE); + g_pAnimationManager->createAnimation((-((pMonitor->vecSize / (double)SIDE_LENGTH) * Vector2D{currentid % SIDE_LENGTH, currentid / SIDE_LENGTH}) * pMonitor->scale) * + (pMonitor->vecSize / tileSize), + pos, g_pConfigManager->getAnimationPropertyConfig("windowsMove"), AVARDAMAGE_NONE); - size.setUpdateCallback(damageMonitor); - pos.setUpdateCallback(damageMonitor); + size->setUpdateCallback(damageMonitor); + pos->setUpdateCallback(damageMonitor); if (!swipe) { - size = pMonitor->vecSize; - pos = {0, 0}; + *size = pMonitor->vecSize; + *pos = {0, 0}; - size.setCallbackOnEnd([this](void*) { redrawAll(true); }); + size->setCallbackOnEnd([this](auto) { redrawAll(true); }); } openedID = currentid; @@ -228,7 +229,7 @@ void COverview::redrawID(int id, bool forcelowres) { Vector2D tileRenderSize = (pMonitor->vecSize - Vector2D{GAP_WIDTH, GAP_WIDTH} * (SIDE_LENGTH - 1)) / SIDE_LENGTH; CBox monbox{0, 0, tileSize.x * 2, tileSize.y * 2}; - if (!forcelowres && (size.value() != pMonitor->vecSize || closing)) + if (!forcelowres && (size->value() != pMonitor->vecSize || closing)) monbox = {{0, 0}, pMonitor->vecPixelSize}; if (!ENABLE_LOWRES) @@ -301,7 +302,7 @@ void COverview::damage() { void COverview::onDamageReported() { damageDirty = true; - Vector2D SIZE = size.value(); + Vector2D SIZE = size->value(); Vector2D tileSize = (SIZE / SIDE_LENGTH); Vector2D tileRenderSize = (SIZE - Vector2D{GAP_WIDTH, GAP_WIDTH} * (SIDE_LENGTH - 1)) / SIDE_LENGTH; @@ -328,10 +329,10 @@ void COverview::close() { Vector2D tileSize = (pMonitor->vecSize / SIDE_LENGTH); - size = pMonitor->vecSize * pMonitor->vecSize / tileSize; - pos = (-((pMonitor->vecSize / (double)SIDE_LENGTH) * Vector2D{ID % SIDE_LENGTH, ID / SIDE_LENGTH}) * pMonitor->scale) * (pMonitor->vecSize / tileSize); + *size = pMonitor->vecSize * pMonitor->vecSize / tileSize; + *pos = (-((pMonitor->vecSize / (double)SIDE_LENGTH) * Vector2D{ID % SIDE_LENGTH, ID / SIDE_LENGTH}) * pMonitor->scale) * (pMonitor->vecSize / tileSize); - size.setCallbackOnEnd(removeOverview); + size->setCallbackOnEnd(removeOverview); closing = true; @@ -386,14 +387,14 @@ void COverview::render() { } void COverview::fullRender() { - const auto GAPSIZE = (closing ? (1.0 - size.getPercent()) : size.getPercent()) * GAP_WIDTH; + const auto GAPSIZE = (closing ? (1.0 - size->getPercent()) : size->getPercent()) * GAP_WIDTH; if (pMonitor->activeWorkspace != startedOn && !closing) { // likely user changed. onWorkspaceChange(); } - Vector2D SIZE = size.value(); + Vector2D SIZE = size->value(); Vector2D tileSize = (SIZE / SIDE_LENGTH); Vector2D tileRenderSize = (SIZE - Vector2D{GAPSIZE, GAPSIZE} * (SIDE_LENGTH - 1)) / SIDE_LENGTH; @@ -403,7 +404,7 @@ void COverview::fullRender() { for (size_t y = 0; y < SIDE_LENGTH; ++y) { for (size_t x = 0; x < SIDE_LENGTH; ++x) { CBox texbox = {x * tileRenderSize.x + x * GAPSIZE, y * tileRenderSize.y + y * GAPSIZE, tileRenderSize.x, tileRenderSize.y}; - texbox.scale(pMonitor->scale).translate(pos.value()); + texbox.scale(pMonitor->scale).translate(pos->value()); texbox.round(); CRegion damage{0, 0, INT16_MAX, INT16_MAX}; g_pHyprOpenGL->renderTextureInternalWithDamage(images[x + y * SIDE_LENGTH].fb.getTexture(), &texbox, 1.0, damage); @@ -436,22 +437,22 @@ void COverview::onSwipeUpdate(double delta) { const auto SIZEMIN = pMonitor->vecSize; const auto POSMIN = Vector2D{0, 0}; - size.setValueAndWarp(lerp(SIZEMIN, SIZEMAX, PERC)); - pos.setValueAndWarp(lerp(POSMIN, POSMAX, PERC)); + size->setValueAndWarp(lerp(SIZEMIN, SIZEMAX, PERC)); + pos->setValueAndWarp(lerp(POSMIN, POSMAX, PERC)); } void COverview::onSwipeEnd() { const auto SIZEMIN = pMonitor->vecSize; const auto SIZEMAX = pMonitor->vecSize * pMonitor->vecSize / (pMonitor->vecSize / SIDE_LENGTH); - const auto PERC = (size.value() - SIZEMIN).x / (SIZEMAX - SIZEMIN).x; + const auto PERC = (size->value() - SIZEMIN).x / (SIZEMAX - SIZEMIN).x; if (PERC > 0.5) { close(); return; } - size = pMonitor->vecSize; - pos = {0, 0}; + *size = pMonitor->vecSize; + *pos = {0, 0}; - size.setCallbackOnEnd([this](void*) { redrawAll(true); }); + size->setCallbackOnEnd([this](WP thisptr) { redrawAll(true); }); swipeWasCommenced = true; } diff --git a/hyprexpo/overview.hpp b/hyprexpo/overview.hpp index c306044..0e41da2 100644 --- a/hyprexpo/overview.hpp +++ b/hyprexpo/overview.hpp @@ -64,8 +64,8 @@ class COverview { PHLWORKSPACE startedOn; - CAnimatedVariable size; - CAnimatedVariable pos; + PHLANIMVAR size; + PHLANIMVAR pos; bool closing = false; diff --git a/hyprtrails/trail.cpp b/hyprtrails/trail.cpp index 7fdc51f..c86bcf1 100644 --- a/hyprtrails/trail.cpp +++ b/hyprtrails/trail.cpp @@ -16,8 +16,8 @@ void CTrail::onTick() { const auto PWINDOW = m_pWindow.lock(); if (m_iTimer > **PHISTORYSTEP) { - m_dLastGeoms.push_front({box{(float)PWINDOW->m_vRealPosition.value().x, (float)PWINDOW->m_vRealPosition.value().y, (float)PWINDOW->m_vRealSize.value().x, - (float)PWINDOW->m_vRealSize.value().y}, + m_dLastGeoms.push_front({box{(float)PWINDOW->m_vRealPosition->value().x, (float)PWINDOW->m_vRealPosition->value().y, (float)PWINDOW->m_vRealSize->value().x, + (float)PWINDOW->m_vRealSize->value().y}, std::chrono::system_clock::now()}); while (m_dLastGeoms.size() > **PHISTORYPOINTS) m_dLastGeoms.pop_back(); @@ -32,8 +32,8 @@ void CTrail::onTick() { } CTrail::CTrail(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) { - m_vLastWindowPos = pWindow->m_vRealPosition.value(); - m_vLastWindowSize = pWindow->m_vRealSize.value(); + m_vLastWindowPos = pWindow->m_vRealPosition->value(); + m_vLastWindowSize = pWindow->m_vRealSize->value(); pTickCb = HyprlandAPI::registerCallbackDynamic(PHANDLE, "trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); }); } @@ -106,7 +106,7 @@ void CTrail::renderPass(PHLMONITOR pMonitor, const float& a) { return; box thisbox = - box{(float)PWINDOW->m_vRealPosition.value().x, (float)PWINDOW->m_vRealPosition.value().y, (float)PWINDOW->m_vRealSize.value().x, (float)PWINDOW->m_vRealSize.value().y}; + box{(float)PWINDOW->m_vRealPosition->value().x, (float)PWINDOW->m_vRealPosition->value().y, (float)PWINDOW->m_vRealSize->value().x, (float)PWINDOW->m_vRealSize->value().y}; CBox wlrbox = {thisbox.x - pMonitor->vecPosition.x, thisbox.y - pMonitor->vecPosition.y, thisbox.w, thisbox.h}; wlrbox.scale(pMonitor->scale).round(); @@ -246,10 +246,10 @@ void CTrail::renderPass(PHLMONITOR pMonitor, const float& a) { } } - box thisboxopengl = box{(PWINDOW->m_vRealPosition.value().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x, - (PWINDOW->m_vRealPosition.value().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y, - (PWINDOW->m_vRealPosition.value().x + PWINDOW->m_vRealSize.value().x) / pMonitor->vecSize.x, - (PWINDOW->m_vRealPosition.value().y + PWINDOW->m_vRealSize.value().y) / pMonitor->vecSize.y}; + box thisboxopengl = box{(PWINDOW->m_vRealPosition->value().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x, + (PWINDOW->m_vRealPosition->value().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y, + (PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x) / pMonitor->vecSize.x, + (PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y) / pMonitor->vecSize.y}; glUniform4f(g_pGlobalState->trailShader.gradient, thisboxopengl.x, thisboxopengl.y, thisboxopengl.w, thisboxopengl.h); glUniform4f(g_pGlobalState->trailShader.color, COLOR.r, COLOR.g, COLOR.b, COLOR.a); @@ -327,10 +327,10 @@ eDecorationType CTrail::getDecorationType() { void CTrail::updateWindow(PHLWINDOW pWindow) { const auto PWORKSPACE = pWindow->m_pWorkspace; - const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D(); + const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset->value() : Vector2D(); - m_vLastWindowPos = pWindow->m_vRealPosition.value() + WORKSPACEOFFSET; - m_vLastWindowSize = pWindow->m_vRealSize.value(); + m_vLastWindowPos = pWindow->m_vRealPosition->value() + WORKSPACEOFFSET; + m_vLastWindowSize = pWindow->m_vRealSize->value(); damageEntire(); } diff --git a/hyprwinwrap/main.cpp b/hyprwinwrap/main.cpp index 8f6cb9e..7af15fa 100644 --- a/hyprwinwrap/main.cpp +++ b/hyprwinwrap/main.cpp @@ -44,12 +44,12 @@ void onNewWindow(PHLWINDOW pWindow) { if (!pWindow->m_bIsFloating) g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(pWindow); - pWindow->m_vRealSize.setValueAndWarp(PMONITOR->vecSize); - pWindow->m_vRealPosition.setValueAndWarp(PMONITOR->vecPosition); + pWindow->m_vRealSize->setValueAndWarp(PMONITOR->vecSize); + pWindow->m_vRealPosition->setValueAndWarp(PMONITOR->vecPosition); pWindow->m_vSize = PMONITOR->vecSize; pWindow->m_vPosition = PMONITOR->vecPosition; pWindow->m_bPinned = true; - g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goal(), true); + g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize->goal(), true); bgWindows.push_back(pWindow);