From 0ccf55ef60b8f210cc6dc67b2dc2649043ebc231 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Tue, 27 Mar 2018 21:34:55 -0700 Subject: fix remove_view_from_scratchpad --- sway/commands.c | 2 +- sway/container.c | 3 +++ sway/debug_log.c | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index c7dbf731..fb3653a2 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -141,12 +141,12 @@ void remove_view_from_scratchpad(swayc_t *view) { int i; for (i = 0; i < scratchpad->length; i++) { if (scratchpad->items[i] == view) { + list_del(scratchpad, sp_index); if (sp_index == 0) { sp_index = scratchpad->length - 1; } else { sp_index--; } - list_del(scratchpad, sp_index); sp_view = NULL; } } diff --git a/sway/container.c b/sway/container.c index 829fde69..9fb044a7 100644 --- a/sway/container.c +++ b/sway/container.c @@ -869,6 +869,9 @@ void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), voi void update_visibility_output(swayc_t *container, wlc_handle output) { // Inherit visibility swayc_t *parent = container->parent; + if (parent == NULL) { + return; + } container->visible = parent->visible; // special cases where visibility depends on focus if (parent->type == C_OUTPUT || parent->layout == L_TABBED || diff --git a/sway/debug_log.c b/sway/debug_log.c index d1eafae8..5cc5f9dc 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c @@ -72,6 +72,11 @@ void layout_log(const swayc_t *c, int depth) { } } } + if (c->type == C_ROOT) { + fprintf(stderr,"ScratchPad\n"); + for (int i = 0; i < scratchpad->length; ++i) + container_log(scratchpad->items[i], 0); + } } const char *swayc_type_string(enum swayc_types type) { -- cgit v1.2.3 From 503c6356e8d095e7ef3a863177a6017d39bd9b18 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Wed, 28 Mar 2018 12:48:01 -0700 Subject: Clean up scratchpad logging --- sway/debug_log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sway/debug_log.c b/sway/debug_log.c index 5cc5f9dc..166c41e8 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c @@ -71,11 +71,11 @@ void layout_log(const swayc_t *c, int depth) { layout_log(c->floating->items[i], depth + 1); } } - } - if (c->type == C_ROOT) { - fprintf(stderr,"ScratchPad\n"); - for (int i = 0; i < scratchpad->length; ++i) + } else if (c->type == C_ROOT && scratchpad->length > 0) { + fprintf(stderr, "ScratchPad\n"); + for (i = 0; i < scratchpad->length; ++i) { container_log(scratchpad->items[i], 0); + } } } -- cgit v1.2.3