Skip to content

Commit

Permalink
border: fixup infinite recursion
Browse files Browse the repository at this point in the history
ref #7127
  • Loading branch information
vaxerski committed Aug 1, 2024
1 parent 5edfa62 commit 60571cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/render/decorations/CHyprBorderDecoration.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "CHyprBorderDecoration.hpp"
#include "../../Compositor.hpp"
#include "../../config/ConfigValue.hpp"
#include "../../managers/eventLoop/EventLoopManager.hpp"

CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
m_pWindow = pWindow;
Expand Down Expand Up @@ -82,8 +83,17 @@ eDecorationType CHyprBorderDecoration::getDecorationType() {
}

void CHyprBorderDecoration::updateWindow(PHLWINDOW) {
if (m_pWindow->getRealBorderSize() != m_seExtents.topLeft.x)
g_pDecorationPositioner->repositionDeco(this);
auto borderSize = m_pWindow->getRealBorderSize();

if (borderSize == m_iLastBorderSize)
return;

if (borderSize <= 0 && m_iLastBorderSize <= 0)
return;

m_iLastBorderSize = borderSize;

g_pEventLoopManager->doLater([this]() { g_pDecorationPositioner->repositionDeco(this); });
}

void CHyprBorderDecoration::damageEntire() {
Expand Down
2 changes: 2 additions & 0 deletions src/render/decorations/CHyprBorderDecoration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class CHyprBorderDecoration : public IHyprWindowDecoration {

CBox m_bAssignedGeometry = {0};

int m_iLastBorderSize = -1;

CBox assignedBoxGlobal();
bool doesntWantBorders();
};

0 comments on commit 60571cd

Please sign in to comment.