mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-22 10:35:58 +01:00
hyprbars: improve titleBarBox calculations
This commit is contained in:
parent
dbac311729
commit
344e5a145e
1 changed files with 7 additions and 3 deletions
|
@ -349,7 +349,7 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
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 auto scaledBorderSize = BORDERSIZE * pMonitor->scale;
|
const int scaledBorderSize = BORDERSIZE * pMonitor->scale;
|
||||||
|
|
||||||
CColor color = *PCOLOR;
|
CColor color = *PCOLOR;
|
||||||
color.a *= a;
|
color.a *= a;
|
||||||
|
@ -358,11 +358,15 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
|
|
||||||
const auto BARBUF = Vector2D{m_vLastWindowSize.x + 2 * BORDERSIZE, *PHEIGHT} * pMonitor->scale;
|
const auto BARBUF = Vector2D{m_vLastWindowSize.x + 2 * BORDERSIZE, *PHEIGHT} * pMonitor->scale;
|
||||||
|
|
||||||
CBox titleBarBox = {m_vLastWindowPos.x - BORDERSIZE - pMonitor->vecPosition.x, m_vLastWindowPos.y - BORDERSIZE - *PHEIGHT - pMonitor->vecPosition.y,
|
CBox titleBarBox = {m_vLastWindowPos.x - pMonitor->vecPosition.x, m_vLastWindowPos.y - pMonitor->vecPosition.y, m_vLastWindowSize.x,
|
||||||
m_vLastWindowSize.x + 2 * BORDERSIZE, *PHEIGHT + ROUNDING * 3 /* to fill the bottom cuz we can't disable rounding there */};
|
*PHEIGHT + 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();
|
||||||
|
|
||||||
|
titleBarBox.x -= scaledBorderSize;
|
||||||
|
titleBarBox.y -= scaledBorderSize + static_cast<int>(*PHEIGHT * pMonitor->scale);
|
||||||
|
titleBarBox.w += 2 * scaledBorderSize;
|
||||||
|
|
||||||
g_pHyprOpenGL->scissor(&titleBarBox);
|
g_pHyprOpenGL->scissor(&titleBarBox);
|
||||||
|
|
||||||
if (ROUNDING) {
|
if (ROUNDING) {
|
||||||
|
|
Loading…
Reference in a new issue