diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/container.c | 3 | ||||
-rw-r--r-- | sway/handlers.c | 22 | ||||
-rw-r--r-- | sway/layout.c | 6 | ||||
-rw-r--r-- | sway/log.h | 9 | ||||
-rw-r--r-- | sway/stringop.c | 1 | ||||
-rw-r--r-- | sway/workspace.c | 2 |
6 files changed, 26 insertions, 17 deletions
diff --git a/sway/container.c b/sway/container.c index 98941b2c..d1c8a7de 100644 --- a/sway/container.c +++ b/sway/container.c @@ -31,6 +31,9 @@ static void free_swayc(swayc_t *c) { } remove_child(c->parent, c); } + if (c->name) { + free(c->name); + } free(c); } diff --git a/sway/handlers.c b/sway/handlers.c index 9944be33..6f4cb477 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -88,22 +88,22 @@ static void handle_output_focused(wlc_handle output, bool focus) { static bool handle_view_created(wlc_handle handle) { swayc_t *focused = get_focused_container(&root_container); swayc_t *view = new_view(focused, handle); + //Leave unamanaged windows alone if (view) { - //Set maximize flag for windows. - //TODO: floating windows have this unset - wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); - unfocus_all(&root_container); - focus_view(view); arrange_windows(view->parent, -1, -1); - } else { //Unmanaged view + wlc_view_set_state(handle, WLC_BIT_MAXIMIZED, true); + if (!(wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) { + unfocus_all(&root_container); + focus_view(view); + } + else { + wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); + wlc_view_focus(handle); + } + } else { wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); wlc_view_focus(handle); } - if (wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { - unfocus_all(&root_container); - focus_view(focused); - arrange_windows(focused, -1, -1); - } return true; } diff --git a/sway/layout.c b/sway/layout.c index 918da9f0..8cf88be3 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -215,10 +215,10 @@ swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent) { } swayc_t *get_focused_container(swayc_t *parent) { - if (parent->focused == NULL) { - return parent; + while (parent->focused) { + parent = parent->focused; } - return get_focused_container(parent->focused); + return parent; } void unfocus_all(swayc_t *container) { @@ -1,6 +1,10 @@ #ifndef _SWAY_LOG_H #define _SWAY_LOG_H +#ifndef __GNUC__ +# define __attribute__(x) +#endif + typedef enum { L_SILENT = 0, L_ERROR = 1, @@ -8,9 +12,10 @@ typedef enum { L_DEBUG = 3, } log_importance_t; + void init_log(int verbosity); void sway_log_colors(int mode); -void sway_log(int verbosity, char* format, ...); -void sway_abort(char* format, ...); +void sway_log(int verbosity, char* format, ...)__attribute__((format (printf,2,3))); +void sway_abort(char* format, ...) __attribute__((format (printf,1,2))); #endif diff --git a/sway/stringop.c b/sway/stringop.c index bbc0bcdf..b944a43d 100644 --- a/sway/stringop.c +++ b/sway/stringop.c @@ -67,6 +67,7 @@ list_t *split_string(const char *str, const char *delims) { j++; i++; } + free(left); } } return res; diff --git a/sway/workspace.c b/sway/workspace.c index 49a1224f..a08877be 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -26,7 +26,7 @@ char *workspace_next_name(void) { list_t *args = split_string(command, " "); if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) { - sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]); + sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", (char *)args->items[1]); char* target = malloc(strlen(args->items[1]) + 1); strcpy(target, args->items[1]); while (*target == ' ' || *target == '\t') |