Internal: Hyprland box implementation (#3755)

* box impl

* remove unused operators

* missed applyfromwlr
This commit is contained in:
Vaxry 2023-11-04 17:03:05 +00:00 committed by GitHub
parent 73e78f05ad
commit 55b4f84fea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 520 additions and 352 deletions

View file

@ -33,7 +33,7 @@ void CCustomDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset
(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());
// draw the border // draw the border
wlr_box fullBox = {(int)(m_vLastWindowPos.x - *PBORDERSIZE), (int)(m_vLastWindowPos.y - *PBORDERSIZE), (int)(m_vLastWindowSize.x + 2.0 * *PBORDERSIZE), CBox fullBox = {(int)(m_vLastWindowPos.x - *PBORDERSIZE), (int)(m_vLastWindowPos.y - *PBORDERSIZE), (int)(m_vLastWindowSize.x + 2.0 * *PBORDERSIZE),
(int)(m_vLastWindowSize.y + 2.0 * *PBORDERSIZE)}; (int)(m_vLastWindowSize.y + 2.0 * *PBORDERSIZE)};
fullBox.x -= pMonitor->vecPosition.x; fullBox.x -= pMonitor->vecPosition.x;
@ -49,9 +49,9 @@ void CCustomDecoration::draw(CMonitor* pMonitor, float a, const Vector2D& offset
if (fullBox.width < 1 || fullBox.height < 1) if (fullBox.width < 1 || fullBox.height < 1)
return; // don't draw invisible shadows return; // don't draw invisible shadows
g_pHyprOpenGL->scissor((wlr_box*)nullptr); g_pHyprOpenGL->scissor((CBox*)nullptr);
scaleBox(&fullBox, pMonitor->scale); fullBox.scale(pMonitor->scale);
g_pHyprOpenGL->renderBorder(&fullBox, CColor(*PCOLOR), *PROUNDING * pMonitor->scale + *PBORDERSIZE * 2, a); g_pHyprOpenGL->renderBorder(&fullBox, CColor(*PCOLOR), *PROUNDING * pMonitor->scale + *PBORDERSIZE * 2, a);
} }
@ -68,7 +68,7 @@ void CCustomDecoration::updateWindow(CWindow* pWindow) {
} }
void CCustomDecoration::damageEntire() { void CCustomDecoration::damageEntire() {
wlr_box dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y), CBox dm = {(int)(m_vLastWindowPos.x - m_seExtents.topLeft.x), (int)(m_vLastWindowPos.y - m_seExtents.topLeft.y),
(int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y}; (int)(m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x), (int)m_seExtents.topLeft.y};
g_pHyprRenderer->damageBox(&dm); g_pHyprRenderer->damageBox(&dm);
} }

View file

@ -631,38 +631,35 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceID) { if (PMONITOR->specialWorkspaceID) {
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; auto box = w->getWindowMainSurfaceBox();
if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint(pos) && !w->isHidden() && !w->m_bNoFocus)
!w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; auto box = w->getWindowMainSurfaceBox();
if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() && if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && box.containsPoint(pos) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus)
!w->m_bNoFocus)
return w.get(); return w.get();
} }
} }
// pinned // pinned
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; auto box = w->getWindowMainSurfaceBox();
if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && !w->isHidden() && w->m_bPinned && !w->m_bNoFocus) if (box.containsPoint(pos) && w->m_bIsMapped && w->m_bIsFloating && !w->isHidden() && w->m_bPinned && !w->m_bNoFocus)
return w.get(); return w.get();
} }
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter. // first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; auto box = w->getWindowMainSurfaceBox();
if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && if (box.containsPoint(pos) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus)
!w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; auto box = w->getWindowMainSurfaceBox();
if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && PMONITOR->activeWorkspace == w->m_iWorkspaceID && !w->isHidden() && !w->m_bNoFocus) if (box.containsPoint(pos) && w->m_bIsMapped && !w->m_bIsFloating && PMONITOR->activeWorkspace == w->m_iWorkspaceID && !w->isHidden() && !w->m_bNoFocus)
return w.get(); return w.get();
} }
@ -674,15 +671,15 @@ CWindow* CCompositor::vectorToWindowTiled(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceID) { if (PMONITOR->specialWorkspaceID) {
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, pos.x, pos.y) && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus) if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && box.containsPoint(pos) && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus)
return w.get(); return w.get();
} }
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus) if (w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bIsFloating && !w->isHidden() && !w->m_bNoFocus)
return w.get(); return w.get();
} }
@ -700,16 +697,16 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceID) { if (PMONITOR->specialWorkspaceID) {
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowInputBox(); const auto BB = w->getWindowInputBox();
wlr_box box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA}; CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint(pos) && !w->isHidden() && !w->m_bX11ShouldntFocus &&
!w->m_bX11ShouldntFocus && !w->m_bNoFocus) !w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (!w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && if (!w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint(pos) && !w->isHidden() && !w->m_bX11ShouldntFocus &&
!w->m_bX11ShouldntFocus && !w->m_bNoFocus) !w->m_bNoFocus)
return w.get(); return w.get();
} }
} }
@ -717,9 +714,9 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
// pinned windows on top of floating regardless // pinned windows on top of floating regardless
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowInputBox(); const auto BB = w->getWindowInputBox();
wlr_box box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA}; CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_bNoFocus) { if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_bNoFocus) {
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y)) if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
return w.get(); return w.get();
if (!w->m_bIsX11) { if (!w->m_bIsX11) {
@ -732,13 +729,13 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter. // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowInputBox(); const auto BB = w->getWindowInputBox();
wlr_box box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA}; CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus) { if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus) {
// OR windows should add focus to parent // OR windows should add focus to parent
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2) if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
continue; continue;
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y)) { if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y})) {
if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) { if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) {
// Override Redirect // Override Redirect
@ -764,9 +761,9 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
} }
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (!w->m_bIsFloating && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus &&
!w->m_bX11ShouldntFocus && !w->m_bNoFocus) !w->m_bNoFocus)
return w.get(); return w.get();
} }
@ -778,37 +775,36 @@ CWindow* CCompositor::windowFromCursor() {
if (PMONITOR->specialWorkspaceID) { if (PMONITOR->specialWorkspaceID) {
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; CBox box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && if (w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) &&
!w->isHidden() && !w->m_bNoFocus) !w->isHidden() && !w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && !w->m_bNoFocus) if (w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && !w->m_bNoFocus)
return w.get(); return w.get();
} }
} }
// pinned // pinned
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; CBox box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && w->m_bPinned && !w->m_bNoFocus) if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && w->m_bIsFloating && w->m_bPinned && !w->m_bNoFocus)
return w.get(); return w.get();
} }
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter. // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; CBox box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned && if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bPinned && !w->m_bNoFocus)
!w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows) { for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y}; CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bNoFocus) if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bNoFocus)
return w.get(); return w.get();
} }
@ -817,14 +813,14 @@ CWindow* CCompositor::windowFromCursor() {
CWindow* CCompositor::windowFloatingFromCursor() { CWindow* CCompositor::windowFloatingFromCursor() {
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; CBox box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && !w->isHidden() && w->m_bPinned && !w->m_bNoFocus) if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && w->m_bIsFloating && !w->isHidden() && w->m_bPinned && !w->m_bNoFocus)
return w.get(); return w.get();
} }
for (auto& w : m_vWindows | std::views::reverse) { for (auto& w : m_vWindows | std::views::reverse) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; CBox box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}) && w->m_bIsMapped && w->m_bIsFloating && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() &&
!w->m_bPinned && !w->m_bNoFocus) !w->m_bPinned && !w->m_bNoFocus)
return w.get(); return w.get();
} }
@ -844,8 +840,9 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW
double subx, suby; double subx, suby;
// calc for oversized windows... fucking bullshit, again. // calc for oversized windows... fucking bullshit, again.
wlr_box geom; CBox geom;
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, &geom); wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, geom.pWlr());
geom.applyFromWlr();
const auto PFOUND = wlr_xdg_surface_surface_at(PSURFACE, pos.x - pWindow->m_vRealPosition.vec().x + geom.x, pos.y - pWindow->m_vRealPosition.vec().y + geom.y, &subx, &suby); const auto PFOUND = wlr_xdg_surface_surface_at(PSURFACE, pos.x - pWindow->m_vRealPosition.vec().x + geom.x, pos.y - pWindow->m_vRealPosition.vec().y + geom.y, &subx, &suby);
@ -886,8 +883,9 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, CWindow* pWindow
}, },
&iterData); &iterData);
wlr_box geom = {0}; CBox geom = {};
wlr_xdg_surface_get_geometry(PSURFACE, &geom); wlr_xdg_surface_get_geometry(PSURFACE, geom.pWlr());
geom.applyFromWlr();
if (std::get<1>(iterData) == -1337 && std::get<2>(iterData) == -1337) if (std::get<1>(iterData) == -1337 && std::get<2>(iterData) == -1337)
return vec - pWindow->m_vRealPosition.goalv(); return vec - pWindow->m_vRealPosition.goalv();

View file

@ -27,3 +27,17 @@ enum eRenderStage
struct SCallbackInfo { struct SCallbackInfo {
bool cancelled = false; /* on cancellable events, will cancel the event. */ bool cancelled = false; /* on cancellable events, will cancel the event. */
}; };
struct SWindowDecorationExtents {
Vector2D topLeft;
Vector2D bottomRight;
//
SWindowDecorationExtents operator*(const double& scale) const {
return SWindowDecorationExtents{topLeft * scale, bottomRight * scale};
}
SWindowDecorationExtents floor() {
return {topLeft.floor(), bottomRight.floor()};
}
};

View file

