mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 19:31:29 +00:00
Use L_FLOATING instead of reapable boolean
This commit is contained in:
parent
1f2e399ade
commit
34f35f0bad
|
@ -40,6 +40,7 @@ enum sway_container_layout {
|
||||||
L_VERT,
|
L_VERT,
|
||||||
L_STACKED,
|
L_STACKED,
|
||||||
L_TABBED,
|
L_TABBED,
|
||||||
|
L_FLOATING,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sway_container_border {
|
enum sway_container_border {
|
||||||
|
@ -75,10 +76,6 @@ struct sway_container {
|
||||||
enum sway_container_layout layout;
|
enum sway_container_layout layout;
|
||||||
enum sway_container_layout prev_layout;
|
enum sway_container_layout prev_layout;
|
||||||
|
|
||||||
// Allow the container to be automatically removed if it's empty. True by
|
|
||||||
// default, false for the magic floating container that each workspace has.
|
|
||||||
bool reapable;
|
|
||||||
|
|
||||||
// Saves us from searching the list of children/floating in the parent
|
// Saves us from searching the list of children/floating in the parent
|
||||||
bool is_floating;
|
bool is_floating;
|
||||||
bool is_sticky;
|
bool is_sticky;
|
||||||
|
|
|
@ -754,6 +754,8 @@ static void render_container(struct sway_output *output,
|
||||||
case L_TABBED:
|
case L_TABBED:
|
||||||
render_container_tabbed(output, damage, con, parent_focused);
|
render_container_tabbed(output, damage, con, parent_focused);
|
||||||
break;
|
break;
|
||||||
|
case L_FLOATING:
|
||||||
|
sway_assert(false, "Didn't expect to see floating here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ static const char *ipc_json_layout_description(enum sway_container_layout l) {
|
||||||
return "tabbed";
|
return "tabbed";
|
||||||
case L_STACKED:
|
case L_STACKED:
|
||||||
return "stacked";
|
return "stacked";
|
||||||
|
case L_FLOATING:
|
||||||
|
return "floating";
|
||||||
case L_NONE:
|
case L_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,6 @@ struct sway_container *container_create(enum sway_container_type type) {
|
||||||
c->layout = L_NONE;
|
c->layout = L_NONE;
|
||||||
c->type = type;
|
c->type = type;
|
||||||
c->alpha = 1.0f;
|
c->alpha = 1.0f;
|
||||||
c->reapable = true;
|
|
||||||
|
|
||||||
if (type != C_VIEW) {
|
if (type != C_VIEW) {
|
||||||
c->children = create_list();
|
c->children = create_list();
|
||||||
|
@ -280,7 +279,8 @@ static void container_root_finish(struct sway_container *con) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool container_reap_empty(struct sway_container *con) {
|
bool container_reap_empty(struct sway_container *con) {
|
||||||
if (!con->reapable) {
|
if (con->layout == L_FLOATING) {
|
||||||
|
// Don't reap the magical floating container that each workspace has
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (con->type) {
|
switch (con->type) {
|
||||||
|
@ -618,6 +618,9 @@ struct sway_container *container_at(struct sway_container *parent,
|
||||||
return container_at_tabbed(parent, ox, oy, surface, sx, sy);
|
return container_at_tabbed(parent, ox, oy, surface, sx, sy);
|
||||||
case L_STACKED:
|
case L_STACKED:
|
||||||
return container_at_stacked(parent, ox, oy, surface, sx, sy);
|
return container_at_stacked(parent, ox, oy, surface, sx, sy);
|
||||||
|
case L_FLOATING:
|
||||||
|
sway_assert(false, "Didn't expect to see floating here");
|
||||||
|
return NULL;
|
||||||
case L_NONE:
|
case L_NONE:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -842,6 +845,9 @@ static size_t get_tree_representation(struct sway_container *parent, char *buffe
|
||||||
case L_STACKED:
|
case L_STACKED:
|
||||||
lenient_strcat(buffer, "S[");
|
lenient_strcat(buffer, "S[");
|
||||||
break;
|
break;
|
||||||
|
case L_FLOATING:
|
||||||
|
strcpy(buffer, "F[");
|
||||||
|
break;
|
||||||
case L_NONE:
|
case L_NONE:
|
||||||
lenient_strcat(buffer, "D[");
|
lenient_strcat(buffer, "D[");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct sway_container *workspace_create(struct sway_container *output,
|
||||||
swayws->swayc = workspace;
|
swayws->swayc = workspace;
|
||||||
swayws->floating = container_create(C_CONTAINER);
|
swayws->floating = container_create(C_CONTAINER);
|
||||||
swayws->floating->parent = swayws->swayc;
|
swayws->floating->parent = swayws->swayc;
|
||||||
swayws->floating->reapable = false;
|
swayws->floating->layout = L_FLOATING;
|
||||||
workspace->sway_workspace = swayws;
|
workspace->sway_workspace = swayws;
|
||||||
|
|
||||||
container_add_child(output, workspace);
|
container_add_child(output, workspace);
|
||||||
|
|
Loading…
Reference in a new issue