diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/background-image.c | 8 | ||||
-rw-r--r-- | common/ipc-client.c | 2 | ||||
-rw-r--r-- | common/list.c | 15 | ||||
-rw-r--r-- | common/log.c | 4 | ||||
-rw-r--r-- | common/pango.c | 2 | ||||
-rw-r--r-- | common/readline.c | 4 | ||||
-rw-r--r-- | common/util.c | 2 |
7 files changed, 26 insertions, 11 deletions
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) { | |||
18 | } else if (strcmp(mode, "solid_color") == 0) { | 18 | } else if (strcmp(mode, "solid_color") == 0) { |
19 | return BACKGROUND_MODE_SOLID_COLOR; | 19 | return BACKGROUND_MODE_SOLID_COLOR; |
20 | } | 20 | } |
21 | wlr_log(L_ERROR, "Unsupported background mode: %s", mode); | 21 | wlr_log(WLR_ERROR, "Unsupported background mode: %s", mode); |
22 | return BACKGROUND_MODE_INVALID; | 22 | return BACKGROUND_MODE_INVALID; |
23 | } | 23 | } |
24 | 24 | ||
@@ -28,7 +28,7 @@ cairo_surface_t *load_background_image(const char *path) { | |||
28 | GError *err = NULL; | 28 | GError *err = NULL; |
29 | GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err); | 29 | GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, &err); |
30 | if (!pixbuf) { | 30 | if (!pixbuf) { |
31 | wlr_log(L_ERROR, "Failed to load background image (%s).", | 31 | wlr_log(WLR_ERROR, "Failed to load background image (%s).", |
32 | err->message); | 32 | err->message); |
33 | return false; | 33 | return false; |
34 | } | 34 | } |
@@ -38,11 +38,11 @@ cairo_surface_t *load_background_image(const char *path) { | |||
38 | image = cairo_image_surface_create_from_png(path); | 38 | image = cairo_image_surface_create_from_png(path); |
39 | #endif //HAVE_GDK_PIXBUF | 39 | #endif //HAVE_GDK_PIXBUF |
40 | if (!image) { | 40 | if (!image) { |
41 | wlr_log(L_ERROR, "Failed to read background image."); | 41 | wlr_log(WLR_ERROR, "Failed to read background image."); |
42 | return NULL; | 42 | return NULL; |
43 | } | 43 | } |
44 | if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) { | 44 | if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) { |
45 | wlr_log(L_ERROR, "Failed to read background image: %s." | 45 | wlr_log(WLR_ERROR, "Failed to read background image: %s." |
46 | #ifndef HAVE_GDK_PIXBUF | 46 | #ifndef HAVE_GDK_PIXBUF |
47 | "\nSway was compiled without gdk_pixbuf support, so only" | 47 | "\nSway was compiled without gdk_pixbuf support, so only" |
48 | "\nPNG images can be loaded. This is the likely cause." | 48 | "\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) { | |||
97 | error_2: | 97 | error_2: |
98 | free(response); | 98 | free(response); |
99 | error_1: | 99 | error_1: |
100 | wlr_log(L_ERROR, "Unable to allocate memory for IPC response"); | 100 | wlr_log(WLR_ERROR, "Unable to allocate memory for IPC response"); |
101 | return NULL; | 101 | return NULL; |
102 | } | 102 | } |
103 | 103 | ||
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 @@ | |||
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include "log.h" | ||
5 | 6 | ||
6 | list_t *create_list(void) { | 7 | list_t *create_list(void) { |
7 | list_t *list = malloc(sizeof(list_t)); | 8 | list_t *list = malloc(sizeof(list_t)); |
@@ -82,6 +83,20 @@ void list_swap(list_t *list, int src, int dest) { | |||
82 | list->items[dest] = tmp; | 83 | list->items[dest] = tmp; |
83 | } | 84 | } |
84 | 85 | ||
86 | void list_move_to_end(list_t *list, void *item) { | ||
87 | int i; | ||
88 | for (i = 0; i < list->length; ++i) { | ||
89 | if (list->items[i] == item) { | ||
90 | break; | ||
91 | } | ||
92 | } | ||
93 | if (!sway_assert(i < list->length, "Item not found in list")) { | ||
94 | return; | ||
95 | } | ||
96 | list_del(list, i); | ||
97 | list_add(list, item); | ||
98 | } | ||
99 | |||
85 | static void list_rotate(list_t *list, int from, int to) { | 100 | static void list_rotate(list_t *list, int from, int to) { |
86 | void *tmp = list->items[to]; | 101 | void *tmp = list->items[to]; |
87 | 102 | ||
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); | |||
8 | void _sway_abort(const char *format, ...) { | 8 | void _sway_abort(const char *format, ...) { |
9 | va_list args; | 9 | va_list args; |
10 | va_start(args, format); | 10 | va_start(args, format); |
11 | _wlr_vlog(L_ERROR, format, args); | 11 | _wlr_vlog(WLR_ERROR, format, args); |
12 | va_end(args); | 12 | va_end(args); |
13 | sway_terminate(EXIT_FAILURE); | 13 | sway_terminate(EXIT_FAILURE); |
14 | } | 14 | } |
@@ -20,7 +20,7 @@ bool _sway_assert(bool condition, const char *format, ...) { | |||
20 | 20 | ||
21 | va_list args; | 21 | va_list args; |
22 | va_start(args, format); | 22 | va_start(args, format); |
23 | _wlr_vlog(L_ERROR, format, args); | 23 | _wlr_vlog(WLR_ERROR, format, args); |
24 | va_end(args); | 24 | va_end(args); |
25 | 25 | ||
26 | #ifndef NDEBUG | 26 | #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, | |||
81 | pango_layout_set_markup(layout, buf, -1); | 81 | pango_layout_set_markup(layout, buf, -1); |
82 | free(buf); | 82 | free(buf); |
83 | } else { | 83 | } else { |
84 | wlr_log(L_ERROR, "pango_parse_markup '%s' -> error %s", text, | 84 | wlr_log(WLR_ERROR, "pango_parse_markup '%s' -> error %s", text, |
85 | error->message); | 85 | error->message); |
86 | g_error_free(error); | 86 | g_error_free(error); |
87 | markup = false; // fallback to plain text | 87 | 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) { | |||
9 | char *string = malloc(size); | 9 | char *string = malloc(size); |
10 | char lastChar = '\0'; | 10 | char lastChar = '\0'; |
11 | if (!string) { | 11 | if (!string) { |
12 | wlr_log(L_ERROR, "Unable to allocate memory for read_line"); | 12 | wlr_log(WLR_ERROR, "Unable to allocate memory for read_line"); |
13 | return NULL; | 13 | return NULL; |
14 | } | 14 | } |
15 | while (1) { | 15 | while (1) { |
@@ -30,7 +30,7 @@ char *read_line(FILE *file) { | |||
30 | char *new_string = realloc(string, size *= 2); | 30 | char *new_string = realloc(string, size *= 2); |
31 | if (!new_string) { | 31 | if (!new_string) { |
32 | free(string); | 32 | free(string); |
33 | wlr_log(L_ERROR, "Unable to allocate memory for read_line"); | 33 | wlr_log(WLR_ERROR, "Unable to allocate memory for read_line"); |
34 | return NULL; | 34 | return NULL; |
35 | } | 35 | } |
36 | string = new_string; | 36 | 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) { | |||
113 | 113 | ||
114 | int len = strlen(color); | 114 | int len = strlen(color); |
115 | if (len != 6 && len != 8) { | 115 | if (len != 6 && len != 8) { |
116 | wlr_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); | 116 | wlr_log(WLR_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); |
117 | return 0xFFFFFFFF; | 117 | return 0xFFFFFFFF; |
118 | } | 118 | } |
119 | uint32_t res = (uint32_t)strtoul(color, NULL, 16); | 119 | uint32_t res = (uint32_t)strtoul(color, NULL, 16); |