windowrules: add rule group to map windows grouped (#3279)

* windows: add rule group to map windows grouped

* group rule: use `invade` to force open a window in a locked group
This commit is contained in:
memchr
2023-09-21 23:42:00 +00:00
committed by GitHub
parent 2e1842b5ff
commit 1357b66091
9 changed files with 200 additions and 76 deletions

View File

@@ -18,6 +18,18 @@ enum eIdleInhibitMode {
IDLEINHIBIT_FOCUS
};
enum eGroupRules {
// effective only during first map, except for _ALWAYS variant
GROUP_NONE = 0,
GROUP_SET = 1 << 0, // Open as new group or add to focused group
GROUP_SET_ALWAYS = 1 << 1,
GROUP_BARRED = 1 << 2, // Don't insert to focused group.
GROUP_LOCK = 1 << 3, // Lock m_sGroupData.lock
GROUP_LOCK_ALWAYS = 1 << 4,
GROUP_INVADE = 1 << 5, // Force enter a group, event if lock is engaged
GROUP_OVERRIDE = 1 << 6, // Override other rules
};
template <typename T>
class CWindowOverridableVar {
public:
@@ -300,8 +312,10 @@ class CWindow {
struct SGroupData {
CWindow* pNextWindow = nullptr; // nullptr means no grouping. Self means single group.
bool head = false;
bool locked = false;
bool locked = false; // per group lock
bool deny = false; // deny window from enter a group or made a group
} m_sGroupData;
uint16_t m_eGroupRules = GROUP_NONE;
// For the list lookup
bool operator==(const CWindow& rhs) {
@@ -342,6 +356,9 @@ class CWindow {
bool isInCurvedCorner(double x, double y);
bool hasPopupAt(const Vector2D& pos);
void applyGroupRules();
void createGroup();
void destroyGroup();
CWindow* getGroupHead();
CWindow* getGroupTail();
CWindow* getGroupCurrent();