@ -55,12 +55,12 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() {
} }
if (m_pWLSurface.exists() && !m_bIsX11) { if (m_pWLSurface.exists() && !m_bIsX11) {
wlr_box surfaceExtents = {0, 0, 0, 0}; CBox surfaceExtents = {0, 0, 0, 0};
// TODO: this could be better, perhaps make a getFullWindowRegion? // TODO: this could be better, perhaps make a getFullWindowRegion?
wlr_xdg_surface_for_each_popup_surface( wlr_xdg_surface_for_each_popup_surface(
m_uSurface.xdg, m_uSurface.xdg,
[](wlr_surface* surf, int sx, int sy, void* data) { [](wlr_surface* surf, int sx, int sy, void* data) {
wlr_box* pSurfaceExtents = (wlr_box*)data; CBox* pSurfaceExtents = (CBox*)data;
if (sx < pSurfaceExtents->x) if (sx < pSurfaceExtents->x)
pSurfaceExtents->x = sx; pSurfaceExtents->x = sx;
if (sy < pSurfaceExtents->y) if (sy < pSurfaceExtents->y)
@ -88,7 +88,7 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() {
return maxExtents; return maxExtents;
} }
wlr_box CWindow::getFullWindowBoundingBox() { CBox CWindow::getFullWindowBoundingBox() {
if (m_sAdditionalConfigData.dimAround) { if (m_sAdditionalConfigData.dimAround) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
@ -96,13 +96,13 @@ wlr_box CWindow::getFullWindowBoundingBox() {
auto maxExtents = getFullWindowExtents(); auto maxExtents = getFullWindowExtents();
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y, CBox finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox; return finalBox;
} }
wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() { CBox CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
@ -113,7 +113,7 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
POS = PMONITOR->vecPosition; POS = PMONITOR->vecPosition;
SIZE = PMONITOR->vecSize; SIZE = PMONITOR->vecSize;
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
} }
if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) { if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) {
@ -131,10 +131,10 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
SIZE.y += PMONITOR->vecReservedBottomRight.y; SIZE.y += PMONITOR->vecReservedBottomRight.y;
} }
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y}; return CBox{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
} }
wlr_box CWindow::getWindowInputBox() { CBox CWindow::getWindowInputBox() {
const int BORDERSIZE = getRealBorderSize(); const int BORDERSIZE = getRealBorderSize();
if (m_sAdditionalConfigData.dimAround) { if (m_sAdditionalConfigData.dimAround) {
@ -165,13 +165,13 @@ wlr_box CWindow::getWindowInputBox() {
} }
// Add extents to the real base BB and return // Add extents to the real base BB and return
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y, CBox finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x, m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox; return finalBox;
} }
wlr_box CWindow::getWindowMainSurfaceBox() { CBox CWindow::getWindowMainSurfaceBox() {
return {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y}; return {m_vRealPosition.vec().x, m_vRealPosition.vec().y, m_vRealSize.vec().x, m_vRealSize.vec().y};
} }
@ -657,9 +657,9 @@ bool CWindow::isInCurvedCorner(double x, double y) {
void findExtensionForVector2D(wlr_surface* surface, int x, int y, void* data) { void findExtensionForVector2D(wlr_surface* surface, int x, int y, void* data) {
const auto DATA = (SExtensionFindingData*)data; const auto DATA = (SExtensionFindingData*)data;
wlr_box box = {DATA->origin.x + x, DATA->origin.y + y, surface->current.width, surface->current.height}; CBox box = {DATA->origin.x + x, DATA->origin.y + y, surface->current.width, surface->current.height};
if (wlr_box_contains_point(&box, DATA->vec.x, DATA->vec.y)) if (box.containsPoint(DATA->vec))
*DATA->found = surface; *DATA->found = surface;
} }

View file

@ -11,14 +11,16 @@
#include "macros.hpp" #include "macros.hpp"
#include "managers/XWaylandManager.hpp" #include "managers/XWaylandManager.hpp"
enum eIdleInhibitMode { enum eIdleInhibitMode
{
IDLEINHIBIT_NONE = 0, IDLEINHIBIT_NONE = 0,
IDLEINHIBIT_ALWAYS, IDLEINHIBIT_ALWAYS,
IDLEINHIBIT_FULLSCREEN, IDLEINHIBIT_FULLSCREEN,
IDLEINHIBIT_FOCUS IDLEINHIBIT_FOCUS
}; };
enum eGroupRules { enum eGroupRules
{
// effective only during first map, except for _ALWAYS variant // effective only during first map, except for _ALWAYS variant
GROUP_NONE = 0, GROUP_NONE = 0,
GROUP_SET = 1 << 0, // Open as new group or add to focused group GROUP_SET = 1 << 0, // Open as new group or add to focused group
@ -334,11 +336,11 @@ class CWindow {
} }
// methods // methods
wlr_box getFullWindowBoundingBox(); CBox getFullWindowBoundingBox();
SWindowDecorationExtents getFullWindowExtents(); SWindowDecorationExtents getFullWindowExtents();
wlr_box getWindowInputBox(); CBox getWindowInputBox();
wlr_box getWindowMainSurfaceBox(); CBox getWindowMainSurfaceBox();
wlr_box getWindowIdealBoundingBoxIgnoreReserved(); CBox getWindowIdealBoundingBoxIgnoreReserved();
void updateWindowDecos(); void updateWindowDecos();
pid_t getPID(); pid_t getPID();
IHyprWindowDecoration* getDecorationByType(eDecorationType); IHyprWindowDecoration* getDecorationByType(eDecorationType);

View file

@ -233,6 +233,6 @@ void CHyprDebugOverlay::draw() {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
wlr_box pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; CBox pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f); g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
} }

View file

@ -24,7 +24,7 @@ class CHyprMonitorDebugOverlay {
std::deque<float> m_dLastAnimationTicks; std::deque<float> m_dLastAnimationTicks;
std::chrono::high_resolution_clock::time_point m_tpLastFrame; std::chrono::high_resolution_clock::time_point m_tpLastFrame;
CMonitor* m_pMonitor = nullptr; CMonitor* m_pMonitor = nullptr;
wlr_box m_wbLastDrawnBox; CBox m_wbLastDrawnBox;
friend class CHyprRenderer; friend class CHyprRenderer;
}; };

View file

@ -50,7 +50,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC
} }
} }
wlr_box CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) { CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
static constexpr auto ANIM_DURATION_MS = 600.0; static constexpr auto ANIM_DURATION_MS = 600.0;
static constexpr auto ANIM_LAG_MS = 100.0; static constexpr auto ANIM_LAG_MS = 100.0;
static constexpr auto NOTIF_LEFTBAR_SIZE = 5.0; static constexpr auto NOTIF_LEFTBAR_SIZE = 5.0;
@ -170,7 +170,7 @@ wlr_box CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
// cleanup notifs // cleanup notifs
std::erase_if(m_dNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; }); std::erase_if(m_dNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
return wlr_box{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10}; return CBox{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10};
} }
void CHyprNotificationOverlay::draw(CMonitor* pMonitor) { void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
@ -201,7 +201,7 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
cairo_surface_flush(m_pCairoSurface); cairo_surface_flush(m_pCairoSurface);
wlr_box damage = drawNotifications(pMonitor); CBox damage = drawNotifications(pMonitor);
g_pHyprRenderer->damageBox(&damage); g_pHyprRenderer->damageBox(&damage);
g_pHyprRenderer->damageBox(&m_bLastDamage); g_pHyprRenderer->damageBox(&m_bLastDamage);
@ -224,6 +224,6 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
wlr_box pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y}; CBox pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f); g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
} }

View file

@ -44,8 +44,8 @@ class CHyprNotificationOverlay {
void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE); void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE);
private: private:
wlr_box drawNotifications(CMonitor* pMonitor); CBox drawNotifications(CMonitor* pMonitor);
wlr_box m_bLastDamage; CBox m_bLastDamage;
std::deque<std::unique_ptr<SNotification>> m_dNotifications; std::deque<std::unique_ptr<SNotification>> m_dNotifications;

View file

@ -95,7 +95,7 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
PMONITOR->scheduledRecalc = true; PMONITOR->scheduledRecalc = true;
// and damage // and damage
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, CBox geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height}; layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed); g_pHyprRenderer->damageBox(&geomFixed);
} }
@ -157,7 +157,7 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y); layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, CBox geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height}; layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed); g_pHyprRenderer->damageBox(&geomFixed);
const auto WORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); const auto WORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
@ -247,7 +247,7 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
} }
} }
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, CBox geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width,
layersurface->geometry.height}; layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed); g_pHyprRenderer->damageBox(&geomFixed);
@ -270,7 +270,7 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
wlr_box geomFixed = {layersurface->geometry.x, layersurface->geometry.y, layersurface->geometry.width, layersurface->geometry.height}; CBox geomFixed = {layersurface->geometry.x, layersurface->geometry.y, layersurface->geometry.width, layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed); g_pHyprRenderer->damageBox(&geomFixed);
// fix if it changed its mon // fix if it changed its mon

View file

@ -28,8 +28,9 @@ void Events::listener_change(wl_listener* listener, void* data) {
const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m->output); const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m->output);
wlr_box BOX; CBox BOX;
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m->output, &BOX); wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m->output, BOX.pWlr());
BOX.applyFromWlr();
//m->vecSize.x = BOX.width; //m->vecSize.x = BOX.width;
// m->vecSize.y = BOX.height; // m->vecSize.y = BOX.height;

View file

@ -64,9 +64,9 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
const auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PMONITOR = g_pCompositor->m_pLastMonitor;
wlr_box box = {.x = PMONITOR->vecPosition.x - pHyprPopup->lx, .y = PMONITOR->vecPosition.y - pHyprPopup->ly, .width = PMONITOR->vecSize.x, .height = PMONITOR->vecSize.y}; CBox box = {PMONITOR->vecPosition.x - pHyprPopup->lx, PMONITOR->vecPosition.y - pHyprPopup->ly, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
wlr_xdg_popup_unconstrain_from_box(popup, &box); wlr_xdg_popup_unconstrain_from_box(popup, box.pWlr());
pHyprPopup->monitor = PMONITOR; pHyprPopup->monitor = PMONITOR;
@ -159,8 +159,9 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0; int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly); addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents; CBox extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
extents.applyFromWlr();
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2); g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
@ -180,17 +181,18 @@ void Events::listener_repositionPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0; int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly); addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents; CBox extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
extents.applyFromWlr();
PPOPUP->lastPos = {lx - extents.x, ly - extents.y}; PPOPUP->lastPos = {lx - extents.x, ly - extents.y};
PPOPUP->repositionRequested = true; PPOPUP->repositionRequested = true;
const auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PMONITOR = g_pCompositor->m_pLastMonitor;
wlr_box box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x, CBox box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x,
PMONITOR->vecSize.y}; PMONITOR->vecSize.y};
wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, &box); wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, box.pWlr());
} }
void Events::listener_unmapPopupXDG(void* owner, void* data) { void Events::listener_unmapPopupXDG(void* owner, void* data) {
@ -207,8 +209,9 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0; int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly); addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents; CBox extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
extents.applyFromWlr();
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2); g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
@ -233,8 +236,9 @@ void Events::listener_commitPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0; int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly); addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents; CBox extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
extents.applyFromWlr();
if (PPOPUP->repositionRequested) if (PPOPUP->repositionRequested)
g_pHyprRenderer->damageBox(PPOPUP->lastPos.x, PPOPUP->lastPos.y, extents.width + 2, extents.height + 2); g_pHyprRenderer->damageBox(PPOPUP->lastPos.x, PPOPUP->lastPos.y, extents.width + 2, extents.height + 2);

View file

@ -96,7 +96,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PWORKSPACE->m_bDefaultPseudo) { if (PWORKSPACE->m_bDefaultPseudo) {
PWINDOW->m_bIsPseudotiled = true; PWINDOW->m_bIsPseudotiled = true;
wlr_box desiredGeometry = {0}; CBox desiredGeometry = {0};
g_pXWaylandManager->getGeometryForWindow(PWINDOW, &desiredGeometry); g_pXWaylandManager->getGeometryForWindow(PWINDOW, &desiredGeometry);
PWINDOW->m_vPseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height); PWINDOW->m_vPseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
} }

104
src/helpers/Box.cpp Normal file
View file

@ -0,0 +1,104 @@
#include "Box.hpp"
wlr_box CBox::wlr() {
CBox rounded = roundInternal();
m_bWlrBox = wlr_box{(int)rounded.x, (int)rounded.y, (int)rounded.w, (int)rounded.h};
return m_bWlrBox;
}
wlr_box* CBox::pWlr() {
CBox rounded = roundInternal();
m_bWlrBox = wlr_box{(int)rounded.x, (int)rounded.y, (int)rounded.w, (int)rounded.h};
return &m_bWlrBox;
}
CBox& CBox::scale(double scale) {
x *= scale;
y *= scale;
w *= scale;
h *= scale;
return *this;
}
CBox& CBox::scale(const Vector2D& scale) {
x *= scale.x;
y *= scale.y;
w *= scale.x;
h *= scale.y;
return *this;
}
CBox& CBox::translate(const Vector2D& vec) {
x += vec.x;
y += vec.y;
return *this;
}
Vector2D CBox::middle() const {
return Vector2D{x + w / 2.0, y + h / 2.0};
}
bool CBox::containsPoint(const Vector2D& vec) const {
return VECINRECT(vec, x, y, x + w, y + h);
}
bool CBox::empty() const {
return w == 0 || h == 0;
}
CBox& CBox::applyFromWlr() {
x = m_bWlrBox.x;
y = m_bWlrBox.y;
w = m_bWlrBox.width;
h = m_bWlrBox.height;
return *this;
}
CBox& CBox::round() {
float newW = x + w - std::floor(x);
float newH = y + h - std::floor(y);
x = std::floor(x);
y = std::floor(y);
w = std::floor(newW);
h = std::floor(newH);
return *this;
}
CBox& CBox::transform(const wl_output_transform t, double w, double h) {
wlr_box_transform(&m_bWlrBox, pWlr(), t, w, h);
applyFromWlr();
return *this;
}
CBox& CBox::addExtents(const SWindowDecorationExtents& e) {
x -= e.topLeft.x;
y -= e.topLeft.y;
w += e.topLeft.x + e.bottomRight.x;
h += e.topLeft.y + e.bottomRight.y;
return *this;
}
CBox& CBox::scaleFromCenter(double scale) {
double oldW = w, oldH = h;
w *= scale;
h *= scale;
x -= (w - oldW) / 2.0;
y -= (h - oldH) / 2.0;
return *this;
}
CBox CBox::roundInternal() {
float newW = x + w - std::floor(x);
float newH = y + h - std::floor(y);
return CBox{std::floor(x), std::floor(y), std::floor(newW), std::floor(newH)};
}

66
src/helpers/Box.hpp Normal file
View file

