mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-12-21 22:49:48 +01:00
all: chase hyprland
This commit is contained in:
parent
9dcedb4387
commit
35fe7c3202
4 changed files with 25 additions and 24 deletions
|
@ -6,8 +6,8 @@
|
|||
#include "globals.hpp"
|
||||
|
||||
CBordersPlusPlus::CBordersPlusPlus(CWindow* pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.value();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
||||
}
|
||||
|
||||
CBordersPlusPlus::~CBordersPlusPlus() {
|
||||
|
@ -82,7 +82,7 @@ void CBordersPlusPlus::draw(CMonitor* pMonitor, float a, const Vector2D& offset)
|
|||
return;
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
|
||||
auto rounding = m_pWindow->rounding() == 0 ? 0 : m_pWindow->rounding() * pMonitor->scale + **PBORDERSIZE;
|
||||
const auto ORIGINALROUND = rounding == 0 ? 0 : m_pWindow->rounding() * pMonitor->scale + **PBORDERSIZE;
|
||||
|
@ -133,8 +133,8 @@ eDecorationType CBordersPlusPlus::getDecorationType() {
|
|||
}
|
||||
|
||||
void CBordersPlusPlus::updateWindow(CWindow* pWindow) {
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.value();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
||||
|
||||
damageEntire();
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
|||
}
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
|
||||
const auto ROUNDING = m_pWindow->rounding() + (*PPRECEDENCE ? 0 : m_pWindow->getRealBorderSize());
|
||||
|
||||
|
@ -433,8 +433,9 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
|||
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
// the +1 is a shit garbage temp fix until renderRect supports an alpha matte
|
||||
CBox windowBox = {m_pWindow->m_vRealPosition.vec().x + offset.x - pMonitor->vecPosition.x + 1, m_pWindow->m_vRealPosition.vec().y + offset.y - pMonitor->vecPosition.y + 1,
|
||||
m_pWindow->m_vRealSize.vec().x - 2, m_pWindow->m_vRealSize.vec().y - 2};
|
||||
CBox windowBox = {m_pWindow->m_vRealPosition.value().x + offset.x - pMonitor->vecPosition.x + 1,
|
||||
m_pWindow->m_vRealPosition.value().y + offset.y - pMonitor->vecPosition.y + 1, m_pWindow->m_vRealSize.value().x - 2,
|
||||
m_pWindow->m_vRealSize.value().y - 2};
|
||||
windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round();
|
||||
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), scaledRounding);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
@ -514,7 +515,7 @@ CBox CHyprBar::assignedBoxGlobal() {
|
|||
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow));
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
|
||||
return box.translate(WORKSPACEOFFSET);
|
||||
}
|
|
@ -12,8 +12,8 @@ void CTrail::onTick() {
|
|||
m_iTimer++;
|
||||
|
||||
if (m_iTimer > **PHISTORYSTEP) {
|
||||
m_dLastGeoms.push_front({box{(float)m_pWindow->m_vRealPosition.vec().x, (float)m_pWindow->m_vRealPosition.vec().y, (float)m_pWindow->m_vRealSize.vec().x,
|
||||
(float)m_pWindow->m_vRealSize.vec().y},
|
||||
m_dLastGeoms.push_front({box{(float)m_pWindow->m_vRealPosition.value().x, (float)m_pWindow->m_vRealPosition.value().y, (float)m_pWindow->m_vRealSize.value().x,
|
||||
(float)m_pWindow->m_vRealSize.value().y},
|
||||
std::chrono::system_clock::now()});
|
||||
while (m_dLastGeoms.size() > **PHISTORYPOINTS)
|
||||
m_dLastGeoms.pop_back();
|
||||
|
@ -28,8 +28,8 @@ void CTrail::onTick() {
|
|||
}
|
||||
|
||||
CTrail::CTrail(CWindow* pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.value();
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
||||
|
||||
pTickCb = g_pHookSystem->hookDynamic("trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); });
|
||||
}
|
||||
|
@ -92,9 +92,9 @@ void CTrail::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
|||
if (m_dLastGeoms.size() < 2)
|
||||
return;
|
||||
|
||||
box thisbox =
|
||||
box{(float)m_pWindow->m_vRealPosition.vec().x, (float)m_pWindow->m_vRealPosition.vec().y, (float)m_pWindow->m_vRealSize.vec().x, (float)m_pWindow->m_vRealSize.vec().y};
|
||||
CBox wlrbox = {thisbox.x - pMonitor->vecPosition.x, thisbox.y - pMonitor->vecPosition.y, thisbox.w, thisbox.h};
|
||||
box thisbox = box{(float)m_pWindow->m_vRealPosition.value().x, (float)m_pWindow->m_vRealPosition.value().y, (float)m_pWindow->m_vRealSize.value().x,
|
||||
(float)m_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();
|
||||
|
||||
g_pHyprOpenGL->scissor((CBox*)nullptr); // allow the entire window and stencil to render
|
||||
|
@ -237,10 +237,10 @@ void CTrail::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
|||
}
|
||||
}
|
||||
|
||||
box thisboxopengl = box{(m_pWindow->m_vRealPosition.vec().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x,
|
||||
(m_pWindow->m_vRealPosition.vec().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y,
|
||||
(m_pWindow->m_vRealPosition.vec().x + m_pWindow->m_vRealSize.vec().x) / pMonitor->vecSize.x,
|
||||
(m_pWindow->m_vRealPosition.vec().y + m_pWindow->m_vRealSize.vec().y) / pMonitor->vecSize.y};
|
||||
box thisboxopengl = box{(m_pWindow->m_vRealPosition.value().x - pMonitor->vecPosition.x) / pMonitor->vecSize.x,
|
||||
(m_pWindow->m_vRealPosition.value().y - pMonitor->vecPosition.y) / pMonitor->vecSize.y,
|
||||
(m_pWindow->m_vRealPosition.value().x + m_pWindow->m_vRealSize.value().x) / pMonitor->vecSize.x,
|
||||
(m_pWindow->m_vRealPosition.value().y + m_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);
|
||||
|
||||
|
@ -318,10 +318,10 @@ eDecorationType CTrail::getDecorationType() {
|
|||
void CTrail::updateWindow(CWindow* pWindow) {
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||
const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET;
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||
m_vLastWindowPos = pWindow->m_vRealPosition.value() + WORKSPACEOFFSET;
|
||||
m_vLastWindowSize = pWindow->m_vRealSize.value();
|
||||
|
||||
damageEntire();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void onNewWindow(CWindow* pWindow) {
|
|||
pWindow->m_vSize = PMONITOR->vecSize;
|
||||
pWindow->m_vPosition = PMONITOR->vecPosition;
|
||||
pWindow->m_bPinned = true;
|
||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv(), true);
|
||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goal(), true);
|
||||
|
||||
bgWindows.push_back(pWindow);
|
||||
|
||||
|
|
Loading…
Reference in a new issue