properly clean layout data

modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/IHyprLayout.hpp
modified:   src/layout/MasterLayout.cpp
This commit is contained in:
MightyPlaza 2024-07-05 17:10:41 +01:00
parent 5527daa1eb
commit c0f77d237d
No known key found for this signature in database
GPG Key ID: 284C27FD27A6DC0D
7 changed files with 22 additions and 37 deletions

View File

@ -757,33 +757,18 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
}
void CWindow::updateDynamicRules() {
m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alpha.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alphaInactive.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.alphaFullscreen.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.opaque.unset(PRIORITY_WINDOW_RULE);
unsetWindowData(PRIORITY_WINDOW_RULE);
m_sWindowData.animationStyle.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.maxSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.minSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.dimAround.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noAnim.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noBlur.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noDim.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noBorder.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.noShadow.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.focusOnActivate.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.RGBX.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.tearing.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.keepAspectRatio.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.nearestNeighbor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.xray.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.borderSize.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.rounding.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE);
m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
@ -1566,3 +1551,12 @@ PHLWINDOW CWindow::getSwallower() {
// if none are found (??) then just return the first one
return candidates.at(0);
}
void CWindow::unsetWindowData(eOverridePriority priority) {
for (auto const& element : g_pConfigManager->mbWindowProperties) {
element.second(m_pSelf.lock())->unset(priority);
}
for (auto const& element : g_pConfigManager->miWindowProperties) {
element.second(m_pSelf.lock())->unset(priority);
}
}

View File

@ -457,6 +457,7 @@ class CWindow {
std::string fetchClass();
void warpCursor();
PHLWINDOW getSwallower();
void unsetWindowData(eOverridePriority priority);
// listeners
void onAck(uint32_t serial);

View File

@ -314,7 +314,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
workspaceSilent = false;
}
g_pLayoutManager->getCurrentLayout()->unsetLayoutWindowData(PWINDOW);
PWINDOW->updateWindowData();
if (PWINDOW->m_bIsFloating) {
g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(PWINDOW);
@ -450,7 +450,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();
if (PWINDOW->m_sWindowData.allowsInput.value_or_default()) {
if (PWINDOW->m_sWindowData.allowsInput.value_or_default()) { // if default value wasn't set to false getPriority() would throw an exception
PWINDOW->m_sWindowData.noFocus = CWindowOverridableVar(false, PWINDOW->m_sWindowData.allowsInput.getPriority());
PWINDOW->m_bNoInitialFocus = false;
PWINDOW->m_bX11ShouldntFocus = false;

View File

@ -139,7 +139,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks)
return;
unsetLayoutWindowData(PWINDOW);
PWINDOW->unsetWindowData(PRIORITY_LAYOUT);
static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("dwindle:no_gaps_when_only");
static auto PGAPSINDATA = CConfigValue<Hyprlang::CUSTOMTYPE>("general:gaps_in");
@ -496,7 +496,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
return;
}
unsetLayoutWindowData(pWindow);
pWindow->unsetWindowData(PRIORITY_LAYOUT);
if (pWindow->m_bIsFullscreen)
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
@ -830,7 +830,7 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscre
pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
unsetLayoutWindowData(pWindow);
pWindow->unsetWindowData(PRIORITY_LAYOUT);
}
} else {
// if it now got fullscreen, make it fullscreen

View File

@ -542,7 +542,7 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
g_pLayoutManager->getCurrentLayout()->unsetLayoutWindowData(pWindow);
pWindow->unsetWindowData(PRIORITY_LAYOUT);
if (pWindow == m_pLastTiledWindow)
m_pLastTiledWindow.reset();
@ -712,12 +712,4 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) {
return sizePredicted;
}
void IHyprLayout::unsetLayoutWindowData(PHLWINDOW pWindow) {
// not finished
pWindow->m_sWindowData.decorate.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noBorder.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noRounding.unset(PRIORITY_LAYOUT);
pWindow->m_sWindowData.noShadow.unset(PRIORITY_LAYOUT);
}
IHyprLayout::~IHyprLayout() {}

View File

@ -195,8 +195,6 @@ class IHyprLayout {
virtual Vector2D predictSizeForNewWindow(PHLWINDOW pWindow);
virtual Vector2D predictSizeForNewWindowFloating(PHLWINDOW pWindow);
virtual void unsetLayoutWindowData(PHLWINDOW);
private:
int m_iMouseMoveEventCount;
Vector2D m_vBeginDragXY;

View File

@ -264,7 +264,7 @@ void CHyprMasterLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID);
static auto SMALLSPLIT = CConfigValue<Hyprlang::INT>("master:allow_small_split");
unsetLayoutWindowData(pWindow);
pWindow->unsetWindowData(PRIORITY_LAYOUT);
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
@ -646,7 +646,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
if (PWINDOW->m_bIsFullscreen && !pNode->ignoreFullscreenChecks)
return;
unsetLayoutWindowData(PWINDOW);
PWINDOW->unsetWindowData(PRIORITY_LAYOUT);
static auto PNOGAPSWHENONLY = CConfigValue<Hyprlang::INT>("master:no_gaps_when_only");
static auto PANIMATE = CConfigValue<Hyprlang::INT>("misc:animate_manual_resizes");
@ -922,7 +922,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscree
pWindow->m_vRealPosition = pWindow->m_vLastFloatingPosition;
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
unsetLayoutWindowData(pWindow);
pWindow->unsetWindowData(PRIORITY_LAYOUT);
}
} else {
// if it now got fullscreen, make it fullscreen