summaryrefslogtreecommitdiff
path: root/src/desktop/view/Window.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-02-21 21:30:39 +0000
committerGitHub <noreply@github.com>2026-02-21 21:30:39 +0000
commit723870337f299d4c80aa0048144f3a1ca1c885bd (patch)
treeca3279ae5dbc841f676c64d2f58f895de13cd3bf /src/desktop/view/Window.hpp
parent51f8849e541f0a8150ac3a43fa928c1e299daf18 (diff)
layout: rethonk layouts from the ground up (#12890)
Rewrites layouts to be much smaller, and deal with much less annoying BS. Improves the overall architecture, unifies handling of pseudotiling, and various other improvements.
Diffstat (limited to 'src/desktop/view/Window.hpp')
-rw-r--r--src/desktop/view/Window.hpp56
1 files changed, 24 insertions, 32 deletions
diff --git a/src/desktop/view/Window.hpp b/src/desktop/view/Window.hpp
index 38e8ef0b..a986a63b 100644
--- a/src/desktop/view/Window.hpp
+++ b/src/desktop/view/Window.hpp
@@ -26,8 +26,19 @@ struct SWorkspaceRule;
class IWindowTransformer;
+namespace Layout {
+ class ITarget;
+ class CWindowTarget;
+}
+
+namespace Desktop {
+ enum eFocusReason : uint8_t;
+}
+
namespace Desktop::View {
+ class CGroup;
+
enum eGroupRules : uint8_t {
// effective only during first map, except for _ALWAYS variant
GROUP_NONE = 0,
@@ -38,6 +49,7 @@ namespace Desktop::View {
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
+ GROUP_DENY = 1 << 7, // deny
};
enum eGetWindowProperties : uint8_t {
@@ -61,6 +73,11 @@ namespace Desktop::View {
SUPPRESS_FULLSCREEN_OUTPUT = 1 << 4,
};
+ struct SWindowActiveEvent {
+ PHLWINDOW window = nullptr;
+ eFocusReason reason = sc<eFocusReason>(0) /* unknown */;
+ };
+
struct SInitialWorkspaceToken {
PHLWINDOWREF primaryOwner;
std::string workspace;
@@ -97,6 +114,8 @@ namespace Desktop::View {
WP<CXDGSurfaceResource> m_xdgSurface;
WP<CXWaylandSurface> m_xwaylandSurface;
+ SP<Layout::ITarget> m_target;
+
// this is the position and size of the "bounding box"
Vector2D m_position = Vector2D(0, 0);
Vector2D m_size = Vector2D(0, 0);
@@ -112,23 +131,14 @@ namespace Desktop::View {
std::optional<std::pair<uint32_t, Vector2D>> m_pendingSizeAck;
std::vector<std::pair<uint32_t, Vector2D>> m_pendingSizeAcks;
- // for restoring floating statuses
- Vector2D m_lastFloatingSize;
- Vector2D m_lastFloatingPosition;
-
// for floating window offset in workspace animations
Vector2D m_floatingOffset = Vector2D(0, 0);
- // this is used for pseudotiling
- bool m_isPseudotiled = false;
- Vector2D m_pseudoSize = Vector2D(1280, 720);
-
// for recovering relative cursor position
Vector2D m_relativeCursorCoordsOnLastWarp = Vector2D(-1, -1);
bool m_firstMap = false; // for layouts
bool m_isFloating = false;
- bool m_draggingTiled = false; // for dragging around tiled windows
SFullscreenState m_fullscreenState = {.internal = FSMODE_NONE, .client = FSMODE_NONE};
std::string m_title = "";
std::string m_class = "";
@@ -229,15 +239,10 @@ namespace Desktop::View {
std::string m_initialWorkspaceToken = "";
// for groups
- struct SGroupData {
- PHLWINDOWREF pNextWindow; // nullptr means no grouping. Self means single group.
- bool head = false;
- bool locked = false; // per group lock
- bool deny = false; // deny window from enter a group or made a group
- } m_groupData;
- uint16_t m_groupRules = Desktop::View::GROUP_NONE;
+ SP<CGroup> m_group;
+ uint16_t m_groupRules = Desktop::View::GROUP_NONE;
- bool m_tearingHint = false;
+ bool m_tearingHint = false;
// Stable ID for ext_foreign_toplevel_list
const uint64_t m_stableID = 0x2137;
@@ -303,21 +308,6 @@ namespace Desktop::View {
bool isInCurvedCorner(double x, double y);
bool hasPopupAt(const Vector2D& pos);
int popupsCount();
- void applyGroupRules();
- void createGroup();
- void destroyGroup();
- PHLWINDOW getGroupHead();
- PHLWINDOW getGroupTail();
- PHLWINDOW getGroupCurrent();
- PHLWINDOW getGroupPrevious();
- PHLWINDOW getGroupWindowByIndex(int);
- bool hasInGroup(PHLWINDOW);
- int getGroupSize();
- bool canBeGroupedInto(PHLWINDOW pWindow);
- void setGroupCurrent(PHLWINDOW pWindow);
- void insertWindowToGroup(PHLWINDOW pWindow);
- void updateGroupOutputs();
- void switchWithWindowInGroup(PHLWINDOW pWindow);
void setAnimationsToMove();
void onWorkspaceAnimUpdate();
void onFocusAnimUpdate();
@@ -350,6 +340,8 @@ namespace Desktop::View {
std::optional<Vector2D> calculateExpression(const std::string& s);
std::optional<Vector2D> minSize();
std::optional<Vector2D> maxSize();
+ SP<Layout::ITarget> layoutTarget();
+ bool canBeGroupedInto(SP<CGroup> group);
CBox getWindowMainSurfaceBox() const {
return {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y};