summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
committeremersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
commit63b4bf500020cf35cebfdce2d73f8e359ff495c2 (patch)
tree76624b3d4820551261e5c15f773c403c1a41264e
parentebcdce457a318a0c23509fe1e5ab3a3dc94f24b6 (diff)
Update for swaywm/wlroots#1126
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--HACKING.md6
-rw-r--r--common/background-image.c8
-rw-r--r--common/ipc-client.c2
-rw-r--r--common/log.c4
-rw-r--r--common/pango.c2
-rw-r--r--common/readline.c4
-rw-r--r--common/util.c2
-rw-r--r--include/log.h10
-rw-r--r--sway/commands.c14
-rw-r--r--sway/commands/assign.c2
-rw-r--r--sway/commands/bar.c6
-rw-r--r--sway/commands/bar/binding_mode_indicator.c4
-rw-r--r--sway/commands/bar/font.c2
-rw-r--r--sway/commands/bar/height.c2
-rw-r--r--sway/commands/bar/hidden_state.c2
-rw-r--r--sway/commands/bar/id.c2
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/commands/bar/modifier.c2
-rw-r--r--sway/commands/bar/output.c2
-rw-r--r--sway/commands/bar/pango_markup.c4
-rw-r--r--sway/commands/bar/position.c2
-rw-r--r--sway/commands/bar/separator_symbol.c2
-rw-r--r--sway/commands/bar/status_command.c2
-rw-r--r--sway/commands/bar/strip_workspace_numbers.c4
-rw-r--r--sway/commands/bar/swaybar_command.c2
-rw-r--r--sway/commands/bar/workspace_buttons.c4
-rw-r--r--sway/commands/bar/wrap_scroll.c4
-rw-r--r--sway/commands/bind.c4
-rw-r--r--sway/commands/exec.c2
-rw-r--r--sway/commands/exec_always.c8
-rw-r--r--sway/commands/for_window.c2
-rw-r--r--sway/commands/input.c2
-rw-r--r--sway/commands/input/events.c2
-rw-r--r--sway/commands/input/tap.c2
-rw-r--r--sway/commands/input/xkb_layout.c2
-rw-r--r--sway/commands/input/xkb_model.c2
-rw-r--r--sway/commands/input/xkb_options.c2
-rw-r--r--sway/commands/input/xkb_rules.c2
-rw-r--r--sway/commands/input/xkb_variant.c2
-rw-r--r--sway/commands/mode.c2
-rw-r--r--sway/commands/output.c6
-rw-r--r--sway/commands/output/background.c6
-rw-r--r--sway/commands/rename.c2
-rw-r--r--sway/commands/resize.c2
-rw-r--r--sway/commands/set.c2
-rw-r--r--sway/commands/swaybg_command.c2
-rw-r--r--sway/commands/workspace.c2
-rw-r--r--sway/config.c52
-rw-r--r--sway/config/bar.c14
-rw-r--r--sway/config/input.c8
-rw-r--r--sway/config/output.c26
-rw-r--r--sway/config/seat.c6
-rw-r--r--sway/criteria.c2
-rw-r--r--sway/desktop/idle_inhibit_v1.c4
-rw-r--r--sway/desktop/layer_shell.c6
-rw-r--r--sway/desktop/output.c2
-rw-r--r--sway/desktop/transaction.c14
-rw-r--r--sway/desktop/xdg_shell.c4
-rw-r--r--sway/desktop/xdg_shell_v6.c4
-rw-r--r--sway/desktop/xwayland.c10
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/input/input-manager.c38
-rw-r--r--sway/input/keyboard.c8
-rw-r--r--sway/input/seat.c22
-rw-r--r--sway/ipc-server.c62
-rw-r--r--sway/main.c50
-rw-r--r--sway/server.c12
-rw-r--r--sway/tree/arrange.c24
-rw-r--r--sway/tree/container.c16
-rw-r--r--sway/tree/layout.c56
-rw-r--r--sway/tree/output.c6
-rw-r--r--sway/tree/view.c14
-rw-r--r--sway/tree/workspace.c14
-rw-r--r--swaybar/bar.c2
-rw-r--r--swaybar/i3bar.c4
-rw-r--r--swaybar/ipc.c4
-rw-r--r--swaybar/main.c8
-rw-r--r--swaybar/status_line.c6
-rw-r--r--swaybg/main.c6
-rw-r--r--swayidle/main.c78
-rw-r--r--swaylock/main.c20
-rw-r--r--swaylock/password.c6
-rw-r--r--swaylock/seat.c4
-rw-r--r--swaymsg/main.c2
85 files changed, 391 insertions, 385 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8a6c0208..f450563a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -107,7 +107,7 @@ int main(int argc, const char **argv) {
}
int desired_output = atoi(argv[1]);
- sway_log(L_INFO, "Using output %d of %d", desired_output, registry->outputs->length);
+ sway_log(WLR_INFO, "Using output %d of %d", desired_output, registry->outputs->length);
int i;
struct output_state *output = registry->outputs->items[desired_output];
struct window *window = window_setup(registry, 100, 100, false);
diff --git a/HACKING.md b/HACKING.md
index 3600db24..8965d3ec 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -3,9 +3,9 @@
Use `sway_log(importance, fmt, ...)` to log. The following importances are
available:
-* `L_DEBUG`: Debug messages, only shows with `sway -d`
-* `L_INFO`: Informational messages
-* `L_ERROR`: Error messages
+* `WLR_DEBUG`: Debug messages, only shows with `sway -d`
+* `WLR_INFO`: Informational messages
+* `WLR_ERROR`: Error messages
`sway_log` is a macro that calls `_sway_log` with the current filename and line
number, which are written into the log with your message.
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);
diff --git a/include/log.h b/include/log.h
index a9748127..dd526143 100644
--- a/include/log.h
+++ b/include/log.h
@@ -3,13 +3,19 @@
#include <stdbool.h>
#include <wlr/util/log.h>
+#ifdef __GNUC__
+#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
+#else
+#define ATTRIB_PRINTF(start, end)
+#endif
+
void _sway_abort(const char *filename, ...) ATTRIB_PRINTF(1, 2);
#define sway_abort(FMT, ...) \
- _sway_abort("[%s:%d] " FMT, wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
+ _sway_abort("[%s:%d] " FMT, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
bool _sway_assert(bool condition, const char* format, ...) ATTRIB_PRINTF(2, 3);
#define sway_assert(COND, FMT, ...) \
- _sway_assert(COND, "[%s:%d] %s:" FMT, wlr_strip_path(__FILE__), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
+ _sway_assert(COND, "[%s:%d] %s:" FMT, _wlr_strip_path(__FILE__), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
void error_handler(int sig);
diff --git a/sway/commands.c b/sway/commands.c
index ef477f38..6c5bea37 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -163,7 +163,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
int handlers_size) {
struct cmd_handler d = { .command=line };
struct cmd_handler *res = NULL;
- wlr_log(L_DEBUG, "find_handler(%s)", line);
+ wlr_log(WLR_DEBUG, "find_handler(%s)", line);
bool config_loading = config->reading || !config->active;
@@ -248,10 +248,10 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) {
cmd = argsep(&cmdlist, ",");
cmd += strspn(cmd, whitespace);
if (strcmp(cmd, "") == 0) {
- wlr_log(L_INFO, "Ignoring empty command.");
+ wlr_log(WLR_INFO, "Ignoring empty command.");
continue;
}
- wlr_log(L_INFO, "Handling command '%s'", cmd);
+ wlr_log(WLR_INFO, "Handling command '%s'", cmd);
//TODO better handling of argv
int argc;
char **argv = split_args(cmd, &argc);
@@ -355,7 +355,7 @@ struct cmd_results *config_command(char *exec) {
results = cmd_results_new(CMD_BLOCK_END, NULL, NULL);
goto cleanup;
}
- wlr_log(L_INFO, "handling config command '%s'", exec);
+ wlr_log(WLR_INFO, "handling config command '%s'", exec);
struct cmd_handler *handler = find_handler(argv[0], NULL, 0);
if (!handler) {
char *input = argv[0] ? argv[0] : "(empty)";
@@ -388,7 +388,7 @@ cleanup:
struct cmd_results *config_subcommand(char **argv, int argc,
struct cmd_handler *handlers, size_t handlers_size) {
char *command = join_args(argv, argc);
- wlr_log(L_DEBUG, "Subcommand: %s", command);
+ wlr_log(WLR_DEBUG, "Subcommand: %s", command);
free(command);
struct cmd_handler *handler = find_handler(argv[0], handlers,
@@ -479,7 +479,7 @@ struct cmd_results *config_commands_command(char *exec) {
}
policy->context = context;
- wlr_log(L_INFO, "Set command policy for %s to %d",
+ wlr_log(WLR_INFO, "Set command policy for %s to %d",
policy->command, policy->context);
results = cmd_results_new(CMD_SUCCESS, NULL, NULL);
@@ -493,7 +493,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
const char *input, const char *format, ...) {
struct cmd_results *results = malloc(sizeof(struct cmd_results));
if (!results) {
- wlr_log(L_ERROR, "Unable to allocate command results");
+ wlr_log(WLR_ERROR, "Unable to allocate command results");
return NULL;
}
results->status = status;
diff --git a/sway/commands/assign.c b/sway/commands/assign.c
index a90498ce..0bc0929a 100644
--- a/sway/commands/assign.c
+++ b/sway/commands/assign.c
@@ -45,7 +45,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
criteria->target = join_args(argv, target_len);
list_add(config->criteria, criteria);
- wlr_log(L_DEBUG, "assign: '%s' -> '%s' added", criteria->raw,
+ wlr_log(WLR_DEBUG, "assign: '%s' -> '%s' added", criteria->raw,
criteria->target);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index d84ce808..f6a70c17 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -63,13 +63,13 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
for (int i = 0; i < config->bars->length; ++i) {
struct bar_config *item = config->bars->items[i];
if (strcmp(item->id, argv[0]) == 0) {
- wlr_log(L_DEBUG, "Selecting bar: %s", argv[0]);
+ wlr_log(WLR_DEBUG, "Selecting bar: %s", argv[0]);
bar = item;
break;
}
}
if (!bar) {
- wlr_log(L_DEBUG, "Creating bar: %s", argv[0]);
+ wlr_log(WLR_DEBUG, "Creating bar: %s", argv[0]);
bar = default_bar_config();
if (!bar) {
return cmd_results_new(CMD_FAILURE, "bar",
@@ -108,7 +108,7 @@ struct cmd_results *cmd_bar(int argc, char **argv) {
// Set current bar
config->current_bar = bar;
- wlr_log(L_DEBUG, "Creating bar %s", bar->id);
+ wlr_log(WLR_DEBUG, "Creating bar %s", bar->id);
}
return config_subcommand(argv, argc, bar_handlers, sizeof(bar_handlers));
diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/commands/bar/binding_mode_indicator.c
index 3ba5f33f..0c48bee9 100644
--- a/sway/commands/bar/binding_mode_indicator.c
+++ b/sway/commands/bar/binding_mode_indicator.c
@@ -15,11 +15,11 @@ struct cmd_results *bar_cmd_binding_mode_indicator(int argc, char **argv) {
}
if (strcasecmp("yes", argv[0]) == 0) {
config->current_bar->binding_mode_indicator = true;
- wlr_log(L_DEBUG, "Enabling binding mode indicator on bar: %s",
+ wlr_log(WLR_DEBUG, "Enabling binding mode indicator on bar: %s",
config->current_bar->id);
} else if (strcasecmp("no", argv[0]) == 0) {
config->current_bar->binding_mode_indicator = false;
- wlr_log(L_DEBUG, "Disabling binding mode indicator on bar: %s",
+ wlr_log(WLR_DEBUG, "Disabling binding mode indicator on bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_INVALID, "binding_mode_indicator",
diff --git a/sway/commands/bar/font.c b/sway/commands/bar/font.c
index f036cbc3..2aa4e895 100644
--- a/sway/commands/bar/font.c
+++ b/sway/commands/bar/font.c
@@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
char *font = join_args(argv, argc);
free(config->current_bar->font);
config->current_bar->font = font;
- wlr_log(L_DEBUG, "Settings font '%s' for bar: %s",
+ wlr_log(WLR_DEBUG, "Settings font '%s' for bar: %s",
config->current_bar->font, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
diff --git a/sway/commands/bar/height.c b/sway/commands/bar/height.c
index 3160caed..18258526 100644
--- a/sway/commands/bar/height.c
+++ b/sway/commands/bar/height.c
@@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_height(int argc, char **argv) {
"Invalid height value: %s", argv[0]);
}
config->current_bar->height = height;
- wlr_log(L_DEBUG, "Setting bar height to %d on bar: %s",
+ wlr_log(WLR_DEBUG, "Setting bar height to %d on bar: %s",
height, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index 6641f184..502ce2c4 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -27,7 +27,7 @@ static struct cmd_results *bar_set_hidden_state(struct bar_config *bar,
if (!config->reading) {
ipc_event_barconfig_update(bar);
}
- wlr_log(L_DEBUG, "Setting hidden_state: '%s' for bar: %s",
+ wlr_log(WLR_DEBUG, "Setting hidden_state: '%s' for bar: %s",
bar->hidden_state, bar->id);
}
// free old mode
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
index 6ce86fef..65fa69fd 100644
--- a/sway/commands/bar/id.c
+++ b/sway/commands/bar/id.c
@@ -24,7 +24,7 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
}
}
- wlr_log(L_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
+ wlr_log(WLR_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
// free old bar id
free(config->current_bar->id);
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 34bb0a4f..28e2d77b 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -28,7 +28,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
if (!config->reading) {
ipc_event_barconfig_update(bar);
}