@ -0,0 +1,66 @@
#pragma once
#include <wlr/util/box.h>
#include "Vector2D.hpp"
#include "../SharedDefs.hpp"
class CBox {
public:
CBox(double x_, double y_, double w_, double h_) {
x = x_;
y = y_;
w = w_;
h = h_;
}
CBox() {
w = 0;
h = 0;
}
CBox(const wlr_box& box) {
x = box.x;
y = box.y;
w = box.width;
h = box.height;
}
CBox(const double d) {
x = d;
y = d;
w = d;
h = d;
}
wlr_box wlr();
wlr_box* pWlr();
CBox& applyFromWlr();
CBox& scale(double scale);
CBox& scaleFromCenter(double scale);
CBox& scale(const Vector2D& scale);
CBox& translate(const Vector2D& vec);
CBox& round();
CBox& transform(const wl_output_transform t, double w, double h);
CBox& addExtents(const SWindowDecorationExtents& e);
Vector2D middle() const;
bool containsPoint(const Vector2D& vec) const;
bool empty() const;
double x = 0, y = 0;
union {
double w;
double width;
};
union {
double h;
double height;
};
private:
CBox roundInternal();
wlr_box m_bWlrBox;
};

View file

@ -185,13 +185,6 @@ std::string escapeJSONStrings(const std::string& str) {
return oss.str(); return oss.str();
} }
void scaleBox(wlr_box* box, float scale) {
box->width = std::round(box->width * scale);
box->height = std::round(box->height * scale);
box->x = std::round(box->x * scale);
box->y = std::round(box->y * scale);
}
std::string removeBeginEndSpacesTabs(std::string str) { std::string removeBeginEndSpacesTabs(std::string str) {
if (str.empty()) if (str.empty())
return str; return str;

View file

@ -16,7 +16,6 @@ struct SCallstackFrameInfo {
std::string absolutePath(const std::string&, const std::string&); std::string absolutePath(const std::string&, const std::string&);
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString); void addWLSignal(wl_signal*, wl_listener*, void* pOwner, const std::string& ownerString);
std::string escapeJSONStrings(const std::string& str); std::string escapeJSONStrings(const std::string& str);
void scaleBox(wlr_box*, float);
std::string removeBeginEndSpacesTabs(std::string); std::string removeBeginEndSpacesTabs(std::string);
bool isNumber(const std::string&, bool allowfloat = false); bool isNumber(const std::string&, bool allowfloat = false);
bool isDirection(const std::string&); bool isDirection(const std::string&);

View file

@ -317,14 +317,14 @@ void CMonitor::addDamage(const CRegion* rg) {
addDamage(const_cast<CRegion*>(rg)->pixman()); addDamage(const_cast<CRegion*>(rg)->pixman());
} }
void CMonitor::addDamage(const wlr_box* box) { void CMonitor::addDamage(const CBox* box) {
static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue;
if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) { if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) {
wlr_damage_ring_add_whole(&damage); wlr_damage_ring_add_whole(&damage);
g_pCompositor->scheduleFrameForMonitor(this); g_pCompositor->scheduleFrameForMonitor(this);
} }
if (wlr_damage_ring_add_box(&damage, box)) if (wlr_damage_ring_add_box(&damage, const_cast<CBox*>(box)->pWlr()))
g_pCompositor->scheduleFrameForMonitor(this); g_pCompositor->scheduleFrameForMonitor(this);
} }

View file

@ -113,7 +113,7 @@ class CMonitor {
void onDisconnect(); void onDisconnect();
void addDamage(const pixman_region32_t* rg); void addDamage(const pixman_region32_t* rg);
void addDamage(const CRegion* rg); void addDamage(const CRegion* rg);
void addDamage(const wlr_box* box); void addDamage(const CBox* box);
void setMirror(const std::string&); void setMirror(const std::string&);
bool isMirror(); bool isMirror();
float getDefaultScale(); float getDefaultScale();

View file

@ -21,6 +21,10 @@ CRegion::CRegion(wlr_box* box) {
pixman_region32_init_rect(&m_rRegion, box->x, box->y, box->width, box->height); pixman_region32_init_rect(&m_rRegion, box->x, box->y, box->width, box->height);
} }
CRegion::CRegion(CBox* box) {
pixman_region32_init_rect(&m_rRegion, box->x, box->y, box->w, box->h);
}
CRegion::CRegion(pixman_box32_t* box) { CRegion::CRegion(pixman_box32_t* box) {
pixman_region32_init_rect(&m_rRegion, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1); pixman_region32_init_rect(&m_rRegion, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1);
} }
@ -100,7 +104,7 @@ std::vector<pixman_box32_t> CRegion::getRects() const {
return result; return result;
} }
wlr_box CRegion::getExtents() { CBox CRegion::getExtents() {
pixman_box32_t* box = pixman_region32_extents(&m_rRegion); pixman_box32_t* box = pixman_region32_extents(&m_rRegion);
return {box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1}; return {box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1};
} }

View file

