diff options
-rw-r--r-- | common/log.c | 10 | ||||
-rw-r--r-- | include/log.h | 1 | ||||
-rw-r--r-- | sway/commands.c | 4 | ||||
-rw-r--r-- | sway/container.c | 4 | ||||
-rw-r--r-- | sway/debug_log.c | 4 | ||||
-rw-r--r-- | sway/handlers.c | 13 | ||||
-rw-r--r-- | swaylock/main.c | 1 |
7 files changed, 23 insertions, 14 deletions
diff --git a/common/log.c b/common/log.c index ef791bec..56c3834a 100644 --- a/common/log.c +++ b/common/log.c | |||
@@ -12,9 +12,9 @@ | |||
12 | #include <string.h> | 12 | #include <string.h> |
13 | #include <stringop.h> | 13 | #include <stringop.h> |
14 | 14 | ||
15 | int colored = 1; | 15 | static int colored = 1; |
16 | log_importance_t loglevel_default = L_ERROR; | 16 | static log_importance_t loglevel_default = L_ERROR; |
17 | log_importance_t v = L_SILENT; | 17 | static log_importance_t v = L_SILENT; |
18 | 18 | ||
19 | static const char *verbosity_colors[] = { | 19 | static const char *verbosity_colors[] = { |
20 | [L_SILENT] = "", | 20 | [L_SILENT] = "", |
@@ -38,6 +38,10 @@ void set_log_level(log_importance_t verbosity) { | |||
38 | v = verbosity; | 38 | v = verbosity; |
39 | } | 39 | } |
40 | 40 | ||
41 | log_importance_t get_log_level(void) { | ||
42 | return v; | ||
43 | } | ||
44 | |||
41 | void reset_log_level(void) { | 45 | void reset_log_level(void) { |
42 | v = loglevel_default; | 46 | v = loglevel_default; |
43 | } | 47 | } |
diff --git a/include/log.h b/include/log.h index efacf90f..ca8c1fe3 100644 --- a/include/log.h +++ b/include/log.h | |||
@@ -11,6 +11,7 @@ typedef enum { | |||
11 | 11 | ||
12 | void init_log(log_importance_t verbosity); | 12 | void init_log(log_importance_t verbosity); |
13 | void set_log_level(log_importance_t verbosity); | 13 | void set_log_level(log_importance_t verbosity); |
14 | log_importance_t get_log_level(void); | ||
14 | void reset_log_level(void); | 15 | void reset_log_level(void); |
15 | // returns whether debug logging is on after switching. | 16 | // returns whether debug logging is on after switching. |
16 | bool toggle_debug_logging(void); | 17 | bool toggle_debug_logging(void); |
diff --git a/sway/commands.c b/sway/commands.c index 4009997b..55f46f79 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -251,7 +251,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) { | |||
251 | } else { | 251 | } else { |
252 | free_sway_binding(binding); | 252 | free_sway_binding(binding); |
253 | return cmd_results_new(CMD_FAILURE, "bindsym", | 253 | return cmd_results_new(CMD_FAILURE, "bindsym", |
254 | "Invalid bindsym command" | 254 | "Invalid bindsym command " |
255 | "(expected more than 2 arguments, got %d)", argc); | 255 | "(expected more than 2 arguments, got %d)", argc); |
256 | } | 256 | } |
257 | } | 257 | } |
@@ -317,7 +317,7 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) { | |||
317 | } else { | 317 | } else { |
318 | free_sway_binding(binding); | 318 | free_sway_binding(binding); |
319 | return cmd_results_new(CMD_FAILURE, "bindcode", | 319 | return cmd_results_new(CMD_FAILURE, "bindcode", |
320 | "Invalid bindcode command" | 320 | "Invalid bindcode command " |
321 | "(expected more than 2 arguments, got %d)", argc); | 321 | "(expected more than 2 arguments, got %d)", argc); |
322 | } | 322 | } |
323 | } | 323 | } |
diff --git a/sway/container.c b/sway/container.c index 15975064..21538ab4 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -853,12 +853,12 @@ swayc_t *swayc_tabbed_stacked_parent(swayc_t *view) { | |||
853 | if (!ASSERT_NONNULL(view)) { | 853 | if (!ASSERT_NONNULL(view)) { |
854 | return NULL; | 854 | return NULL; |
855 | } | 855 | } |
856 | do { | 856 | while (view->type != C_WORKSPACE && view->parent) { |
857 | view = view->parent; | 857 | view = view->parent; |
858 | if (view->layout == L_TABBED || view->layout == L_STACKED) { | 858 | if (view->layout == L_TABBED || view->layout == L_STACKED) { |
859 | parent = view; | 859 | parent = view; |
860 | } | 860 | } |
861 | } while (view && view->type != C_WORKSPACE); | 861 | } |
862 | 862 | ||
863 | return parent; | 863 | return parent; |
864 | } | 864 | } |
diff --git a/sway/debug_log.c b/sway/debug_log.c index f804a541..7c988464 100644 --- a/sway/debug_log.c +++ b/sway/debug_log.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <stringop.h> | 12 | #include <stringop.h> |
13 | #include "workspace.h" | 13 | #include "workspace.h" |
14 | 14 | ||
15 | extern log_importance_t v; | ||
16 | |||
17 | /* XXX:DEBUG:XXX */ | 15 | /* XXX:DEBUG:XXX */ |
18 | static void container_log(const swayc_t *c, int depth) { | 16 | static void container_log(const swayc_t *c, int depth) { |
19 | fprintf(stderr, "focus:%c", | 17 | fprintf(stderr, "focus:%c", |
@@ -49,7 +47,7 @@ static void container_log(const swayc_t *c, int depth) { | |||
49 | fprintf(stderr, "name:%.16s\n", c->name); | 47 | fprintf(stderr, "name:%.16s\n", c->name); |
50 | } | 48 | } |
51 | void layout_log(const swayc_t *c, int depth) { | 49 | void layout_log(const swayc_t *c, int depth) { |
52 | if (L_DEBUG > v) return; | 50 | if (L_DEBUG > get_log_level()) return; |
53 | int i, d; | 51 | int i, d; |
54 | int e = c->children ? c->children->length : 0; | 52 | int e = c->children ? c->children->length : 0; |
55 | container_log(c, depth); | 53 | container_log(c, depth); |
diff --git a/sway/handlers.c b/sway/handlers.c index b38f05a6..53dbeb87 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -198,11 +198,12 @@ static bool handle_view_created(wlc_handle handle) { | |||
198 | if (pid) { | 198 | if (pid) { |
199 | // using newview as a temp storage location here, | 199 | // using newview as a temp storage location here, |
200 | // rather than adding yet another workspace var | 200 | // rather than adding yet another workspace var |
201 | if ((newview = workspace_for_pid(pid))) { | 201 | newview = workspace_for_pid(pid); |
202 | if (newview && newview != current_ws) { | ||
202 | focused = newview; | 203 | focused = newview; |
203 | newview = NULL; | ||
204 | return_to_workspace = true; | 204 | return_to_workspace = true; |
205 | } | 205 | } |
206 | newview = NULL; | ||
206 | } | 207 | } |
207 | } | 208 | } |
208 | 209 | ||
@@ -234,8 +235,12 @@ static bool handle_view_created(wlc_handle handle) { | |||
234 | switch (wlc_view_get_type(handle)) { | 235 | switch (wlc_view_get_type(handle)) { |
235 | // regular view created regularly | 236 | // regular view created regularly |
236 | case 0: | 237 | case 0: |
237 | newview = new_view(focused, handle); | 238 | if (parent) { |
238 | wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); | 239 | newview = new_floating_view(handle); |
240 | } else { | ||
241 | newview = new_view(focused, handle); | ||
242 | wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); | ||
243 | } | ||
239 | break; | 244 | break; |
240 | 245 | ||
241 | // Dmenu keeps viewfocus, but others with this flag don't, for now simulate | 246 | // Dmenu keeps viewfocus, but others with this flag don't, for now simulate |
diff --git a/swaylock/main.c b/swaylock/main.c index b5ce63ef..a0a2f1cb 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <getopt.h> | 11 | #include <getopt.h> |
12 | #include <signal.h> | 12 | #include <signal.h> |
13 | #include <stdbool.h> | 13 | #include <stdbool.h> |
14 | #include <unistd.h> | ||
14 | 15 | ||
15 | #include "client/window.h" | 16 | #include "client/window.h" |
16 | #include "client/registry.h" | 17 | #include "client/registry.h" |