aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-08-19 09:21:55 +0100
committerLibravatar GitHub <noreply@github.com>2018-08-19 09:21:55 +0100
commit2c91afbb34f649fcd4de690be5bedba4d989a7f0 (patch)
tree681f45a530a1f8d5966161291c3cb482e52edb6e /sway/desktop
parentMerge pull request #2453 from ianyfan/commands (diff)
parentReplace hacky L_FLOATING container with a list (diff)
downloadsway-2c91afbb34f649fcd4de690be5bedba4d989a7f0.tar.gz
sway-2c91afbb34f649fcd4de690be5bedba4d989a7f0.tar.zst
sway-2c91afbb34f649fcd4de690be5bedba4d989a7f0.zip
Merge pull request #2487 from RyanDwyer/workspace-floating-list
Replace hacky L_FLOATING container with a list
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,
316 send_frame_done_iterator, data->when); 316 send_frame_done_iterator, data->when);
317} 317}
318 318
319static void send_frame_done_container(struct sway_output *output,
320 struct sway_container *con, struct timespec *when) {
321 struct send_frame_done_data data = {
322 .output = output,
323 .when = when,
324 };
325 output_for_each_container(output->swayc,
326 send_frame_done_container_iterator, &data);
327}
328
329static void send_frame_done(struct sway_output *output, struct timespec *when) { 319static void send_frame_done(struct sway_output *output, struct timespec *when) {
330 if (output_has_opaque_overlay_layer_surface(output)) { 320 if (output_has_opaque_overlay_layer_surface(output)) {
331 goto send_frame_overlay; 321 goto send_frame_overlay;
332 } 322 }
333 323
324 struct send_frame_done_data data = {
325 .output = output,
326 .when = when,
327 };
334 struct sway_container *workspace = output_get_active_workspace(output); 328 struct sway_container *workspace = output_get_active_workspace(output);
335 if (workspace->current.ws_fullscreen) { 329 if (workspace->current.ws_fullscreen) {
336 if (workspace->current.ws_fullscreen->type == C_VIEW) { 330 send_frame_done_container_iterator(
337 output_view_for_each_surface(output, 331 workspace->current.ws_fullscreen, &data);
338 workspace->current.ws_fullscreen->sway_view, 332 container_for_each_child(workspace->current.ws_fullscreen,
339 send_frame_done_iterator, when); 333 send_frame_done_container_iterator, &data);
340 } else {
341 send_frame_done_container(output, workspace->current.ws_fullscreen,
342 when);
343 }
344#ifdef HAVE_XWAYLAND 334#ifdef HAVE_XWAYLAND
345 send_frame_done_unmanaged(output, 335 send_frame_done_unmanaged(output,
346 &root_container.sway_root->xwayland_unmanaged, when); 336 &root_container.sway_root->xwayland_unmanaged, when);
@@ -351,9 +341,8 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
351 send_frame_done_layer(output, 341 send_frame_done_layer(output,
352 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], when); 342 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], when);
353 343
354 send_frame_done_container(output, workspace, when); 344 workspace_for_each_container(workspace,
355 send_frame_done_container(output, workspace->sway_workspace->floating, 345 send_frame_done_container_iterator, &data);
356 when);
357 346
358#ifdef HAVE_XWAYLAND 347#ifdef HAVE_XWAYLAND
359 send_frame_done_unmanaged(output, 348 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,
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");
759 } 757 }
760} 758}
761 759
@@ -806,8 +804,7 @@ static void render_floating(struct sway_output *soutput,
806 if (!workspace_is_visible(ws)) { 804 if (!workspace_is_visible(ws)) {
807 continue; 805 continue;
808 } 806 }
809 list_t *floating = 807 list_t *floating = ws->current.ws_floating;
810 ws->current.ws_floating->current.children;
811 for (int k = 0; k < floating->length; ++k) { 808 for (int k = 0; k < floating->length; ++k) {
812 struct sway_container *floater = floating->items[k]; 809 struct sway_container *floater = floating->items[k];
813 render_floating_container(soutput, damage, floater); 810 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,
111 state->using_csd = view->using_csd; 111 state->using_csd = view->using_csd;
112 } else if (container->type == C_WORKSPACE) { 112 } else if (container->type == C_WORKSPACE) {
113 state->ws_fullscreen = container->sway_workspace->fullscreen; 113 state->ws_fullscreen = container->sway_workspace->fullscreen;
114 state->ws_floating = container->sway_workspace->floating; 114 state->ws_floating = create_list();
115 state->children = create_list(); 115 state->children = create_list();
116 list_cat(state->ws_floating, container->sway_workspace->floating);
116 list_cat(state->children, container->children); 117 list_cat(state->children, container->children);
117 } else { 118 } else {
118 state->children = create_list(); 119 state->children = create_list();
@@ -189,6 +190,7 @@ static void transaction_apply(struct sway_transaction *transaction) {
189 // Any child containers which are being deleted will be cleaned up in 190 // Any child containers which are being deleted will be cleaned up in
190 // transaction_destroy(). 191 // transaction_destroy().
191 list_free(container->current.children); 192 list_free(container->current.children);
193 list_free(container->current.ws_floating);
192 194
193 memcpy(&container->current, &instruction->state, 195 memcpy(&container->current, &instruction->state,
194 sizeof(struct sway_container_state)); 196 sizeof(struct sway_container_state));