mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-25 03:35:59 +01:00
hyprbars: exclude rounding from geometry calcs
This commit is contained in:
parent
cc8f72a32e
commit
9099c480d8
1 changed files with 5 additions and 8 deletions
|
@ -361,11 +361,9 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
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.vec() : Vector2D();
|
||||||
|
|
||||||
const auto BORDERSIZE = m_pWindow->getRealBorderSize();
|
const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize();
|
||||||
const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize();
|
|
||||||
|
|
||||||
const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0;
|
const auto scaledRounding = ROUNDING > 0 ? ROUNDING * pMonitor->scale - 2 /* idk why but otherwise it looks bad due to the gaps */ : 0;
|
||||||
const int scaledBorderSize = BORDERSIZE * pMonitor->scale;
|
|
||||||
|
|
||||||
CColor color = *PCOLOR;
|
CColor color = *PCOLOR;
|
||||||
color.a *= a;
|
color.a *= a;
|
||||||
|
@ -377,7 +375,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
const auto BARBUF = DECOBOX.size() * pMonitor->scale;
|
const auto BARBUF = DECOBOX.size() * pMonitor->scale;
|
||||||
|
|
||||||
CBox titleBarBox = {DECOBOX.x - pMonitor->vecPosition.x, DECOBOX.y - pMonitor->vecPosition.y, DECOBOX.w,
|
CBox titleBarBox = {DECOBOX.x - pMonitor->vecPosition.x, DECOBOX.y - pMonitor->vecPosition.y, DECOBOX.w,
|
||||||
DECOBOX.h + ROUNDING * 3 /* to fill the bottom cuz we can't disable rounding there */};
|
DECOBOX.h + ROUNDING * 3 /* to fill the bottom cuz we can't disable rounding there */};
|
||||||
|
|
||||||
titleBarBox.translate(offset).scale(pMonitor->scale).round();
|
titleBarBox.translate(offset).scale(pMonitor->scale).round();
|
||||||
|
|
||||||
|
@ -397,9 +395,8 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
|
|
||||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||||
// the +1 is a shit garbage temp fix until renderRect supports an alpha matte
|
// 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 - BORDERSIZE + 1,
|
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_vRealPosition.vec().y + offset.y - pMonitor->vecPosition.y - BORDERSIZE + 1, m_pWindow->m_vRealSize.vec().x + 2 * BORDERSIZE - 2,
|
m_pWindow->m_vRealSize.vec().x - 2, m_pWindow->m_vRealSize.vec().y - 2};
|
||||||
m_pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE - 2};
|
|
||||||
windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round();
|
windowBox.translate(WORKSPACEOFFSET).scale(pMonitor->scale).round();
|
||||||
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), scaledRounding);
|
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), scaledRounding);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
Loading…
Reference in a new issue