From 63b4bf500020cf35cebfdce2d73f8e359ff495c2 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 9 Jul 2018 22:54:30 +0100 Subject: Update for swaywm/wlroots#1126 --- common/background-image.c | 8 ++++---- common/ipc-client.c | 2 +- common/log.c | 4 ++-- common/pango.c | 2 +- common/readline.c | 4 ++-- common/util.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/background-image.c b/common/background-image.c index e5fb4433..f3d2551e 100644 --- a/common/background-image.c +++ b/common/background-image.c @@ -18,7 +18,7 @@ enum background_mode parse_background_mode(const char *mode) { } else if (strcmp(mode, "solid_color") == 0) { return BACKGROUND_MODE_SOLID_COLOR; } - wlr_log(L_ERROR, "Unsupported background mode: %s", mode); + wlr_log(WLR_ERROR, "Unsupported background mode: %s", mode); return BACKGROUND_MODE_INVALID; } @@ -28,7 +28,7 @@ cairo_surface_t *load_background_image(const char *path) { GError *err = NULL; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err); if (!pixbuf) { - wlr_log(L_ERROR, "Failed to load background image (%s).", + wlr_log(WLR_ERROR, "Failed to load background image (%s).", err->message); return false; } @@ -38,11 +38,11 @@ cairo_surface_t *load_background_image(const char *path) { image = cairo_image_surface_create_from_png(path); #endif //HAVE_GDK_PIXBUF if (!image) { - wlr_log(L_ERROR, "Failed to read background image."); + wlr_log(WLR_ERROR, "Failed to read background image."); return NULL; } if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) { - wlr_log(L_ERROR, "Failed to read background image: %s." + wlr_log(WLR_ERROR, "Failed to read background image: %s." #ifndef HAVE_GDK_PIXBUF "\nSway was compiled without gdk_pixbuf support, so only" "\nPNG images can be loaded. This is the likely cause." diff --git a/common/ipc-client.c b/common/ipc-client.c index a88df080..4d2d88cc 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c @@ -97,7 +97,7 @@ struct ipc_response *ipc_recv_response(int socketfd) { error_2: free(response); error_1: - wlr_log(L_ERROR, "Unable to allocate memory for IPC response"); + wlr_log(WLR_ERROR, "Unable to allocate memory for IPC response"); return NULL; } diff --git a/common/log.c b/common/log.c index 2cc7289c..847f3952 100644 --- a/common/log.c +++ b/common/log.c @@ -8,7 +8,7 @@ void sway_terminate(int code); void _sway_abort(const char *format, ...) { va_list args; va_start(args, format); - _wlr_vlog(L_ERROR, format, args); + _wlr_vlog(WLR_ERROR, format, args); va_end(args); sway_terminate(EXIT_FAILURE); } @@ -20,7 +20,7 @@ bool _sway_assert(bool condition, const char *format, ...) { va_list args; va_start(args, format); - _wlr_vlog(L_ERROR, format, args); + _wlr_vlog(WLR_ERROR, format, args); va_end(args); #ifndef NDEBUG diff --git a/common/pango.c b/common/pango.c index c88e50ce..92703f80 100644 --- a/common/pango.c +++ b/common/pango.c @@ -81,7 +81,7 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, pango_layout_set_markup(layout, buf, -1); free(buf); } else { - wlr_log(L_ERROR, "pango_parse_markup '%s' -> error %s", text, + wlr_log(WLR_ERROR, "pango_parse_markup '%s' -> error %s", text, error->message); g_error_free(error); markup = false; // fallback to plain text diff --git a/common/readline.c b/common/readline.c index 1c396a90..a2c69018 100644 --- a/common/readline.c +++ b/common/readline.c @@ -9,7 +9,7 @@ char *read_line(FILE *file) { char *string = malloc(size); char lastChar = '\0'; if (!string) { - wlr_log(L_ERROR, "Unable to allocate memory for read_line"); + wlr_log(WLR_ERROR, "Unable to allocate memory for read_line"); return NULL; } while (1) { @@ -30,7 +30,7 @@ char *read_line(FILE *file) { char *new_string = realloc(string, size *= 2); if (!new_string) { free(string); - wlr_log(L_ERROR, "Unable to allocate memory for read_line"); + wlr_log(WLR_ERROR, "Unable to allocate memory for read_line"); return NULL; } string = new_string; diff --git a/common/util.c b/common/util.c index 678926ed..e8a88772 100644 --- a/common/util.c +++ b/common/util.c @@ -113,7 +113,7 @@ uint32_t parse_color(const char *color) { int len = strlen(color); if (len != 6 && len != 8) { - wlr_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); + wlr_log(WLR_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); return 0xFFFFFFFF; } uint32_t res = (uint32_t)strtoul(color, NULL, 16); -- cgit v1.2.3-70-g09d2 From 15dc5286e280ddd06e845dc57115243e72f2339e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 11 Jul 2018 19:50:02 +1000 Subject: Move floating windows to front when focused --- common/list.c | 15 +++++++++++++++ include/list.h | 2 ++ sway/input/seat.c | 8 ++++++++ 3 files changed, 25 insertions(+) (limited to 'common') diff --git a/common/list.c b/common/list.c index 39cc10e1..66d52f70 100644 --- a/common/list.c +++ b/common/list.c @@ -2,6 +2,7 @@ #include #include #include +#include "log.h" list_t *create_list(void) { list_t *list = malloc(sizeof(list_t)); @@ -82,6 +83,20 @@ void list_swap(list_t *list, int src, int dest) { list->items[dest] = tmp; } +void list_move_to_end(list_t *list, void *item) { + int i; + for (i = 0; i < list->length; ++i) { + if (list->items[i] == item) { + break; + } + } + if (!sway_assert(i < list->length, "Item not found in list")) { + return; + } + list_del(list, i); + list_add(list, item); +} + static void list_rotate(list_t *list, int from, int to) { void *tmp = list->items[to]; diff --git a/include/list.h b/include/list.h index 7eead4ac..5a0d7d80 100644 --- a/include/list.h +++ b/include/list.h @@ -24,4 +24,6 @@ int list_seq_find(list_t *list, int compare(const void *item, const void *cmp_to void list_stable_sort(list_t *list, int compare(const void *a, const void *b)); // swap two elements in a list void list_swap(list_t *list, int src, int dest); +// move item to end of list +void list_move_to_end(list_t *list, void *item); #endif diff --git a/sway/input/seat.c b/sway/input/seat.c index 5dadb31d..bf4e8876 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -666,6 +666,14 @@ void seat_set_focus_warp(struct sway_seat *seat, container_damage_whole(container->parent); } + // If we've focused a floating container, bring it to the front. + // We do this by putting it at the end of the floating list. + // This must happen for both the pending and current children lists. + if (container_is_floating(container)) { + list_move_to_end(container->parent->children, container); + list_move_to_end(container->parent->current.children, container); + } + // clean up unfocused empty workspace on new output if (new_output_last_ws) { if (!workspace_is_visible(new_output_last_ws) -- cgit v1.2.3-70-g09d2