From 7870a197fcdf4d6e77bea7133539d6637aba8479 Mon Sep 17 00:00:00 2001 From: Hummer12007 Date: Sat, 18 Jun 2016 20:31:18 +0300 Subject: [PATCH 1/6] Added a null check in tabbed_stacked_parent This fixes a segfault, when trying to get parent of the workspace/root container/(?), as it is not assuered that the view's parent node is not null in the loop --- sway/container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/container.c b/sway/container.c index 159750647..21538ab44 100644 --- a/sway/container.c +++ b/sway/container.c @@ -853,12 +853,12 @@ swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { if (!ASSERT_NONNULL(view)) { return NULL; } - do { + while (view->type != C_WORKSPACE && view->parent) { view = view->parent; if (view->layout == L_TABBED || view->layout == L_STACKED) { parent = view; } - } while (view && view->type != C_WORKSPACE); + } return parent; } From 71f710cf0f1c4039f0623d5e149c077c0aa25dc5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 19 Jun 2016 10:01:15 -0400 Subject: [PATCH 2/6] Minor fix to warning messages --- sway/commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index 4009997b8..55f46f793 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -251,7 +251,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) { } else { free_sway_binding(binding); return cmd_results_new(CMD_FAILURE, "bindsym", - "Invalid bindsym command" + "Invalid bindsym command " "(expected more than 2 arguments, got %d)", argc); } } @@ -317,7 +317,7 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) { } else { free_sway_binding(binding); return cmd_results_new(CMD_FAILURE, "bindcode", - "Invalid bindcode command" + "Invalid bindcode command " "(expected more than 2 arguments, got %d)", argc); } } From bfdda1505ec319b9ee812efa7059d646f7bea9d0 Mon Sep 17 00:00:00 2001 From: Mykyta Holubakha Date: Tue, 21 Jun 2016 20:38:06 +0300 Subject: [PATCH 3/6] Check if found ws is focused in new view handler Fixes #714, by preventing change of focus from a window to the whole ws --- sway/handlers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index b38f05a63..c5aee4aad 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -198,11 +198,12 @@ static bool handle_view_created(wlc_handle handle) { if (pid) { // using newview as a temp storage location here, // rather than adding yet another workspace var - if ((newview = workspace_for_pid(pid))) { + newview = workspace_for_pid(pid); + if (newview && newview != current_ws) { focused = newview; - newview = NULL; return_to_workspace = true; } + newview = NULL; } } From d3c947676dc2b2e15fafbb542b9fa6335c047486 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Sun, 26 Jun 2016 23:25:56 -0500 Subject: [PATCH 4/6] Bug fix: Add missing header file, unistd.h Without unistd.h the following functions getuid, alarm and close are implicitly declared causing compilation to fail due to -Werror=implicit-function-declaration --- swaylock/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/swaylock/main.c b/swaylock/main.c index b5ce63ef4..a0a2f1cb5 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "client/window.h" #include "client/registry.h" From 26842ff3833c853e3e3cef065a494c05736a53e5 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Mon, 27 Jun 2016 02:29:37 -0500 Subject: [PATCH 5/6] Add get_log_level() to encapsulate v (current log level) This patch also makes all global variable in log.c static. --- common/log.c | 10 +++++++--- include/log.h | 1 + sway/debug_log.c | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/common/log.c b/common/log.c index ef791becf..56c3834ab 100644 --- a/common/log.c +++ b/common/log.c @@ -12,9 +12,9 @@ #include #include -int colored = 1; -log_importance_t loglevel_default = L_ERROR; -log_importance_t v = L_SILENT; +static int colored = 1; +static log_importance_t loglevel_default = L_ERROR; +static log_importance_t v = L_SILENT; static const char *verbosity_colors[] = { [L_SILENT] = "", @@ -38,6 +38,10 @@ void set_log_level(log_importance_t verbosity) { v = verbosity; } +log_importance_t get_log_level(void) { + return v; +} + void reset_log_level(void) { v = loglevel_default; } diff --git a/include/log.h b/include/log.h index efacf90f9..ca8c1fe36 100644 --- a/include/log.h +++ b/include/log.h @@ -11,6 +11,7 @@ typedef enum { void init_log(log_importance_t verbosity); void set_log_level(log_importance_t verbosity); +log_importance_t get_log_level(void); void reset_log_level(void); // returns whether debug logging is on after switching. bool toggle_debug_logging(void); diff --git a/sway/debug_log.c b/sway/debug_log.c index f804a5415..7c9884647 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c @@ -12,8 +12,6 @@ #include #include "workspace.h" -extern log_importance_t v; - /* XXX:DEBUG:XXX */ static void container_log(const swayc_t *c, int depth) { fprintf(stderr, "focus:%c", @@ -49,7 +47,7 @@ static void container_log(const swayc_t *c, int depth) { fprintf(stderr, "name:%.16s\n", c->name); } void layout_log(const swayc_t *c, int depth) { - if (L_DEBUG > v) return; + if (L_DEBUG > get_log_level()) return; int i, d; int e = c->children ? c->children->length : 0; container_log(c, depth); From 7144fb9fc3b3d3b45d23deaab6a10caf3216cca4 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 30 Jun 2016 08:30:03 -0400 Subject: [PATCH 6/6] Spawn windows as floating if they have a parent Fixes #604 --- sway/handlers.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index c5aee4aad..53dbeb87e 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -235,8 +235,12 @@ static bool handle_view_created(wlc_handle handle) { switch (wlc_view_get_type(handle)) { // regular view created regularly case 0: - newview = new_view(focused, handle); - wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); + if (parent) { + newview = new_floating_view(handle); + } else { + newview = new_view(focused, handle); + wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); + } break; // Dmenu keeps viewfocus, but others with this flag don't, for now simulate