gaps improvements

This commit is contained in:
Nate Symer 2018-07-12 11:51:25 -04:00
parent abcc2ef9eb
commit 8fdf85fee0
128 changed files with 1670 additions and 2718 deletions

View file

@ -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(WLR_ERROR, "Unsupported background mode: %s", mode);
wlr_log(L_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(WLR_ERROR, "Failed to load background image (%s).",
wlr_log(L_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(WLR_ERROR, "Failed to read background image.");
wlr_log(L_ERROR, "Failed to read background image.");
return NULL;
}
if (cairo_surface_status(image) != CAIRO_STATUS_SUCCESS) {
wlr_log(WLR_ERROR, "Failed to read background image: %s."
wlr_log(L_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."

View file

@ -97,7 +97,7 @@ struct ipc_response *ipc_recv_response(int socketfd) {
error_2:
free(response);
error_1:
wlr_log(WLR_ERROR, "Unable to allocate memory for IPC response");
wlr_log(L_ERROR, "Unable to allocate memory for IPC response");
return NULL;
}

View file

@ -2,7 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "log.h"
list_t *create_list(void) {
list_t *list = malloc(sizeof(list_t));
@ -83,20 +82,6 @@ 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];

View file

@ -8,7 +8,7 @@ void sway_terminate(int code);
void _sway_abort(const char *format, ...) {
va_list args;
va_start(args, format);
_wlr_vlog(WLR_ERROR, format, args);
_wlr_vlog(L_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(WLR_ERROR, format, args);
_wlr_vlog(L_ERROR, format, args);
va_end(args);
#ifndef NDEBUG

View file

@ -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(WLR_ERROR, "pango_parse_markup '%s' -> error %s", text,
wlr_log(L_ERROR, "pango_parse_markup '%s' -> error %s", text,
error->message);
g_error_free(error);
markup = false; // fallback to plain text

View file

@ -9,7 +9,7 @@ char *read_line(FILE *file) {
char *string = malloc(size);
char lastChar = '\0';
if (!string) {
wlr_log(WLR_ERROR, "Unable to allocate memory for read_line");
wlr_log(L_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(WLR_ERROR, "Unable to allocate memory for read_line");
wlr_log(L_ERROR, "Unable to allocate memory for read_line");
return NULL;
}
string = new_string;

View file

@ -92,7 +92,7 @@ static const struct {
int utf8_size(const char *s) {
uint8_t c = (uint8_t)*s;
for (size_t i = 0; i < sizeof(sizes) / sizeof(*sizes); ++i) {
for (size_t i = 0; i < sizeof(sizes) / 2; ++i) {
if ((c & sizes[i].mask) == sizes[i].result) {
return sizes[i].octets;
}

View file

@ -95,7 +95,7 @@ pid_t get_parent_pid(pid_t child) {
token = strtok(NULL, sep); // parent pid
parent = strtol(token, NULL, 10);
}
free(buffer);
fclose(stat);
}
@ -113,7 +113,7 @@ uint32_t parse_color(const char *color) {
int len = strlen(color);
if (len != 6 && len != 8) {
wlr_log(WLR_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
wlr_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
return 0xFFFFFFFF;
}
uint32_t res = (uint32_t)strtoul(color, NULL, 16);