diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-25 09:10:35 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 34f35f0badc767d9b0cbaf2fd429af1d30592d08 (patch) | |
tree | 1cc3a747d8e07cb55fa2cc95d26e2b33c792d89f | |
parent | Implement floating (diff) | |
download | sway-34f35f0badc767d9b0cbaf2fd429af1d30592d08.tar.gz sway-34f35f0badc767d9b0cbaf2fd429af1d30592d08.tar.zst sway-34f35f0badc767d9b0cbaf2fd429af1d30592d08.zip |
Use L_FLOATING instead of reapable boolean
-rw-r--r-- | include/sway/tree/container.h | 5 | ||||
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | sway/ipc-json.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 10 | ||||
-rw-r--r-- | sway/tree/workspace.c | 2 |
5 files changed, 14 insertions, 7 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index b802e1d1..906088f0 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -40,6 +40,7 @@ enum sway_container_layout { | |||
40 | L_VERT, | 40 | L_VERT, |
41 | L_STACKED, | 41 | L_STACKED, |
42 | L_TABBED, | 42 | L_TABBED, |
43 | L_FLOATING, | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | enum sway_container_border { | 46 | enum sway_container_border { |
@@ -75,10 +76,6 @@ struct sway_container { | |||
75 | enum sway_container_layout layout; | 76 | enum sway_container_layout layout; |
76 | enum sway_container_layout prev_layout; | 77 | enum sway_container_layout prev_layout; |
77 | 78 | ||
78 | // Allow the container to be automatically removed if it's empty. True by | ||
79 | // default, false for the magic floating container that each workspace has. | ||
80 | bool reapable; | ||
81 | |||
82 | // Saves us from searching the list of children/floating in the parent | 79 | // Saves us from searching the list of children/floating in the parent |
83 | bool is_floating; | 80 | bool is_floating; |
84 | bool is_sticky; | 81 | bool is_sticky; |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 1d21e80f..e91be4d4 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -754,6 +754,8 @@ static void render_container(struct sway_output *output, | |||
754 | case L_TABBED: | 754 | case L_TABBED: |
755 | render_container_tabbed(output, damage, con, parent_focused); | 755 | render_container_tabbed(output, damage, con, parent_focused); |
756 | break; | 756 | break; |
757 | case L_FLOATING: | ||
758 | sway_assert(false, "Didn't expect to see floating here"); | ||
757 | } | 759 | } |
758 | } | 760 | } |
759 | 761 | ||
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 4d7024a8..6d185449 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -22,6 +22,8 @@ static const char *ipc_json_layout_description(enum sway_container_layout l) { | |||
22 | return "tabbed"; | 22 | return "tabbed"; |
23 | case L_STACKED: | 23 | case L_STACKED: |
24 | return "stacked"; | 24 | return "stacked"; |
25 | case L_FLOATING: | ||
26 | return "floating"; | ||
25 | case L_NONE: | 27 | case L_NONE: |
26 | break; | 28 | break; |
27 | } | 29 | } |
diff --git a/sway/tree/container.c b/sway/tree/container.c index f9a0474c..17d29d92 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -123,7 +123,6 @@ struct sway_container *container_create(enum sway_container_type type) { | |||
123 | c->layout = L_NONE; | 123 | c->layout = L_NONE; |
124 | c->type = type; | 124 | c->type = type; |
125 | c->alpha = 1.0f; | 125 | c->alpha = 1.0f; |
126 | c->reapable = true; | ||
127 | 126 | ||
128 | if (type != C_VIEW) { | 127 | if (type != C_VIEW) { |
129 | c->children = create_list(); | 128 | c->children = create_list(); |
@@ -280,7 +279,8 @@ static void container_root_finish(struct sway_container *con) { | |||
280 | } | 279 | } |
281 | 280 | ||
282 | bool container_reap_empty(struct sway_container *con) { | 281 | bool container_reap_empty(struct sway_container *con) { |
283 | if (!con->reapable) { | 282 | if (con->layout == L_FLOATING) { |
283 | // Don't reap the magical floating container that each workspace has | ||
284 | return false; | 284 | return false; |
285 | } | 285 | } |
286 | switch (con->type) { | 286 | switch (con->type) { |
@@ -618,6 +618,9 @@ struct sway_container *container_at(struct sway_container *parent, | |||
618 | return container_at_tabbed(parent, ox, oy, surface, sx, sy); | 618 | return container_at_tabbed(parent, ox, oy, surface, sx, sy); |
619 | case L_STACKED: | 619 | case L_STACKED: |
620 | return container_at_stacked(parent, ox, oy, surface, sx, sy); | 620 | return container_at_stacked(parent, ox, oy, surface, sx, sy); |
621 | case L_FLOATING: | ||
622 | sway_assert(false, "Didn't expect to see floating here"); | ||
623 | return NULL; | ||
621 | case L_NONE: | 624 | case L_NONE: |
622 | return NULL; | 625 | return NULL; |
623 | } | 626 | } |
@@ -842,6 +845,9 @@ static size_t get_tree_representation(struct sway_container *parent, char *buffe | |||
842 | case L_STACKED: | 845 | case L_STACKED: |
843 | lenient_strcat(buffer, "S["); | 846 | lenient_strcat(buffer, "S["); |
844 | break; | 847 | break; |
848 | case L_FLOATING: | ||
849 | strcpy(buffer, "F["); | ||
850 | break; | ||
845 | case L_NONE: | 851 | case L_NONE: |
846 | lenient_strcat(buffer, "D["); | 852 | lenient_strcat(buffer, "D["); |
847 | break; | 853 | break; |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 5bef409a..37d4a06a 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -67,7 +67,7 @@ struct sway_container *workspace_create(struct sway_container *output, | |||
67 | swayws->swayc = workspace; | 67 | swayws->swayc = workspace; |
68 | swayws->floating = container_create(C_CONTAINER); | 68 | swayws->floating = container_create(C_CONTAINER); |
69 | swayws->floating->parent = swayws->swayc; | 69 | swayws->floating->parent = swayws->swayc; |
70 | swayws->floating->reapable = false; | 70 | swayws->floating->layout = L_FLOATING; |
71 | workspace->sway_workspace = swayws; | 71 | workspace->sway_workspace = swayws; |
72 | 72 | ||
73 | container_add_child(output, workspace); | 73 | container_add_child(output, workspace); |