aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-19 15:07:07 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-19 16:18:33 +1000
commit2b5a404ac920339a2b9ce32d4718272dee4668b9 (patch)
tree681f45a530a1f8d5966161291c3cb482e52edb6e /sway/desktop
parent389d159c81502aa8b951895de11c3720bbd5ba7d (diff)
downloadsway-2b5a404ac920339a2b9ce32d4718272dee4668b9.tar.xz
Replace hacky L_FLOATING container with a list
Workspaces previously had a magical `workspace->floating` container, which had a layout of L_FLOATING and whose children were actual floating views. This allowed some conveniences, but was a hacky solution because the container has to be exempt from focus, coordinate transactions with the workspace, and omit emitting IPC events (which we didn't do). This commit changes it to be a list directly in the sway_workspace. The L_FLOATING layout is no longer used so this has been removed as well. * Fixes incorrect check in the swap command (it checked if the containers had the L_FLOATING layout, but this layout applied to the magical container). * Introduces workspace_add_floating
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/output.c31
-rw-r--r--sway/desktop/render.c5
-rw-r--r--sway/desktop/transaction.c4
3 files changed, 14 insertions, 26 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 1e4f196b..2253eb51 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -316,31 +316,21 @@ static void send_frame_done_container_iterator(struct sway_container *con,
send_frame_done_iterator, data->when);
}
-static void send_frame_done_container(struct sway_output *output,
- struct sway_container *con, struct timespec *when) {
- struct send_frame_done_data data = {
- .output = output,
- .when = when,
- };
- output_for_each_container(output->swayc,
- send_frame_done_container_iterator, &data);
-}
-
static void send_frame_done(struct sway_output *output, struct timespec *when) {
if (output_has_opaque_overlay_layer_surface(output)) {
goto send_frame_overlay;
}
+ struct send_frame_done_data data = {
+ .output = output,
+ .when = when,
+ };
struct sway_container *workspace = output_get_active_workspace(output);
if (workspace->current.ws_fullscreen) {
- if (workspace->current.ws_fullscreen->type == C_VIEW) {
- output_view_for_each_surface(output,
- workspace->current.ws_fullscreen->sway_view,
- send_frame_done_iterator, when);
- } else {
- send_frame_done_container(output, workspace->current.ws_fullscreen,
- when);
- }
+ send_frame_done_container_iterator(
+ workspace->current.ws_fullscreen, &data);
+ container_for_each_child(workspace->current.ws_fullscreen,
+ send_frame_done_container_iterator, &data);
#ifdef HAVE_XWAYLAND
send_frame_done_unmanaged(output,
&root_container.sway_root->xwayland_unmanaged, when);
@@ -351,9 +341,8 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
send_frame_done_layer(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], when);
- send_frame_done_container(output, workspace, when);
- send_frame_done_container(output, workspace->sway_workspace->floating,
- when);
+ workspace_for_each_container(workspace,
+ send_frame_done_container_iterator, &data);
#ifdef HAVE_XWAYLAND
send_frame_done_unmanaged(output,
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 7c48d0d2..aa70903e 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -754,8 +754,6 @@ static void render_container(struct sway_output *output,
case L_TABBED:
render_container_tabbed(output, damage, con, parent_focused);
break;
- case L_FLOATING:
- sway_assert(false, "Didn't expect to see floating here");
}
}
@@ -806,8 +804,7 @@ static void render_floating(struct sway_output *soutput,
if (!workspace_is_visible(ws)) {
continue;
}
- list_t *floating =
- ws->current.ws_floating->current.children;
+ list_t *floating = ws->current.ws_floating;
for (int k = 0; k < floating->length; ++k) {
struct sway_container *floater = floating->items[k];
render_floating_container(soutput, damage, floater);
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index c300558a..692fb447 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -111,8 +111,9 @@ static void copy_pending_state(struct sway_container *container,
state->using_csd = view->using_csd;
} else if (container->type == C_WORKSPACE) {
state->ws_fullscreen = container->sway_workspace->fullscreen;
- state->ws_floating = container->sway_workspace->floating;
+ state->ws_floating = create_list();
state->children = create_list();
+ list_cat(state->ws_floating, container->sway_workspace->floating);
list_cat(state->children, container->children);
} else {
state->children = create_list();
@@ -189,6 +190,7 @@ static void transaction_apply(struct sway_transaction *transaction) {
// Any child containers which are being deleted will be cleaned up in
// transaction_destroy().
list_free(container->current.children);
+ list_free(container->current.ws_floating);
memcpy(&container->current, &instruction->state,
sizeof(struct sway_container_state));