From 2b5a404ac920339a2b9ce32d4718272dee4668b9 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 19 Aug 2018 15:07:07 +1000 Subject: 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 --- sway/desktop/output.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'sway/desktop/output.c') 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, -- cgit v1.2.3-54-g00ecf