@ -15,6 +15,8 @@ class CRegion {
CRegion(double x, double y, double w, double h); CRegion(double x, double y, double w, double h);
/* Create from a wlr_box */ /* Create from a wlr_box */
CRegion(wlr_box* box); CRegion(wlr_box* box);
/* Create from a CBox */
CRegion(CBox* box);
/* Create from a pixman_box32_t */ /* Create from a pixman_box32_t */
CRegion(pixman_box32_t* box); CRegion(pixman_box32_t* box);
@ -43,7 +45,7 @@ class CRegion {
CRegion& translate(const Vector2D& vec); CRegion& translate(const Vector2D& vec);
CRegion& invert(pixman_box32_t* box); CRegion& invert(pixman_box32_t* box);
CRegion& scale(float scale); CRegion& scale(float scale);
wlr_box getExtents(); CBox getExtents();
bool containsPoint(const Vector2D& vec) const; bool containsPoint(const Vector2D& vec) const;
bool empty() const; bool empty() const;
Vector2D closestPoint(const Vector2D& vec) const; Vector2D closestPoint(const Vector2D& vec) const;

View file

@ -98,8 +98,9 @@ void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
// damage // damage
if (pNode->pSurface && pNode->pSurface->exists()) { if (pNode->pSurface && pNode->pSurface->exists()) {
wlr_box extents = {}; CBox extents = {};
wlr_surface_get_extends(pNode->pSurface->wlr(), &extents); wlr_surface_get_extends(pNode->pSurface->wlr(), extents.pWlr());
extents.applyFromWlr();
int lx = 0, ly = 0; int lx = 0, ly = 0;
addSurfaceGlobalOffset(pNode, &lx, &ly); addSurfaceGlobalOffset(pNode, &lx, &ly);
@ -198,7 +199,7 @@ void Events::listener_unmapSubsurface(void* owner, void* data) {
int lx = 0, ly = 0; int lx = 0, ly = 0;
addSurfaceGlobalOffset(PNODE, &lx, &ly); addSurfaceGlobalOffset(PNODE, &lx, &ly);
wlr_box extents = {lx, ly, 0, 0}; CBox extents = {lx, ly, 0, 0};
extents.width = PNODE->pSurface->wlr()->current.width; extents.width = PNODE->pSurface->wlr()->current.width;
extents.height = PNODE->pSurface->wlr()->current.height; extents.height = PNODE->pSurface->wlr()->current.height;

View file

@ -22,6 +22,9 @@ class Vector2D {
Vector2D operator-(const Vector2D& a) const { Vector2D operator-(const Vector2D& a) const {
return Vector2D(this->x - a.x, this->y - a.y); return Vector2D(this->x - a.x, this->y - a.y);
} }
Vector2D operator-() const {
return Vector2D(-this->x, -this->y);
}
Vector2D operator*(const float& a) const { Vector2D operator*(const float& a) const {
return Vector2D(this->x * a, this->y * a); return Vector2D(this->x * a, this->y * a);
} }

View file

@ -33,7 +33,7 @@ struct SLayerSurface {
DYNLISTENER(commitLayerSurface); DYNLISTENER(commitLayerSurface);
DYNLISTENER(newPopup); DYNLISTENER(newPopup);
wlr_box geometry = {0, 0, 0, 0}; CBox geometry = {0, 0, 0, 0};
Vector2D position; Vector2D position;
zwlr_layer_shell_v1_layer layer; zwlr_layer_shell_v1_layer layer;
@ -65,12 +65,12 @@ class CMonitor;
struct SRenderData { struct SRenderData {
CMonitor* pMonitor; CMonitor* pMonitor;
timespec* when; timespec* when;
int x, y; double x, y;
// for iters // for iters
void* data = nullptr; void* data = nullptr;
wlr_surface* surface = nullptr; wlr_surface* surface = nullptr;
int w, h; double w, h;
// for rounding // for rounding
bool dontRound = true; bool dontRound = true;

View file

@ -154,7 +154,7 @@ void CHyprError::draw() {
const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor; const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor;
wlr_box monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; CBox monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
m_bDamageBox.x = (int)PMONITOR->vecPosition.x; m_bDamageBox.x = (int)PMONITOR->vecPosition.x;
m_bDamageBox.y = (int)PMONITOR->vecPosition.y; m_bDamageBox.y = (int)PMONITOR->vecPosition.y;

View file

@ -23,7 +23,7 @@ class CHyprError {
bool m_bIsCreated = false; bool m_bIsCreated = false;
CTexture m_tTexture; CTexture m_tTexture;
CAnimatedVariable m_fFadeOpacity; CAnimatedVariable m_fFadeOpacity;
wlr_box m_bDamageBox = {0, 0, 0, 0}; CBox m_bDamageBox = {0, 0, 0, 0};
bool m_bMonitorChanged = false; bool m_bMonitorChanged = false;
}; };

View file

@ -145,3 +145,4 @@ extern "C" {
#endif #endif
#include "helpers/Vector2D.hpp" #include "helpers/Vector2D.hpp"
#include "helpers/Box.hpp"

View file

@ -6,7 +6,7 @@ void IHyprLayout::onWindowCreated(CWindow* pWindow, eDirection direction) {
if (pWindow->m_bIsFloating) { if (pWindow->m_bIsFloating) {
onWindowCreatedFloating(pWindow); onWindowCreatedFloating(pWindow);
} else { } else {
wlr_box desiredGeometry = {0}; CBox desiredGeometry = {};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry); g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) { if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
@ -75,7 +75,7 @@ void IHyprLayout::onWindowRemovedFloating(CWindow* pWindow) {
void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) { void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
wlr_box desiredGeometry = {0}; CBox desiredGeometry = {0};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry); g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);

View file

@ -141,8 +141,8 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) { for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) {
if (it->workspaceID != pWindow->m_iWorkspaceID) if (it->workspaceID != pWindow->m_iWorkspaceID)
continue; continue;
const wlr_box box = it->pWindow->getWindowIdealBoundingBoxIgnoreReserved(); const CBox box = it->pWindow->getWindowIdealBoundingBoxIgnoreReserved();
if (wlr_box_contains_point(&box, MOUSECOORDS.x, MOUSECOORDS.y)) { if (box.containsPoint(MOUSECOORDS)) {
switch (orientation) { switch (orientation) {
case ORIENTATION_LEFT: case ORIENTATION_LEFT:
case ORIENTATION_RIGHT: case ORIENTATION_RIGHT:

View file

@ -81,7 +81,7 @@ void CAnimationManager::tick() {
CMonitor* PMONITOR = nullptr; CMonitor* PMONITOR = nullptr;
bool animationsDisabled = animGlobalDisabled; bool animationsDisabled = animGlobalDisabled;
wlr_box WLRBOXPREV = {0, 0, 0, 0}; CBox WLRBOXPREV = {0, 0, 0, 0};
if (PWINDOW) { if (PWINDOW) {
WLRBOXPREV = PWINDOW->getFullWindowBoundingBox(); WLRBOXPREV = PWINDOW->getFullWindowBoundingBox();
PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
@ -236,7 +236,7 @@ void CAnimationManager::tick() {
BORDERSIZE + ROUNDINGSIZE); // bottom BORDERSIZE + ROUNDINGSIZE); // bottom
// damage for new box // damage for new box
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y}; const CBox WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE,
@ -255,9 +255,8 @@ void CAnimationManager::tick() {
if (PDECO) { if (PDECO) {
const auto EXTENTS = PDECO->getWindowDecorationExtents(); const auto EXTENTS = PDECO->getWindowDecorationExtents();
wlr_box dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y, CBox dmg = {PWINDOW->m_vRealPosition.vec().x - EXTENTS.topLeft.x, PWINDOW->m_vRealPosition.vec().y - EXTENTS.topLeft.y,
PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, PWINDOW->m_vRealSize.vec().x + EXTENTS.topLeft.x + EXTENTS.bottomRight.x, PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
PWINDOW->m_vRealSize.vec().y + EXTENTS.topLeft.y + EXTENTS.bottomRight.y};
if (!*PSHADOWIGNOREWINDOW) { if (!*PSHADOWIGNOREWINDOW) {
// easy, damage the entire box // easy, damage the entire box

View file

@ -74,7 +74,7 @@ void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID)->m_pLastFocusedWindow = pWindow; g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID)->m_pLastFocusedWindow = pWindow;
} }
void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox) { void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, CBox* pbox) {
if (pWindow->m_bIsX11) { if (pWindow->m_bIsX11) {
const auto SIZEHINTS = pWindow->m_uSurface.xwayland->size_hints; const auto SIZEHINTS = pWindow->m_uSurface.xwayland->size_hints;
@ -89,8 +89,10 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox)
pbox->width = pWindow->m_uSurface.xwayland->width; pbox->width = pWindow->m_uSurface.xwayland->width;
pbox->height = pWindow->m_uSurface.xwayland->height; pbox->height = pWindow->m_uSurface.xwayland->height;
} }
} else } else {
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, pbox); wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, pbox->pWlr());
pbox->applyFromWlr();
}
} }
std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) { std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {

View file

@ -15,7 +15,7 @@ class CHyprXWaylandManager {
wlr_surface* getWindowSurface(CWindow*); wlr_surface* getWindowSurface(CWindow*);
void activateSurface(wlr_surface*, bool); void activateSurface(wlr_surface*, bool);
void activateWindow(CWindow*, bool); void activateWindow(CWindow*, bool);
void getGeometryForWindow(CWindow*, wlr_box*); void getGeometryForWindow(CWindow*, CBox*);
std::string getTitle(CWindow*); std::string getTitle(CWindow*);
std::string getAppIDClass(CWindow*); std::string getAppIDClass(CWindow*);
void sendCloseWindow(CWindow*); void sendCloseWindow(CWindow*);

View file

@ -599,8 +599,8 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
// TODO detect click on LS properly // TODO detect click on LS properly
if (*PRESIZEONBORDER && !m_bLastFocusOnLS) { if (*PRESIZEONBORDER && !m_bLastFocusOnLS) {
if (w && !w->m_bIsFullscreen) { if (w && !w->m_bIsFullscreen) {
const wlr_box real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; const CBox real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if ((!wlr_box_contains_point(&real, mouseCoords.x, mouseCoords.y) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) && !w->hasPopupAt(mouseCoords)) { if ((!real.containsPoint(mouseCoords) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) && !w->hasPopupAt(mouseCoords)) {
g_pKeybindManager->resizeWithBorder(e); g_pKeybindManager->resizeWithBorder(e);
return; return;
} }
@ -675,8 +675,8 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
const auto pWindow = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS); const auto pWindow = g_pCompositor->vectorToWindowIdeal(MOUSECOORDS);
if (*PGROUPBARSCROLLING && pWindow && !pWindow->m_bIsFullscreen && !pWindow->hasPopupAt(MOUSECOORDS) && pWindow->m_sGroupData.pNextWindow) { if (*PGROUPBARSCROLLING && pWindow && !pWindow->m_bIsFullscreen && !pWindow->hasPopupAt(MOUSECOORDS) && pWindow->m_sGroupData.pNextWindow) {
const wlr_box box = pWindow->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents(); const CBox box = pWindow->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents();
if (wlr_box_contains_point(&box, MOUSECOORDS.x, MOUSECOORDS.y)) { if (box.containsPoint(MOUSECOORDS)) {
if (e->delta > 0) if (e->delta > 0)
pWindow->setGroupCurrent(pWindow->m_sGroupData.pNextWindow); pWindow->setGroupCurrent(pWindow->m_sGroupData.pNextWindow);
else else
@ -1207,7 +1207,7 @@ void CInputManager::updateDragIcon() {
switch (m_sDrag.dragIcon->drag->grab_type) { switch (m_sDrag.dragIcon->drag->grab_type) {
case WLR_DRAG_GRAB_KEYBOARD: break; case WLR_DRAG_GRAB_KEYBOARD: break;
case WLR_DRAG_GRAB_KEYBOARD_POINTER: { case WLR_DRAG_GRAB_KEYBOARD_POINTER: {
wlr_box box = {m_sDrag.pos.x - 2, m_sDrag.pos.y - 2, m_sDrag.dragIcon->surface->current.width + 4, m_sDrag.dragIcon->surface->current.height + 4}; CBox box = {m_sDrag.pos.x - 2, m_sDrag.pos.y - 2, m_sDrag.dragIcon->surface->current.width + 4, m_sDrag.dragIcon->surface->current.height + 4};
g_pHyprRenderer->damageBox(&box); g_pHyprRenderer->damageBox(&box);
m_sDrag.pos = getMouseCoordsInternal(); m_sDrag.pos = getMouseCoordsInternal();
break; break;
@ -1474,9 +1474,9 @@ void CInputManager::setTabletConfigs() {
const auto REGION_POS = g_pConfigManager->getDeviceVec(t.name, "region_position", "input:tablet:region_position"); const auto REGION_POS = g_pConfigManager->getDeviceVec(t.name, "region_position", "input:tablet:region_position");
const auto REGION_SIZE = g_pConfigManager->getDeviceVec(t.name, "region_size", "input:tablet:region_size"); const auto REGION_SIZE = g_pConfigManager->getDeviceVec(t.name, "region_size", "input:tablet:region_size");
const auto REGION = wlr_box{REGION_POS.x, REGION_POS.y, REGION_SIZE.x, REGION_SIZE.y}; auto regionBox = CBox{REGION_POS.x, REGION_POS.y, REGION_SIZE.x, REGION_SIZE.y};
if (!wlr_box_empty(&REGION)) if (!regionBox.empty())
wlr_cursor_map_input_to_region(g_pCompositor->m_sWLRCursor, t.wlrDevice, &REGION); wlr_cursor_map_input_to_region(g_pCompositor->m_sWLRCursor, t.wlrDevice, regionBox.pWlr());
} }
} }
} }
@ -1621,14 +1621,14 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
// give a small leeway (10 px) for corner icon // give a small leeway (10 px) for corner icon
const auto CORNER = *PROUNDING + BORDERSIZE + 10; const auto CORNER = *PROUNDING + BORDERSIZE + 10;
const auto mouseCoords = getMouseCoordsInternal(); const auto mouseCoords = getMouseCoordsInternal();
wlr_box box = w->getWindowMainSurfaceBox(); CBox box = w->getWindowMainSurfaceBox();
eBorderIconDirection direction = BORDERICON_NONE; eBorderIconDirection direction = BORDERICON_NONE;
wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
if (w->hasPopupAt(mouseCoords)) if (w->hasPopupAt(mouseCoords))
direction = BORDERICON_NONE; direction = BORDERICON_NONE;
else if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow))
direction = BORDERICON_NONE; direction = BORDERICON_NONE;
else { else {
@ -1647,7 +1647,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
if (onDeco) if (onDeco)
direction = BORDERICON_NONE; direction = BORDERICON_NONE;
else { else {
if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { if (box.containsPoint(mouseCoords)) {
if (!w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) { if (!w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) {
direction = BORDERICON_NONE; direction = BORDERICON_NONE;
} else { } else {

View file

@ -178,7 +178,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
bool cursorRect = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.features & WLR_TEXT_INPUT_V3_FEATURE_CURSOR_RECTANGLE : true; bool cursorRect = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.features & WLR_TEXT_INPUT_V3_FEATURE_CURSOR_RECTANGLE : true;
const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI); const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI);
auto cursorBox = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.cursor_rectangle : PFOCUSEDTI->pV1Input->cursorRectangle; CBox cursorBox = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.cursor_rectangle : PFOCUSEDTI->pV1Input->cursorRectangle;
CMonitor* pMonitor = nullptr; CMonitor* pMonitor = nullptr;
Vector2D parentPos; Vector2D parentPos;
@ -209,7 +209,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
if (!pMonitor) if (!pMonitor)
return; return;
wlr_box finalBox = cursorBox; CBox finalBox = cursorBox;
if (cursorBox.y + parentPos.y + pPopup->pSurface->surface->current.height + finalBox.height > pMonitor->vecPosition.y + pMonitor->vecSize.y) if (cursorBox.y + parentPos.y + pPopup->pSurface->surface->current.height + finalBox.height > pMonitor->vecPosition.y + pMonitor->vecSize.y)
finalBox.y -= pPopup->pSurface->surface->current.height + finalBox.height; finalBox.y -= pPopup->pSurface->surface->current.height + finalBox.height;
@ -225,7 +225,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
pPopup->lastSize = Vector2D(pPopup->pSurface->surface->current.width, pPopup->pSurface->surface->current.height); pPopup->lastSize = Vector2D(pPopup->pSurface->surface->current.width, pPopup->pSurface->surface->current.height);
wlr_input_popup_surface_v2_send_text_input_rectangle(pPopup->pSurface, &finalBox); wlr_input_popup_surface_v2_send_text_input_rectangle(pPopup->pSurface, finalBox.pWlr());
damagePopup(pPopup); damagePopup(pPopup);
} }

View file

@ -183,7 +183,7 @@ void CScreencopyProtocolManager::removeFrame(SScreencopyFrame* frame, bool force
m_lFrames.remove(*frame); m_lFrames.remove(*frame);
} }
void CScreencopyProtocolManager::captureOutput(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, wl_resource* output, wlr_box box) { void CScreencopyProtocolManager::captureOutput(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, wl_resource* output, CBox box) {
const auto PCLIENT = clientFromResource(resource); const auto PCLIENT = clientFromResource(resource);
const auto PFRAME = &m_lFrames.emplace_back(); const auto PFRAME = &m_lFrames.emplace_back();
@ -239,8 +239,7 @@ void CScreencopyProtocolManager::captureOutput(wl_client* client, wl_resource* r
} }
int ow, oh; int ow, oh;
wlr_output_effective_resolution(PFRAME->pMonitor->output, &ow, &oh); wlr_output_effective_resolution(PFRAME->pMonitor->output, &ow, &oh);
wlr_box_transform(&PFRAME->box, &PFRAME->box, PFRAME->pMonitor->transform, ow, oh); PFRAME->box.transform(PFRAME->pMonitor->transform, ow, oh).scale(PFRAME->pMonitor->scale);
scaleBox(&PFRAME->box, PFRAME->pMonitor->scale);
PFRAME->shmStride = (PSHMINFO->bpp / 8) * PFRAME->box.width; PFRAME->shmStride = (PSHMINFO->bpp / 8) * PFRAME->box.width;

View file

@ -46,7 +46,7 @@ struct SScreencopyFrame {
uint32_t shmFormat = 0; uint32_t shmFormat = 0;
uint32_t dmabufFormat = 0; uint32_t dmabufFormat = 0;
wlr_box box = {0}; CBox box = {};
int shmStride = 0; int shmStride = 0;
bool overlayCursor = false; bool overlayCursor = false;
@ -73,7 +73,7 @@ class CScreencopyProtocolManager {
void removeFrame(SScreencopyFrame* frame, bool force = false); void removeFrame(SScreencopyFrame* frame, bool force = false);
void displayDestroy(); void displayDestroy();
void captureOutput(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, wl_resource* output, wlr_box box = {0, 0, 0, 0}); void captureOutput(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, wl_resource* output, CBox box = {0, 0, 0, 0});
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer); void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer);

View file

@ -200,7 +200,7 @@ void CTextInputV1ProtocolManager::handleSetContentType(wl_client* client, wl_res
void CTextInputV1ProtocolManager::handleSetCursorRectangle(wl_client* client, wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height) { void CTextInputV1ProtocolManager::handleSetCursorRectangle(wl_client* client, wl_resource* resource, int32_t x, int32_t y, int32_t width, int32_t height) {
const auto PTI = tiFromResource(resource); const auto PTI = tiFromResource(resource);
PTI->cursorRectangle = wlr_box{x, y, width, height}; PTI->cursorRectangle = CBox{x, y, width, height};
} }
void CTextInputV1ProtocolManager::handleSetPreferredLanguage(wl_client* client, wl_resource* resource, const char* language) { void CTextInputV1ProtocolManager::handleSetPreferredLanguage(wl_client* client, wl_resource* resource, const char* language) {

View file

@ -39,7 +39,7 @@ struct STextInputV1 {
uint32_t purpose = 0; uint32_t purpose = 0;
} pendingContentType; } pendingContentType;
wlr_box cursorRectangle = {0, 0, 0, 0}; CBox cursorRectangle = {0, 0, 0, 0};
bool operator==(const STextInputV1& other) { bool operator==(const STextInputV1& other) {
return other.client == client && other.resourceCaller == resourceCaller && other.resourceImpl == resourceImpl; return other.client == client && other.resourceCaller == resourceCaller && other.resourceImpl == resourceImpl;

View file

@ -201,7 +201,7 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
PFRAME->box = {0, 0, (int)(PFRAME->pWindow->m_vRealSize.vec().x * PMONITOR->scale), (int)(PFRAME->pWindow->m_vRealSize.vec().y * PMONITOR->scale)}; PFRAME->box = {0, 0, (int)(PFRAME->pWindow->m_vRealSize.vec().x * PMONITOR->scale), (int)(PFRAME->pWindow->m_vRealSize.vec().y * PMONITOR->scale)};
int ow, oh; int ow, oh;
wlr_output_effective_resolution(PMONITOR->output, &ow, &oh); wlr_output_effective_resolution(PMONITOR->output, &ow, &oh);
wlr_box_transform(&PFRAME->box, &PFRAME->box, PMONITOR->transform, ow, oh); PFRAME->box.transform(PMONITOR->transform, ow, oh);
PFRAME->shmStride = (PSHMINFO->bpp / 8) * PFRAME->box.width; PFRAME->shmStride = (PSHMINFO->bpp / 8) * PFRAME->box.width;
@ -301,9 +301,9 @@ void CToplevelExportProtocolManager::onOutputCommit(CMonitor* pMonitor, wlr_outp
if (PMONITOR != g_pCompositor->getMonitorFromID(f->pWindow->m_iMonitorID)) if (PMONITOR != g_pCompositor->getMonitorFromID(f->pWindow->m_iMonitorID))
continue; continue;
wlr_box geometry = {f->pWindow->m_vRealPosition.vec().x, f->pWindow->m_vRealPosition.vec().y, f->pWindow->m_vRealSize.vec().x, f->pWindow->m_vRealSize.vec().y}; CBox geometry = {f->pWindow->m_vRealPosition.vec().x, f->pWindow->m_vRealPosition.vec().y, f->pWindow->m_vRealSize.vec().x, f->pWindow->m_vRealSize.vec().y};
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry)) if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
continue; continue;
shareFrame(f); shareFrame(f);
@ -448,7 +448,7 @@ bool CToplevelExportProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame, ti
g_pHyprOpenGL->bindWlrOutputFb(); g_pHyprOpenGL->bindWlrOutputFb();
wlr_box monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y}; CBox monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f); g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f);
g_pHyprOpenGL->end(); g_pHyprOpenGL->end();

View file

@ -172,17 +172,14 @@ void CHyprOpenGLImpl::end() {
saveBufferForMirror(); // save with original damage region saveBufferForMirror(); // save with original damage region
glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb); glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb);
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
if (m_RenderData.mouseZoomFactor != 1.f) { if (m_RenderData.mouseZoomFactor != 1.f) {
const auto ZOOMCENTER = m_RenderData.mouseZoomUseMouse ? const auto ZOOMCENTER = m_RenderData.mouseZoomUseMouse ?
(g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition) * m_RenderData.pMonitor->scale : (g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition) * m_RenderData.pMonitor->scale :
m_RenderData.pMonitor->vecTransformedSize / 2.f; m_RenderData.pMonitor->vecTransformedSize / 2.f;
monbox.x -= ZOOMCENTER.x;
monbox.y -= ZOOMCENTER.y; monbox.translate(-ZOOMCENTER).scale(m_RenderData.mouseZoomFactor).translate(*PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize / 2.0 : ZOOMCENTER);
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
monbox.x += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.x / 2 : ZOOMCENTER.x;
monbox.y += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.y / 2 : ZOOMCENTER.y;
if (monbox.x > 0) if (monbox.x > 0)
monbox.x = 0; monbox.x = 0;
@ -418,7 +415,7 @@ void CHyprOpenGLImpl::clear(const CColor& color) {
} }
} }
scissor((wlr_box*)nullptr); scissor((CBox*)nullptr);
} }
void CHyprOpenGLImpl::blend(bool enabled) { void CHyprOpenGLImpl::blend(bool enabled) {
@ -431,7 +428,7 @@ void CHyprOpenGLImpl::blend(bool enabled) {
m_bBlend = enabled; m_bBlend = enabled;
} }
void CHyprOpenGLImpl::scissor(const wlr_box* pBox, bool transform) { void CHyprOpenGLImpl::scissor(const CBox* pBox, bool transform) {
RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to scissor without begin()!");
if (!pBox) { if (!pBox) {
@ -439,14 +436,14 @@ void CHyprOpenGLImpl::scissor(const wlr_box* pBox, bool transform) {
return; return;
} }
wlr_box newBox = *pBox; CBox newBox = *pBox;
if (transform) { if (transform) {
int w, h; int w, h;
wlr_output_transformed_resolution(m_RenderData.pMonitor->output, &w, &h); wlr_output_transformed_resolution(m_RenderData.pMonitor->output, &w, &h);
const auto TR = wlr_output_transform_invert(m_RenderData.pMonitor->transform); const auto TR = wlr_output_transform_invert(m_RenderData.pMonitor->transform);
wlr_box_transform(&newBox, &newBox, TR, w, h); newBox.transform(TR, w, h);
} }
glScissor(newBox.x, newBox.y, newBox.width, newBox.height); glScissor(newBox.x, newBox.y, newBox.width, newBox.height);
@ -461,22 +458,22 @@ void CHyprOpenGLImpl::scissor(const pixman_box32* pBox, bool transform) {
return; return;
} }
wlr_box newBox = {pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1}; CBox newBox = {pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1};
scissor(&newBox, transform); scissor(&newBox, transform);
} }
void CHyprOpenGLImpl::scissor(const int x, const int y, const int w, const int h, bool transform) { void CHyprOpenGLImpl::scissor(const int x, const int y, const int w, const int h, bool transform) {
wlr_box box = {x, y, w, h}; CBox box = {x, y, w, h};
scissor(&box, transform); scissor(&box, transform);
} }
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) { void CHyprOpenGLImpl::renderRect(CBox* box, const CColor& col, int round) {
if (!m_RenderData.damage.empty()) if (!m_RenderData.damage.empty())
renderRectWithDamage(box, col, &m_RenderData.damage, round); renderRectWithDamage(box, col, &m_RenderData.damage, round);
} }
void CHyprOpenGLImpl::renderRectWithBlur(wlr_box* box, const CColor& col, int round, float blurA) { void CHyprOpenGLImpl::renderRectWithBlur(CBox* box, const CColor& col, int round, float blurA) {
if (m_RenderData.damage.empty()) if (m_RenderData.damage.empty())
return; return;
@ -489,7 +486,7 @@ void CHyprOpenGLImpl::renderRectWithBlur(wlr_box* box, const CColor& col, int ro
m_RenderData.pCurrentMonData->primaryFB.bind(); m_RenderData.pCurrentMonData->primaryFB.bind();
// make a stencil for rounded corners to work with blur // make a stencil for rounded corners to work with blur
scissor((wlr_box*)nullptr); // allow the entire window and stencil to render scissor((CBox*)nullptr); // allow the entire window and stencil to render
glClearStencil(0); glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT);
@ -506,7 +503,7 @@ void CHyprOpenGLImpl::renderRectWithBlur(wlr_box* box, const CColor& col, int ro
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
scissor(box); scissor(box);
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
m_bEndFrame = true; // fix transformed m_bEndFrame = true; // fix transformed
const auto SAVEDRENDERMODIF = m_RenderData.renderModif; const auto SAVEDRENDERMODIF = m_RenderData.renderModif;
m_RenderData.renderModif = {}; // fix shit m_RenderData.renderModif = {}; // fix shit
@ -519,26 +516,24 @@ void CHyprOpenGLImpl::renderRectWithBlur(wlr_box* box, const CColor& col, int ro
glDisable(GL_STENCIL_TEST); glDisable(GL_STENCIL_TEST);
glStencilMask(-1); glStencilMask(-1);
glStencilFunc(GL_ALWAYS, 1, 0xFF); glStencilFunc(GL_ALWAYS, 1, 0xFF);
scissor((wlr_box*)nullptr); scissor((CBox*)nullptr);
renderRectWithDamage(box, col, &m_RenderData.damage, round); renderRectWithDamage(box, col, &m_RenderData.damage, round);
} }
void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, CRegion* damage, int round) { void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion* damage, int round) {
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!"); RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
TRACY_GPU_ZONE("RenderRectWithDamage"); TRACY_GPU_ZONE("RenderRectWithDamage");
wlr_box newBox = *box; CBox newBox = *box;
scaleBox(&newBox, m_RenderData.renderModif.scale); newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
newBox.x += m_RenderData.renderModif.translate.x;
newBox.y += m_RenderData.renderModif.translate.y;
box = &newBox; box = &newBox;
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
float glMatrix[9]; float glMatrix[9];
@ -556,8 +551,8 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, CReg
// premultiply the color as well as we don't work with straight alpha // premultiply the color as well as we don't work with straight alpha
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r * col.a, col.g * col.a, col.b * col.a, col.a); glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r * col.a, col.g * col.a, col.b * col.a, col.a);
wlr_box transformedBox; CBox transformedBox = *box;
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, transformedBox.transform(wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
m_RenderData.pMonitor->vecTransformedSize.y); m_RenderData.pMonitor->vecTransformedSize.y);
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y); const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
@ -592,22 +587,22 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, CReg
glDisableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.posAttrib); glDisableVertexAttribArray(m_RenderData.pCurrentMonData->m_shQUAD.posAttrib);
} }
void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha, int round, bool allowCustomUV) { void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, CBox* pBox, float alpha, int round, bool allowCustomUV) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
renderTexture(CTexture(tex), pBox, alpha, round, false, allowCustomUV); renderTexture(CTexture(tex), pBox, alpha, round, false, allowCustomUV);
} }
void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float alpha, int round, bool discardActive, bool allowCustomUV) { void CHyprOpenGLImpl::renderTexture(const CTexture& tex, CBox* pBox, float alpha, int round, bool discardActive, bool allowCustomUV) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
renderTextureInternalWithDamage(tex, pBox, alpha, &m_RenderData.damage, round, discardActive, false, allowCustomUV, true); renderTextureInternalWithDamage(tex, pBox, alpha, &m_RenderData.damage, round, discardActive, false, allowCustomUV, true);
scissor((wlr_box*)nullptr); scissor((CBox*)nullptr);
} }
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, CRegion* damage, int round, bool discardActive, bool noAA, void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* pBox, float alpha, CRegion* damage, int round, bool discardActive, bool noAA, bool allowCustomUV,
bool allowCustomUV, bool allowDim) { bool allowDim) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!"); RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
@ -618,17 +613,15 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
if (m_RenderData.damage.empty()) if (m_RenderData.damage.empty())
return; return;
wlr_box newBox = *pBox; CBox newBox = *pBox;
scaleBox(&newBox, m_RenderData.renderModif.scale); newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
newBox.x += m_RenderData.renderModif.translate.x;
newBox.y += m_RenderData.renderModif.translate.y;
static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue; static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue;
// get transform // get transform
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, &newBox, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix); wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
float glMatrix[9]; float glMatrix[9];
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
@ -711,8 +704,8 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
} }
} }
wlr_box transformedBox; CBox transformedBox = newBox;
wlr_box_transform(&transformedBox, &newBox, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, transformedBox.transform(wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
m_RenderData.pMonitor->vecTransformedSize.y); m_RenderData.pMonitor->vecTransformedSize.y);
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y); const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
@ -774,7 +767,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
glBindTexture(tex.m_iTarget, 0); glBindTexture(tex.m_iTarget, 0);
} }
void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, wlr_box* pBox) { void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, CBox* pBox) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!"); RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
@ -783,15 +776,13 @@ void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, wlr_box* pBox)
if (m_RenderData.damage.empty()) if (m_RenderData.damage.empty())
return; return;
wlr_box newBox = *pBox; CBox newBox = *pBox;
scaleBox(&newBox, m_RenderData.renderModif.scale); newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
newBox.x += m_RenderData.renderModif.translate.x;
newBox.y += m_RenderData.renderModif.translate.y;
// get transform // get transform
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, &newBox, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix); wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
float glMatrix[9]; float glMatrix[9];
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
@ -822,7 +813,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, wlr_box* pBox)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
} }
scissor((wlr_box*)nullptr); scissor((CBox*)nullptr);
glDisableVertexAttribArray(shader->posAttrib); glDisableVertexAttribArray(shader->posAttrib);
glDisableVertexAttribArray(shader->texAttrib); glDisableVertexAttribArray(shader->texAttrib);
@ -845,8 +836,8 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
// get transforms for the full monitor // get transforms for the full monitor
const auto TRANSFORM = wlr_output_transform_invert(m_RenderData.pMonitor->transform); const auto TRANSFORM = wlr_output_transform_invert(m_RenderData.pMonitor->transform);
float matrix[9]; float matrix[9];
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix); wlr_matrix_project_box(matrix, MONITORBOX.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
float glMatrix[9]; float glMatrix[9];
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
@ -1138,7 +1129,7 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
// make the fake dmg // make the fake dmg
CRegion fakeDamage{0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CRegion fakeDamage{0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
wlr_box wholeMonitor = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox wholeMonitor = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
const auto POUTFB = blurMainFramebufferWithDamage(1, &fakeDamage); const auto POUTFB = blurMainFramebufferWithDamage(1, &fakeDamage);
// render onto blurFB // render onto blurFB
@ -1197,7 +1188,7 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWind
return false; return false;
} }
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round, bool blockBlurOptimization, float blurA) { void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, float a, wlr_surface* pSurface, int round, bool blockBlurOptimization, float blurA) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
static auto* const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue;
@ -1251,7 +1242,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
m_RenderData.pCurrentMonData->primaryFB.bind(); m_RenderData.pCurrentMonData->primaryFB.bind();
// make a stencil for rounded corners to work with blur // make a stencil for rounded corners to work with blur
scissor((wlr_box*)nullptr); // allow the entire window and stencil to render scissor((CBox*)nullptr); // allow the entire window and stencil to render
glClearStencil(0); glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT);
@ -1271,7 +1262,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
// stencil done. Render everything. // stencil done. Render everything.
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
// render our great blurred FB // render our great blurred FB
static auto* const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur:ignore_opacity")->intValue; static auto* const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur:ignore_opacity")->intValue;
m_bEndFrame = true; // fix transformed m_bEndFrame = true; // fix transformed
@ -1291,17 +1282,17 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
glStencilMask(-1); glStencilMask(-1);
glStencilFunc(GL_ALWAYS, 1, 0xFF); glStencilFunc(GL_ALWAYS, 1, 0xFF);
scissor((wlr_box*)nullptr); scissor((CBox*)nullptr);
} }
void pushVert2D(float x, float y, float* arr, int& counter, wlr_box* box) { void pushVert2D(float x, float y, float* arr, int& counter, CBox* box) {
// 0-1 space god damnit // 0-1 space god damnit
arr[counter * 2 + 0] = x / box->width; arr[counter * 2 + 0] = x / box->width;
arr[counter * 2 + 1] = y / box->height; arr[counter * 2 + 1] = y / box->height;
counter++; counter++;
} }
void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad, int round, int borderSize, float a, int outerRound) { void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, int round, int borderSize, float a, int outerRound) {
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!"); RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
@ -1310,10 +1301,8 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
if (m_RenderData.damage.empty() || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBorder)) if (m_RenderData.damage.empty() || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBorder))
return; return;
wlr_box newBox = *box; CBox newBox = *box;
scaleBox(&newBox, m_RenderData.renderModif.scale); newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
newBox.x += m_RenderData.renderModif.translate.x;
newBox.y += m_RenderData.renderModif.translate.y;
box = &newBox; box = &newBox;
@ -1331,7 +1320,7 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
round += round == 0 ? 0 : scaledBorderSize; round += round == 0 ? 0 : scaledBorderSize;
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
float glMatrix[9]; float glMatrix[9];
@ -1356,8 +1345,8 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad,
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.angle, (int)(grad.m_fAngle / (PI / 180.0)) % 360 * (PI / 180.0)); glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.angle, (int)(grad.m_fAngle / (PI / 180.0)) % 360 * (PI / 180.0));
glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.alpha, a); glUniform1f(m_RenderData.pCurrentMonData->m_shBORDER1.alpha, a);
wlr_box transformedBox; CBox transformedBox = *box;
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, transformedBox.transform(wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
m_RenderData.pMonitor->vecTransformedSize.y); m_RenderData.pMonitor->vecTransformedSize.y);
const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y); const auto TOPLEFT = Vector2D(transformedBox.x, transformedBox.y);
@ -1587,7 +1576,7 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
wlr_box windowBox; CBox windowBox;
// some mafs to figure out the correct box // some mafs to figure out the correct box
// the originalClosedPos is relative to the monitor's pos // the originalClosedPos is relative to the monitor's pos
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)), Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.vec().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)),
@ -1601,7 +1590,7 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
if (*PDIMAROUND && (*pWindow)->m_sAdditionalConfigData.dimAround) { if (*PDIMAROUND && (*pWindow)->m_sAdditionalConfigData.dimAround) {
wlr_box monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y}; CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * PWINDOW->m_fAlpha.fl())); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * PWINDOW->m_fAlpha.fl()));
g_pHyprRenderer->damageMonitor(PMONITOR); g_pHyprRenderer->damageMonitor(PMONITOR);
} }
@ -1629,7 +1618,7 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PLAYER->monitorID);
wlr_box monbox = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; CBox monbox = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
@ -1640,7 +1629,7 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
m_bEndFrame = false; m_bEndFrame = false;
} }
void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, float a, CFramebuffer* matte) { void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, float a, CFramebuffer* matte) {
RASSERT(m_RenderData.pMonitor, "Tried to render shadow without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render shadow without begin()!");
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!"); RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
RASSERT(m_pCurrentWindow, "Tried to render shadow without a window!"); RASSERT(m_pCurrentWindow, "Tried to render shadow without a window!");
@ -1650,10 +1639,8 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
TRACY_GPU_ZONE("RenderShadow"); TRACY_GPU_ZONE("RenderShadow");
wlr_box newBox = *box; CBox newBox = *box;
scaleBox(&newBox, m_RenderData.renderModif.scale); newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate);
newBox.x += m_RenderData.renderModif.translate.x;
newBox.y += m_RenderData.renderModif.translate.y;
box = &newBox; box = &newBox;
@ -1665,7 +1652,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
const auto col = m_pCurrentWindow->m_cRealShadowColor.col(); const auto col = m_pCurrentWindow->m_cRealShadowColor.col();
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, box, wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0,
m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
float glMatrix[9]; float glMatrix[9];
@ -1752,7 +1739,7 @@ void CHyprOpenGLImpl::saveBufferForMirror() {
m_RenderData.pCurrentMonData->monitorMirrorFB.bind(); m_RenderData.pCurrentMonData->monitorMirrorFB.bind();
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; CBox monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
blend(false); blend(false);
@ -1764,7 +1751,7 @@ void CHyprOpenGLImpl::saveBufferForMirror() {
} }
void CHyprOpenGLImpl::renderMirrored() { void CHyprOpenGLImpl::renderMirrored() {
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y}; CBox monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
const auto PFB = &m_mMonitorRenderResources[m_RenderData.pMonitor->pMirrorOf].monitorMirrorFB; const auto PFB = &m_mMonitorRenderResources[m_RenderData.pMonitor->pMirrorOf].monitorMirrorFB;
@ -1867,7 +1854,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
origin.x = (m_RenderData.pMonitor->vecTransformedSize.x - PTEX->m_vSize.x * scale) / 2.0; origin.x = (m_RenderData.pMonitor->vecTransformedSize.x - PTEX->m_vSize.x * scale) / 2.0;
} }
wlr_box box = {origin.x, origin.y, PTEX->m_vSize.x * scale, PTEX->m_vSize.y * scale}; CBox box = {origin.x, origin.y, PTEX->m_vSize.x * scale, PTEX->m_vSize.y * scale};
m_mMonitorRenderResources[pMonitor].backgroundTexBox = box; m_mMonitorRenderResources[pMonitor].backgroundTexBox = box;
@ -1954,7 +1941,7 @@ void CHyprOpenGLImpl::bindOffMain() {
} }
void CHyprOpenGLImpl::renderOffToMain(CFramebuffer* off) { void CHyprOpenGLImpl::renderOffToMain(CFramebuffer* off) {
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
renderTexturePrimitive(off->m_cTex, &monbox); renderTexturePrimitive(off->m_cTex, &monbox);
} }

