mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-22 02:35:57 +01:00
Fixup for latest hl commits
This commit is contained in:
parent
47ebd2218d
commit
39fea62bf4
2 changed files with 20 additions and 12 deletions
|
@ -9,6 +9,9 @@ CHyprBar::CHyprBar(CWindow* pWindow) {
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
|
m_vLastWindowPos = pWindow->m_vRealPosition.vec();
|
||||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
PMONITOR->scheduledRecalc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHyprBar::~CHyprBar() {
|
CHyprBar::~CHyprBar() {
|
||||||
|
@ -87,12 +90,11 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
0 :
|
0 :
|
||||||
(m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying());
|
(m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_pWindow->m_sAdditionalConfigData.rounding.toUnderlying());
|
||||||
|
|
||||||
// title bar's extents are 0 because we cut into the window
|
m_seExtents = {{0, *PHEIGHT + 1}, {}};
|
||||||
m_seExtents = {{}, {}};
|
|
||||||
|
|
||||||
const auto BARBUF = Vector2D{(int)m_vLastWindowSize.x + 2 * *PBORDERSIZE, *PHEIGHT} * pMonitor->scale;
|
const auto BARBUF = Vector2D{(int)m_vLastWindowSize.x + 2 * *PBORDERSIZE, *PHEIGHT} * pMonitor->scale;
|
||||||
|
|
||||||
wlr_box titleBarBox = {(int)m_vLastWindowPos.x - *PBORDERSIZE, (int)m_vLastWindowPos.y, (int)m_vLastWindowSize.x + 2 * *PBORDERSIZE,
|
wlr_box titleBarBox = {(int)m_vLastWindowPos.x - *PBORDERSIZE, (int)m_vLastWindowPos.y - *PHEIGHT, (int)m_vLastWindowSize.x + 2 * *PBORDERSIZE,
|
||||||
*PHEIGHT + *PROUNDING * 2 /* to fill the bottom cuz we can't disable rounding there */};
|
*PHEIGHT + *PROUNDING * 2 /* to fill the bottom cuz we can't disable rounding there */};
|
||||||
|
|
||||||
titleBarBox.x += offset.x;
|
titleBarBox.x += offset.x;
|
||||||
|
@ -112,29 +114,23 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
|
|
||||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||||
wlr_box windowBox = {(int)m_vLastWindowPos.x - *PBORDERSIZE + offset.x, (int)m_vLastWindowPos.y - *PBORDERSIZE + offset.y, (int)m_vLastWindowSize.x + 2 * *PBORDERSIZE,
|
wlr_box windowBox = {(int)m_vLastWindowPos.x + offset.x, (int)m_vLastWindowPos.y + offset.y, (int)m_vLastWindowSize.x, (int)m_vLastWindowSize.y};
|
||||||
(int)m_vLastWindowSize.y + 2 * *PBORDERSIZE};
|
|
||||||
scaleBox(&windowBox, pMonitor->scale);
|
scaleBox(&windowBox, pMonitor->scale);
|
||||||
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), *PROUNDING + *PBORDERSIZE);
|
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 0), *PROUNDING + *PBORDERSIZE);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
glStencilFunc(GL_EQUAL, 1, -1);
|
glStencilFunc(GL_NOTEQUAL, 1, -1);
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprOpenGL->renderRect(&titleBarBox, color, *PROUNDING);
|
g_pHyprOpenGL->renderRect(&titleBarBox, color, *PROUNDING);
|
||||||
|
|
||||||
// render title
|
// render title
|
||||||
if (m_szLastTitle != m_pWindow->m_szTitle) {
|
if (m_szLastTitle != m_pWindow->m_szTitle || m_bWindowSizeChanged) {
|
||||||
m_szLastTitle = m_pWindow->m_szTitle;
|
m_szLastTitle = m_pWindow->m_szTitle;
|
||||||
renderBarTitle(BARBUF);
|
renderBarTitle(BARBUF);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_box textBox = {titleBarBox.x, titleBarBox.y, (int)BARBUF.x, (int)BARBUF.y};
|
|
||||||
g_pHyprOpenGL->renderTexture(m_tTextTex, &textBox, a);
|
|
||||||
|
|
||||||
// TODO: buttons and shit
|
|
||||||
|
|
||||||
if (*PROUNDING) {
|
if (*PROUNDING) {
|
||||||
// cleanup stencil
|
// cleanup stencil
|
||||||
glClearStencil(0);
|
glClearStencil(0);
|
||||||
|
@ -144,7 +140,14 @@ void CHyprBar::draw(CMonitor* pMonitor, float a, const Vector2D& offset) {
|
||||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_box textBox = {titleBarBox.x, titleBarBox.y, (int)BARBUF.x, (int)BARBUF.y};
|
||||||
|
g_pHyprOpenGL->renderTexture(m_tTextTex, &textBox, a);
|
||||||
|
|
||||||
|
// TODO: buttons and shit
|
||||||
|
|
||||||
g_pHyprOpenGL->scissor((wlr_box*)nullptr);
|
g_pHyprOpenGL->scissor((wlr_box*)nullptr);
|
||||||
|
|
||||||
|
m_bWindowSizeChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
eDecorationType CHyprBar::getDecorationType() {
|
eDecorationType CHyprBar::getDecorationType() {
|
||||||
|
@ -156,6 +159,9 @@ void CHyprBar::updateWindow(CWindow* pWindow) {
|
||||||
|
|
||||||
const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
const auto WORKSPACEOFFSET = PWORKSPACE && !pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D();
|
||||||
|
|
||||||
|
if (m_vLastWindowSize != pWindow->m_vRealSize.vec())
|
||||||
|
m_bWindowSizeChanged = true;
|
||||||
|
|
||||||
m_vLastWindowPos = pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET;
|
m_vLastWindowPos = pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET;
|
||||||
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
m_vLastWindowSize = pWindow->m_vRealSize.vec();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ class CHyprBar : public IHyprWindowDecoration {
|
||||||
|
|
||||||
CTexture m_tTextTex;
|
CTexture m_tTextTex;
|
||||||
|
|
||||||
|
bool m_bWindowSizeChanged = false;
|
||||||
|
|
||||||
void renderBarTitle(const Vector2D& bufferSize);
|
void renderBarTitle(const Vector2D& bufferSize);
|
||||||
std::string m_szLastTitle;
|
std::string m_szLastTitle;
|
||||||
};
|
};
|
Loading…
Reference in a new issue