aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-12 23:22:51 +0100
committerLibravatar Tudor Brindus <me@tbrindus.ca>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /include
parentAdd missing transaction commits to seatop_default (diff)
downloadsway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.gz
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.tar.zst
sway-a047b5ee4a2a67d30d93641ff86531d54b8e0879.zip
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
Diffstat (limited to 'include')
-rw-r--r--include/sway/tree/container.h39
1 files changed, 9 insertions, 30 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 7e9df59f..ff3f9599 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -46,9 +46,9 @@ struct sway_container_state {
46 46
47 enum sway_fullscreen_mode fullscreen_mode; 47 enum sway_fullscreen_mode fullscreen_mode;
48 48
49 struct sway_workspace *workspace; 49 struct sway_workspace *workspace; // NULL when hidden in the scratchpad
50 struct sway_container *parent; 50 struct sway_container *parent; // NULL if container in root of workspace
51 list_t *children; 51 list_t *children; // struct sway_container
52 52
53 struct sway_container *focused_inactive_child; 53 struct sway_container *focused_inactive_child;
54 bool focused; 54 bool focused;
@@ -60,6 +60,7 @@ struct sway_container_state {
60 bool border_left; 60 bool border_left;
61 bool border_right; 61 bool border_right;
62 62
63 // These are in layout coordinates.
63 double content_x, content_y; 64 double content_x, content_y;
64 double content_width, content_height; 65 double content_width, content_height;
65}; 66};
@@ -68,14 +69,12 @@ struct sway_container {
68 struct sway_node node; 69 struct sway_node node;
69 struct sway_view *view; 70 struct sway_view *view;
70 71
71 // The pending state is the main container properties, and the current state is in the below struct.
72 // This means most places of the code can refer to the main variables (pending state) and it'll just work.
73 struct sway_container_state current; 72 struct sway_container_state current;
73 struct sway_container_state pending;
74 74
75 char *title; // The view's title (unformatted) 75 char *title; // The view's title (unformatted)
76 char *formatted_title; // The title displayed in the title bar 76 char *formatted_title; // The title displayed in the title bar
77 77
78 enum sway_container_layout layout;
79 enum sway_container_layout prev_split_layout; 78 enum sway_container_layout prev_split_layout;
80 79
81 // Whether stickiness has been enabled on this container. Use 80 // Whether stickiness has been enabled on this container. Use
@@ -86,11 +85,13 @@ struct sway_container {
86 // For C_ROOT, this has no meaning 85 // For C_ROOT, this has no meaning
87 // For other types, this is the position in layout coordinates 86 // For other types, this is the position in layout coordinates
88 // Includes borders 87 // Includes borders
89 double x, y;
90 double width, height;
91 double saved_x, saved_y; 88 double saved_x, saved_y;
92 double saved_width, saved_height; 89 double saved_width, saved_height;
93 90
91 // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD
92 // border which we use to restore when the view returns to SSD.
93 enum sway_container_border saved_border;
94
94 // The share of the space of parent container this container occupies 95 // The share of the space of parent container this container occupies
95 double width_fraction; 96 double width_fraction;
96 double height_fraction; 97 double height_fraction;
@@ -100,33 +101,11 @@ struct sway_container {
100 double child_total_width; 101 double child_total_width;
101 double child_total_height; 102 double child_total_height;
102 103
103 // These are in layout coordinates.
104 double content_x, content_y;
105 int content_width, content_height;
106
107 // In most cases this is the same as the content x and y, but if the view 104 // In most cases this is the same as the content x and y, but if the view
108 // refuses to resize to the content dimensions then it can be smaller. 105 // refuses to resize to the content dimensions then it can be smaller.
109 // These are in layout coordinates. 106 // These are in layout coordinates.
110 double surface_x, surface_y; 107 double surface_x, surface_y;
111 108
112 enum sway_fullscreen_mode fullscreen_mode;
113
114 enum sway_container_border border;
115
116 // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD
117 // border which we use to restore when the view returns to SSD.
118 enum sway_container_border saved_border;
119
120 int border_thickness;
121 bool border_top;
122 bool border_bottom;
123 bool border_left;
124 bool border_right;
125
126 struct sway_workspace *workspace; // NULL when hidden in the scratchpad
127 struct sway_container *parent; // NULL if container in root of workspace
128 list_t *children; // struct sway_container
129
130 // Outputs currently being intersected 109 // Outputs currently being intersected
131 list_t *outputs; // struct sway_output 110 list_t *outputs; // struct sway_output
132 111