View file

@ -52,7 +52,7 @@ struct SMonitorRenderData {
bool blurFBDirty = true; bool blurFBDirty = true;
bool blurFBShouldRender = false; bool blurFBShouldRender = false;
wlr_box backgroundTexBox; CBox backgroundTexBox;
// Shaders // Shaders
bool m_bShadersInitialized = false; bool m_bShadersInitialized = false;
@ -89,7 +89,7 @@ struct SCurrentRenderData {
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1); Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1); Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
wlr_box clipBox = {}; CBox clipBox = {};
uint32_t discardMode = DISCARD_OPAQUE; uint32_t discardMode = DISCARD_OPAQUE;
float discardOpacity = 0.f; float discardOpacity = 0.f;
@ -105,14 +105,14 @@ class CHyprOpenGLImpl {
void end(); void end();
void bindWlrOutputFb(); void bindWlrOutputFb();
void renderRect(wlr_box*, const CColor&, int round = 0); void renderRect(CBox*, const CColor&, int round = 0);
void renderRectWithBlur(wlr_box*, const CColor&, int round = 0, float blurA = 1.f); void renderRectWithBlur(CBox*, const CColor&, int round = 0, float blurA = 1.f);
void renderRectWithDamage(wlr_box*, const CColor&, CRegion* damage, int round = 0); void renderRectWithDamage(CBox*, const CColor&, CRegion* damage, int round = 0);
void renderTexture(wlr_texture*, wlr_box*, float a, int round = 0, bool allowCustomUV = false); void renderTexture(wlr_texture*, CBox*, float a, int round = 0, bool allowCustomUV = false);
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false); void renderTexture(const CTexture&, CBox*, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false);
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0, bool blockBlurOptimization = false, float blurA = 1.f); void renderTextureWithBlur(const CTexture&, CBox*, float a, wlr_surface* pSurface, int round = 0, bool blockBlurOptimization = false, float blurA = 1.f);
void renderRoundedShadow(wlr_box*, int round, int range, float a = 1.0, CFramebuffer* matte = nullptr); void renderRoundedShadow(CBox*, int round, int range, float a = 1.0, CFramebuffer* matte = nullptr);
void renderBorder(wlr_box*, const CGradientValueData&, int round, int borderSize, float a = 1.0, int outerRound = -1 /* use round */); void renderBorder(CBox*, const CGradientValueData&, int round, int borderSize, float a = 1.0, int outerRound = -1 /* use round */);
void saveMatrix(); void saveMatrix();
void setMatrixScaleTranslate(const Vector2D& translate, const float& scale); void setMatrixScaleTranslate(const Vector2D& translate, const float& scale);
@ -128,7 +128,7 @@ class CHyprOpenGLImpl {
void clear(const CColor&); void clear(const CColor&);
void clearWithTex(); void clearWithTex();
void scissor(const wlr_box*, bool transform = true); void scissor(const CBox*, bool transform = true);
void scissor(const pixman_box32*, bool transform = true); void scissor(const pixman_box32*, bool transform = true);
void scissor(const int x, const int y, const int w, const int h, bool transform = true); void scissor(const int x, const int y, const int w, const int h, bool transform = true);
@ -187,9 +187,9 @@ class CHyprOpenGLImpl {
// returns the out FB, can be either Mirror or MirrorSwap // returns the out FB, can be either Mirror or MirrorSwap
CFramebuffer* blurMainFramebufferWithDamage(float a, CRegion* damage); CFramebuffer* blurMainFramebufferWithDamage(float a, CRegion* damage);
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, CRegion* damage, int round = 0, bool discardOpaque = false, bool noAA = false, void renderTextureInternalWithDamage(const CTexture&, CBox* pBox, float a, CRegion* damage, int round = 0, bool discardOpaque = false, bool noAA = false,
bool allowCustomUV = false, bool allowDim = false); bool allowCustomUV = false, bool allowDim = false);
void renderTexturePrimitive(const CTexture& tex, wlr_box* pBox); void renderTexturePrimitive(const CTexture& tex, CBox* pBox);
void renderSplash(cairo_t* const, cairo_surface_t* const, double); void renderSplash(cairo_t* const, cairo_surface_t* const, double);
void preBlurForCurrentMonitor(); void preBlurForCurrentMonitor();

View file

@ -22,7 +22,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
double outputX = 0, outputY = 0; double outputX = 0, outputY = 0;
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, RDATA->pMonitor->output, &outputX, &outputY); wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, RDATA->pMonitor->output, &outputX, &outputY);
wlr_box windowBox; CBox windowBox;
if (RDATA->surface && surface == RDATA->surface) { if (RDATA->surface && surface == RDATA->surface) {
windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h}; windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h};
@ -67,7 +67,8 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
g_pHyprRenderer->calculateUVForSurface(RDATA->pWindow, surface, RDATA->squishOversized); g_pHyprRenderer->calculateUVForSurface(RDATA->pWindow, surface, RDATA->squishOversized);
scaleBox(&windowBox, RDATA->pMonitor->scale); windowBox.scale(RDATA->pMonitor->scale);
windowBox.round();
float rounding = RDATA->rounding; float rounding = RDATA->rounding;
@ -110,9 +111,9 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
} }
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor, CWorkspace* pWorkspace) { bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor, CWorkspace* pWorkspace) {
wlr_box geometry = pWindow->getFullWindowBoundingBox(); CBox geometry = pWindow->getFullWindowBoundingBox();
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry)) if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
return false; return false;
if (pWindow->m_iWorkspaceID == -1) if (pWindow->m_iWorkspaceID == -1)
@ -343,7 +344,14 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue;
SRenderData renderdata = {pMonitor, time, REALPOS.x, REALPOS.y}; SRenderData renderdata = {pMonitor, time};
CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.vec().x, 5.0), std::max(pWindow->m_vRealSize.vec().y, 5.0)};
renderdata.x = textureBox.x;
renderdata.y = textureBox.y;
renderdata.w = textureBox.w;
renderdata.h = textureBox.h;
if (ignorePosition) { if (ignorePosition) {
renderdata.x = pMonitor->vecPosition.x; renderdata.x = pMonitor->vecPosition.x;
renderdata.y = pMonitor->vecPosition.y; renderdata.y = pMonitor->vecPosition.y;
@ -353,8 +361,6 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
decorate = false; decorate = false;
renderdata.surface = pWindow->m_pWLSurface.wlr(); renderdata.surface = pWindow->m_pWLSurface.wlr();
renderdata.w = std::max(pWindow->m_vRealSize.vec().x, 5.0); // clamp the size to min 5,
renderdata.h = std::max(pWindow->m_vRealSize.vec().y, 5.0); // otherwise we'll have issues later with invalid boxes
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding); renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl()); renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl(); renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
@ -377,7 +383,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOW); EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOW);
if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) { if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) {
wlr_box monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y}; CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha)); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha));
} }
@ -446,8 +452,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true; g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && *PBLUR) { if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && *PBLUR) {
wlr_box wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
scaleBox(&wb, pMonitor->scale); wb.scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha); g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha);
renderdata.blur = false; renderdata.blur = false;
} }
@ -466,9 +472,9 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
grad.m_fAngle = normalizeAngleRad(grad.m_fAngle); grad.m_fAngle = normalizeAngleRad(grad.m_fAngle);
} }
wlr_box windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; CBox windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
scaleBox(&windowBox, pMonitor->scale); windowBox.scale(pMonitor->scale).round();
int borderSize = pWindow->m_sSpecialRenderData.borderSize.toUnderlying() == -1 ? *PBORDERSIZE : pWindow->m_sSpecialRenderData.borderSize.toUnderlying(); int borderSize = pWindow->m_sSpecialRenderData.borderSize.toUnderlying() == -1 ? *PBORDERSIZE : pWindow->m_sSpecialRenderData.borderSize.toUnderlying();
if (pWindow->m_sAdditionalConfigData.borderSize.toUnderlying() != -1) if (pWindow->m_sAdditionalConfigData.borderSize.toUnderlying() != -1)
@ -503,8 +509,9 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_POPUP) { if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_POPUP) {
if (!pWindow->m_bIsX11) { if (!pWindow->m_bIsX11) {
wlr_box geom; CBox geom;
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, &geom); wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, geom.pWlr());
geom.applyFromWlr();
renderdata.x -= geom.x; renderdata.x -= geom.x;
renderdata.y -= geom.y; renderdata.y -= geom.y;
@ -604,7 +611,7 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
if (!g_pCompositor->m_sSeat.exclusiveClient && g_pSessionLockManager->isSessionLocked()) { if (!g_pCompositor->m_sSeat.exclusiveClient && g_pSessionLockManager->isSessionLocked()) {
// locked with no exclusive, draw only red // locked with no exclusive, draw only red
wlr_box boxe = {0, 0, INT16_MAX, INT16_MAX}; CBox boxe = {0, 0, INT16_MAX, INT16_MAX};
g_pHyprOpenGL->renderRect(&boxe, CColor(1.0, 0.2, 0.2, 1.0)); g_pHyprOpenGL->renderRect(&boxe, CColor(1.0, 0.2, 0.2, 1.0));
return; return;
} }
@ -654,12 +661,12 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
const bool ANIMOUT = !pMonitor->specialWorkspaceID; const bool ANIMOUT = !pMonitor->specialWorkspaceID;
if (*PDIMSPECIAL != 0.f) { if (*PDIMSPECIAL != 0.f) {
wlr_box monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale}; CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS))); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
} }
if (*PBLURSPECIAL && *PBLUR) { if (*PBLURSPECIAL && *PBLUR) {
wlr_box monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale}; CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
g_pHyprOpenGL->renderRectWithBlur(&monbox, CColor(0, 0, 0, 0), 0, (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)); g_pHyprOpenGL->renderRectWithBlur(&monbox, CColor(0, 0, 0, 0), 0, (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS));
} }
@ -711,7 +718,7 @@ void CHyprRenderer::renderLockscreen(CMonitor* pMonitor, timespec* now) {
if (!PSLS) { if (!PSLS) {
// locked with no surface, fill with red // locked with no surface, fill with red
wlr_box boxe = {0, 0, INT16_MAX, INT16_MAX}; CBox boxe = {0, 0, INT16_MAX, INT16_MAX};
g_pHyprOpenGL->renderRect(&boxe, CColor(1.0, 0.2, 0.2, 1.0)); g_pHyprOpenGL->renderRect(&boxe, CColor(1.0, 0.2, 0.2, 1.0));
} else { } else {
renderSessionLockSurface(PSLS, pMonitor, now); renderSessionLockSurface(PSLS, pMonitor, now);
@ -753,8 +760,9 @@ void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurfac
if (!main || !pWindow) if (!main || !pWindow)
return; return;
wlr_box geom; CBox geom;
wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, &geom); wlr_xdg_surface_get_geometry(pWindow->m_uSurface.xdg, geom.pWlr());
geom.applyFromWlr();
// ignore X and Y, adjust uv // ignore X and Y, adjust uv
if (geom.x != 0 || geom.y != 0 || geom.width > pWindow->m_vRealSize.vec().x || geom.height > pWindow->m_vRealSize.vec().y) { if (geom.x != 0 || geom.y != 0 || geom.width > pWindow->m_vRealSize.vec().x || geom.height > pWindow->m_vRealSize.vec().y) {
@ -1073,7 +1081,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} }
g_pHyprOpenGL->blend(true); g_pHyprOpenGL->blend(true);
wlr_box renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y}; CBox renderBox = {0, 0, (int)pMonitor->vecPixelSize.x, (int)pMonitor->vecPixelSize.y};
renderWorkspace(pMonitor, g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace), &now, renderBox); renderWorkspace(pMonitor, g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace), &now, renderBox);
renderLockscreen(pMonitor, &now); renderLockscreen(pMonitor, &now);
@ -1091,7 +1099,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} }
if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { if (*PDAMAGEBLINK && damageBlinkCleanup == 0) {
wlr_box monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y}; CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0); g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0);
damageBlinkCleanup = 1; damageBlinkCleanup = 1;
} else if (*PDAMAGEBLINK) { } else if (*PDAMAGEBLINK) {
@ -1193,7 +1201,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} }
} }
void CHyprRenderer::renderWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const wlr_box& geometry) { void CHyprRenderer::renderWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const CBox& geometry) {
Vector2D translate = {geometry.x, geometry.y}; Vector2D translate = {geometry.x, geometry.y};
float scale = (float)geometry.width / pMonitor->vecPixelSize.x; float scale = (float)geometry.width / pMonitor->vecPixelSize.x;
@ -1350,8 +1358,8 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu
} }
} }
void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std::unique_ptr<SLayerSurface>>& layerSurfaces, bool exclusiveZone, wlr_box* usableArea) { void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std::unique_ptr<SLayerSurface>>& layerSurfaces, bool exclusiveZone, CBox* usableArea) {
wlr_box full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y}; CBox full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
for (auto& ls : layerSurfaces) { for (auto& ls : layerSurfaces) {
if (ls->fadingOut || ls->readyToDelete || !ls->layerSurface || ls->noProcess) if (ls->fadingOut || ls->readyToDelete || !ls->layerSurface || ls->noProcess)
@ -1362,7 +1370,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
if (exclusiveZone != (PSTATE->exclusive_zone > 0)) if (exclusiveZone != (PSTATE->exclusive_zone > 0))
continue; continue;
wlr_box bounds; CBox bounds;
if (PSTATE->exclusive_zone == -1) if (PSTATE->exclusive_zone == -1)
bounds = full_area; bounds = full_area;
else else
@ -1370,7 +1378,7 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
const Vector2D OLDSIZE = {ls->geometry.width, ls->geometry.height}; const Vector2D OLDSIZE = {ls->geometry.width, ls->geometry.height};
wlr_box box = {.width = PSTATE->desired_width, .height = PSTATE->desired_height}; CBox box = {0, 0, PSTATE->desired_width, PSTATE->desired_height};
// Horizontal axis // Horizontal axis
const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
if (box.width == 0) { if (box.width == 0) {
@ -1425,7 +1433,9 @@ void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector<std:
// Apply // Apply
ls->geometry = box; ls->geometry = box;
apply_exclusive(usableArea, PSTATE->anchor, PSTATE->exclusive_zone, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left); apply_exclusive(usableArea->pWlr(), PSTATE->anchor, PSTATE->exclusive_zone, PSTATE->margin.top, PSTATE->margin.right, PSTATE->margin.bottom, PSTATE->margin.left);
usableArea->applyFromWlr();
if (Vector2D{box.width, box.height} != OLDSIZE) if (Vector2D{box.width, box.height} != OLDSIZE)
wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height); wlr_layer_surface_v1_configure(ls->layerSurface, box.width, box.height);
@ -1445,7 +1455,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
PMONITOR->vecReservedBottomRight = Vector2D(); PMONITOR->vecReservedBottomRight = Vector2D();
PMONITOR->vecReservedTopLeft = Vector2D(); PMONITOR->vecReservedTopLeft = Vector2D();
wlr_box usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y}; CBox usableArea = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
for (auto& la : PMONITOR->m_aLayerSurfaceLayers) for (auto& la : PMONITOR->m_aLayerSurfaceLayers)
arrangeLayerArray(PMONITOR, la, true, &usableArea); arrangeLayerArray(PMONITOR, la, true, &usableArea);
@ -1529,10 +1539,10 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
if (g_pCompositor->m_bUnsafeState) if (g_pCompositor->m_bUnsafeState)
return; return;
wlr_box damageBox = pWindow->getFullWindowBoundingBox(); CBox damageBox = pWindow->getFullWindowBoundingBox();
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
wlr_box fixedDamageBox = {damageBox.x - m->vecPosition.x, damageBox.y - m->vecPosition.y, damageBox.width, damageBox.height}; CBox fixedDamageBox = {damageBox.x - m->vecPosition.x, damageBox.y - m->vecPosition.y, damageBox.width, damageBox.height};
scaleBox(&fixedDamageBox, m->scale); fixedDamageBox.scale(m->scale);
m->addDamage(&fixedDamageBox); m->addDamage(&fixedDamageBox);
} }
@ -1549,7 +1559,7 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
if (g_pCompositor->m_bUnsafeState || pMonitor->isMirror()) if (g_pCompositor->m_bUnsafeState || pMonitor->isMirror())
return; return;
wlr_box damageBox = {0, 0, INT16_MAX, INT16_MAX}; CBox damageBox = {0, 0, INT16_MAX, INT16_MAX};
pMonitor->addDamage(&damageBox); pMonitor->addDamage(&damageBox);
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
@ -1558,7 +1568,7 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName); Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName);
} }
void CHyprRenderer::damageBox(wlr_box* pBox) { void CHyprRenderer::damageBox(CBox* pBox) {
if (g_pCompositor->m_bUnsafeState) if (g_pCompositor->m_bUnsafeState)
return; return;
@ -1566,8 +1576,8 @@ void CHyprRenderer::damageBox(wlr_box* pBox) {
if (m->isMirror()) if (m->isMirror())
continue; // don't damage mirrors traditionally continue; // don't damage mirrors traditionally
wlr_box damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height}; CBox damageBox = {pBox->x - m->vecPosition.x, pBox->y - m->vecPosition.y, pBox->width, pBox->height};
scaleBox(&damageBox, m->scale); damageBox.scale(m->scale);
m->addDamage(&damageBox); m->addDamage(&damageBox);
} }
@ -1578,7 +1588,7 @@ void CHyprRenderer::damageBox(wlr_box* pBox) {
} }
void CHyprRenderer::damageBox(const int& x, const int& y, const int& w, const int& h) { void CHyprRenderer::damageBox(const int& x, const int& y, const int& w, const int& h) {
wlr_box box = {x, y, w, h}; CBox box = {x, y, w, h};
damageBox(&box); damageBox(&box);
} }
@ -1611,7 +1621,7 @@ void CHyprRenderer::renderDragIcon(CMonitor* pMonitor, timespec* time) {
wlr_surface_for_each_surface(g_pInputManager->m_sDrag.dragIcon->surface, renderSurface, &renderdata); wlr_surface_for_each_surface(g_pInputManager->m_sDrag.dragIcon->surface, renderSurface, &renderdata);
wlr_box box = {g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4, CBox box = {g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4,
g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4}; g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4};
g_pHyprRenderer->damageBox(&box); g_pHyprRenderer->damageBox(&box);
} }
@ -1934,9 +1944,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecTransformedSize = Vector2D(x, y); pMonitor->vecTransformedSize = Vector2D(x, y);
if (pMonitor->createdByUser) { if (pMonitor->createdByUser) {
wlr_box transformedBox = {0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y}; CBox transformedBox = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y};
wlr_box_transform(&transformedBox, &transformedBox, wlr_output_transform_invert(pMonitor->output->transform), (int)pMonitor->vecTransformedSize.x, transformedBox.transform(wlr_output_transform_invert(pMonitor->output->transform), pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y);
(int)pMonitor->vecTransformedSize.y);
pMonitor->vecPixelSize = Vector2D(transformedBox.width, transformedBox.height); pMonitor->vecPixelSize = Vector2D(transformedBox.width, transformedBox.height);
} }
@ -2092,9 +2101,9 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorks
const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{ROUNDING, ROUNDING} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec()); const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{ROUNDING, ROUNDING} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec());
const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{ROUNDING * 2, ROUNDING * 2}; const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{ROUNDING * 2, ROUNDING * 2};
wlr_box box = {POS.x, POS.y, SIZE.x, SIZE.y}; CBox box = {POS.x, POS.y, SIZE.x, SIZE.y};
scaleBox(&box, PMONITOR->scale); box.scale(PMONITOR->scale);
rg.add(&box); rg.add(&box);
} }

