diff options
| author | Kon <96987701+ChaosInfinited@users.noreply.github.com> | 2026-03-17 14:10:53 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-17 09:10:53 -0500 |
| commit | be96e06a965b9ec7c9273234b6299f35626f9e64 (patch) | |
| tree | de2b0e6b5858c57b70f5d5fa1f823050363a978c /src/desktop/view/Group.cpp | |
| parent | 30c498acf4173930dfd8afd6279ebceacb1941e9 (diff) | |
view: consolidate group flags and apply window rules (#13694)
* view: consolidate group flags and apply window rules
Replace individual boolean flags with a bitmask for group policies and ensure that window-specific group rules are correctly inherited when windows are initialized or added to a group.
* tests: add cases for locked groups and invade rule
Add tests to verify window grouping behavior, specifically checking that locked groups prevent merging by default and that the 'invade' group rule correctly overrides this lock policy.
Diffstat (limited to 'src/desktop/view/Group.cpp')
| -rw-r--r-- | src/desktop/view/Group.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/desktop/view/Group.cpp b/src/desktop/view/Group.cpp index 06884cff..287276b2 100644 --- a/src/desktop/view/Group.cpp +++ b/src/desktop/view/Group.cpp @@ -46,6 +46,7 @@ void CGroup::init() { for (const auto& w : m_windows) { RASSERT(!w->m_group, "CGroup: windows cannot contain grouped in init, this will explode"); w->m_group = m_self.lock(); + m_groupPolicyFlags |= w->m_groupRules; } g_layoutManager->switchTargets(m_windows.at(0)->m_target, m_target); @@ -104,6 +105,7 @@ void CGroup::add(PHLWINDOW w) { } w->m_group = m_self.lock(); + m_groupPolicyFlags |= w->m_groupRules; w->m_target->setSpaceGhost(m_target->space()); w->m_target->setFloating(m_target->floating()); @@ -296,19 +298,25 @@ size_t CGroup::size() const { } bool CGroup::locked() const { - return m_locked; + return m_groupPolicyFlags & GROUP_LOCK; } void CGroup::setLocked(bool x) { - m_locked = x; + if (x) + m_groupPolicyFlags |= GROUP_LOCK; + else + m_groupPolicyFlags &= ~GROUP_LOCK; } bool CGroup::denied() const { - return m_deny; + return m_groupPolicyFlags & GROUP_DENY; } void CGroup::setDenied(bool x) { - m_deny = x; + if (x) + m_groupPolicyFlags |= GROUP_DENY; + else + m_groupPolicyFlags &= ~GROUP_DENY; } void CGroup::updateWorkspace(PHLWORKSPACE ws) { |