View file

@ -40,7 +40,7 @@ class CHyprRenderer {
void arrangeLayersForMonitor(const int&); void arrangeLayersForMonitor(const int&);
void damageSurface(wlr_surface*, double, double, double scale = 1.0); void damageSurface(wlr_surface*, double, double, double scale = 1.0);
void damageWindow(CWindow*); void damageWindow(CWindow*);
void damageBox(wlr_box*); void damageBox(CBox*);
void damageBox(const int& x, const int& y, const int& w, const int& h); void damageBox(const int& x, const int& y, const int& w, const int& h);
void damageRegion(const CRegion&); void damageRegion(const CRegion&);
void damageMonitor(CMonitor*); void damageMonitor(CMonitor*);
@ -89,7 +89,7 @@ class CHyprRenderer {
} m_sLastCursorData; } m_sLastCursorData;
private: private:
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*); void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, CBox*);
void renderWorkspaceWindowsFullscreen(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special) void renderWorkspaceWindowsFullscreen(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
void renderWorkspaceWindows(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special) void renderWorkspaceWindows(CMonitor*, CWorkspace*, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false); void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
@ -97,7 +97,7 @@ class CHyprRenderer {
void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*); void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*);
void renderDragIcon(CMonitor*, timespec*); void renderDragIcon(CMonitor*, timespec*);
void renderIMEPopup(SIMEPopup*, CMonitor*, timespec*); void renderIMEPopup(SIMEPopup*, CMonitor*, timespec*);
void renderWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const wlr_box& geometry); void renderWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const CBox& geometry);
void renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const Vector2D& translate = {0, 0}, const float& scale = 1.f); void renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* now, const Vector2D& translate = {0, 0}, const float& scale = 1.f);
bool m_bHasARenderedCursor = true; bool m_bHasARenderedCursor = true;

View file

@ -29,7 +29,7 @@ void CHyprDropShadowDecoration::damageEntire() {
if (*PSHADOWS != 1) if (*PSHADOWS != 1)
return; // disabled return; // disabled
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, CBox dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y}; m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
g_pHyprRenderer->damageBox(&dm); g_pHyprRenderer->damageBox(&dm);
} }
@ -68,9 +68,8 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
maxExtents.bottomRight.y = EXTENTS.bottomRight.y; maxExtents.bottomRight.y = EXTENTS.bottomRight.y;
} }
m_bLastWindowBox = {(int)(m_vLastWindowPos.x - maxExtents.topLeft.x - BORDER), (int)(m_vLastWindowPos.y - maxExtents.topLeft.y - BORDER), m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
(int)(m_vLastWindowSize.x + maxExtents.topLeft.x + maxExtents.bottomRight.x + 2 * BORDER), m_eLastExtents = {{maxExtents.topLeft + Vector2D{BORDER, BORDER}}, {maxExtents.bottomRight + Vector2D{BORDER, BORDER}}};
(int)(m_vLastWindowSize.y + maxExtents.topLeft.y + maxExtents.bottomRight.y + 2 * BORDER)};
} }
} }
@ -103,55 +102,40 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize(); const auto ROUNDING = m_pWindow->rounding() + m_pWindow->getRealBorderSize();
// draw the shadow // draw the shadow
wlr_box fullBox = {m_bLastWindowBox.x - *PSHADOWSIZE, m_bLastWindowBox.y - *PSHADOWSIZE, m_bLastWindowBox.width + 2.0 * *PSHADOWSIZE, CBox fullBox = {m_bLastWindowBox.x, m_bLastWindowBox.y, m_bLastWindowBox.width, m_bLastWindowBox.height};
m_bLastWindowBox.height + 2.0 * *PSHADOWSIZE}; fullBox.addExtents(m_eLastExtents).translate(-pMonitor->vecPosition);
fullBox.x -= *PSHADOWSIZE;
fullBox.x -= pMonitor->vecPosition.x; fullBox.y -= *PSHADOWSIZE;
fullBox.y -= pMonitor->vecPosition.y; fullBox.w += 2 * *PSHADOWSIZE;
fullBox.h += 2 * *PSHADOWSIZE;
const float SHADOWSCALE = std::clamp(*PSHADOWSCALE, 0.f, 1.f); const float SHADOWSCALE = std::clamp(*PSHADOWSCALE, 0.f, 1.f);
// scale the box in relation to the center of the box // scale the box in relation to the center of the box
const Vector2D NEWSIZE = Vector2D{fullBox.width, fullBox.height} * SHADOWSCALE; fullBox.scaleFromCenter(SHADOWSCALE).translate(*PSHADOWOFFSET);
fullBox.width = NEWSIZE.x;
fullBox.height = NEWSIZE.y;
if (PSHADOWOFFSET->x < 0) {
fullBox.x += PSHADOWOFFSET->x;
} else if (PSHADOWOFFSET->x > 0) {
fullBox.x = m_bLastWindowBox.x + m_bLastWindowBox.width - fullBox.width + (SHADOWSCALE * *PSHADOWSIZE) + PSHADOWOFFSET->x - pMonitor->vecPosition.x;
} else {
fullBox.x += ((m_bLastWindowBox.width + 2.0 * *PSHADOWSIZE) - NEWSIZE.x) / 2.0;
}
if (PSHADOWOFFSET->y < 0) {
fullBox.y += PSHADOWOFFSET->y;
} else if (PSHADOWOFFSET->y > 0) {
fullBox.y = m_bLastWindowBox.y + m_bLastWindowBox.height - fullBox.height + (SHADOWSCALE * *PSHADOWSIZE) + PSHADOWOFFSET->y - pMonitor->vecPosition.y;
} else {
fullBox.y += ((m_bLastWindowBox.height + 2.0 * *PSHADOWSIZE) - NEWSIZE.y) / 2.0;
}
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2}, m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2, {fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}}; fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
fullBox.x += offset.x; fullBox.translate(offset);
fullBox.y += offset.y;
if (fullBox.width < 1 || fullBox.height < 1) if (fullBox.width < 1 || fullBox.height < 1)
return; // don't draw invisible shadows return; // don't draw invisible shadows
g_pHyprOpenGL->scissor((wlr_box*)nullptr); g_pHyprOpenGL->scissor((CBox*)nullptr);
// we'll take the liberty of using this as it should not be used rn // we'll take the liberty of using this as it should not be used rn
CFramebuffer& alphaFB = g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorFB; CFramebuffer& alphaFB = g_pHyprOpenGL->m_RenderData.pCurrentMonData->mirrorFB;
auto* LASTFB = g_pHyprOpenGL->m_RenderData.currentFB; auto* LASTFB = g_pHyprOpenGL->m_RenderData.currentFB;
if (*PSHADOWIGNOREWINDOW) { if (*PSHADOWIGNOREWINDOW) {
wlr_box windowBox = {m_bLastWindowBox.x - pMonitor->vecPosition.x, m_bLastWindowBox.y - pMonitor->vecPosition.y, m_bLastWindowBox.width, m_bLastWindowBox.height}; CBox windowBox = m_bLastWindowBox;
scaleBox(&windowBox, pMonitor->scale); windowBox.translate(-pMonitor->vecPosition).scale(pMonitor->scale);
windowBox.round();
windowBox.addExtents(SWindowDecorationExtents{m_eLastExtents * pMonitor->scale}.floor()).round();
if (windowBox.width < 1 || windowBox.height < 1) { if (windowBox.width < 1 || windowBox.height < 1) {
return; // prevent assert failed return; // prevent assert failed
@ -165,7 +149,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
LASTFB->bind(); LASTFB->bind();
} }
scaleBox(&fullBox, pMonitor->scale); fullBox.scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, a, &alphaFB); g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, a, &alphaFB);
} }

View file

@ -27,5 +27,6 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
Vector2D m_vLastWindowPos; Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize; Vector2D m_vLastWindowSize;
wlr_box m_bLastWindowBox = {0}; CBox m_bLastWindowBox = {0};
SWindowDecorationExtents m_eLastExtents = {};
}; };

View file

@ -76,7 +76,7 @@ void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) {
} }
void CHyprGroupBarDecoration::damageEntire() { void CHyprGroupBarDecoration::damageEntire() {
wlr_box dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, CBox dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
m_seExtents.topLeft.y}; m_seExtents.topLeft.y};
g_pHyprRenderer->damageBox(&dm); g_pHyprRenderer->damageBox(&dm);
} }
@ -99,13 +99,13 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
int xoff = 0; int xoff = 0;
for (int i = 0; i < barsToDraw; ++i) { for (int i = 0; i < barsToDraw; ++i) {
wlr_box rect = {m_vLastWindowPos.x + xoff - pMonitor->vecPosition.x + offset.x, CBox rect = {m_vLastWindowPos.x + xoff - pMonitor->vecPosition.x + offset.x,
m_vLastWindowPos.y - BAR_PADDING_OUTER_VERT - BORDERSIZE - BAR_INDICATOR_HEIGHT - pMonitor->vecPosition.y + offset.y, m_fBarWidth, BAR_INDICATOR_HEIGHT}; m_vLastWindowPos.y - BAR_PADDING_OUTER_VERT - BORDERSIZE - BAR_INDICATOR_HEIGHT - pMonitor->vecPosition.y + offset.y, m_fBarWidth, BAR_INDICATOR_HEIGHT};
if (rect.width <= 0 || rect.height <= 0) if (rect.width <= 0 || rect.height <= 0)
break; break;
scaleBox(&rect, pMonitor->scale); rect.scale(pMonitor->scale);
static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data; static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data;
static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data; static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data;

View file

@ -11,11 +11,6 @@ enum eDecorationType
DECORATION_CUSTOM DECORATION_CUSTOM
}; };
struct SWindowDecorationExtents {
Vector2D topLeft;
Vector2D bottomRight;
};
enum eDecorationLayer enum eDecorationLayer
{ {
DECORATION_LAYER_BOTTOM = 0, /* lowest. */ DECORATION_LAYER_BOTTOM = 0, /* lowest. */