Merge pull request #2234 from emersion/wlr-log-prefix

Update for swaywm/wlroots#1126
This commit is contained in:
Drew DeVault 2018-07-09 16:23:03 -07:00 committed by GitHub
commit fbeef1322f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 391 additions and 385 deletions

View file

@ -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);

View file

@ -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.

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(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."

View file

@ -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;
}

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(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

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(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

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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));

View file

@ -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",

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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

View file

@ -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);

View file

@ -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);
}
wlr_log(L_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
wlr_log(WLR_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
}
// free old mode

View file

@ -30,7 +30,7 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
}
free_flat_list(split);
config->current_bar->modifier = mod;
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -42,7 +42,7 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
if (add_output) {
list_add(outputs, strdup(output));
wlr_log(L_DEBUG, "Adding bar: '%s' to output '%s'",
wlr_log(WLR_DEBUG, "Adding bar: '%s' to output '%s'",
config->current_bar->id, output);
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -13,11 +13,11 @@ struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) {
}
if (strcasecmp("enabled", argv[0]) == 0) {
config->current_bar->pango_markup = true;
wlr_log(L_DEBUG, "Enabling pango markup for bar: %s",
wlr_log(WLR_DEBUG, "Enabling pango markup for bar: %s",
config->current_bar->id);
} else if (strcasecmp("disabled", argv[0]) == 0) {
config->current_bar->pango_markup = false;
wlr_log(L_DEBUG, "Disabling pango markup for bar: %s",
wlr_log(WLR_DEBUG, "Disabling pango markup for bar: %s",
config->current_bar->id);
} else {
error = cmd_results_new(CMD_INVALID, "pango_markup",

View file

@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
char *valid[] = { "top", "bottom", "left", "right" };
for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) {
if (strcasecmp(valid[i], argv[0]) == 0) {
wlr_log(L_DEBUG, "Setting bar position '%s' for bar: %s",
wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s",
argv[0], config->current_bar->id);
config->current_bar->position = strdup(argv[0]);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_separator_symbol(int argc, char **argv) {
}
free(config->current_bar->separator_symbol);
config->current_bar->separator_symbol = strdup(argv[0]);
wlr_log(L_DEBUG, "Settings separator_symbol '%s' for bar: %s",
wlr_log(WLR_DEBUG, "Settings separator_symbol '%s' for bar: %s",
config->current_bar->separator_symbol, config->current_bar->id);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
}
free(config->current_bar->status_command);
config->current_bar->status_command = join_args(argv, argc);
wlr_log(L_DEBUG, "Feeding bar with status command: %s",
wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
config->current_bar->status_command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -15,11 +15,11 @@ struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
}
if (strcasecmp("yes", argv[0]) == 0) {
config->current_bar->strip_workspace_numbers = true;
wlr_log(L_DEBUG, "Stripping workspace numbers on bar: %s",
wlr_log(WLR_DEBUG, "Stripping workspace numbers on bar: %s",
config->current_bar->id);
} else if (strcasecmp("no", argv[0]) == 0) {
config->current_bar->strip_workspace_numbers = false;
wlr_log(L_DEBUG, "Enabling workspace numbers on bar: %s",
wlr_log(WLR_DEBUG, "Enabling workspace numbers on bar: %s",
config->current_bar->id);
} else {
return cmd_results_new(CMD_INVALID,

View file

@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
}
free(config->current_bar->swaybar_command);
config->current_bar->swaybar_command = join_args(argv, argc);
wlr_log(L_DEBUG, "Using custom swaybar command: %s",
wlr_log(WLR_DEBUG, "Using custom swaybar command: %s",
config->current_bar->swaybar_command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -14,11 +14,11 @@ struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) {
}
if (strcasecmp("yes", argv[0]) == 0) {
config->current_bar->workspace_buttons = true;
wlr_log(L_DEBUG, "Enabling workspace buttons on bar: %s",
wlr_log(WLR_DEBUG, "Enabling workspace buttons on bar: %s",
config->current_bar->id);
} else if (strcasecmp("no", argv[0]) == 0) {
config->current_bar->workspace_buttons = false;
wlr_log(L_DEBUG, "Disabling workspace buttons on bar: %s",
wlr_log(WLR_DEBUG, "Disabling workspace buttons on bar: %s",
config->current_bar->id);
} else {
return cmd_results_new(CMD_INVALID, "workspace_buttons",

View file

@ -13,11 +13,11 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) {
}
if (strcasecmp("yes", argv[0]) == 0) {
config->current_bar->wrap_scroll = true;
wlr_log(L_DEBUG, "Enabling wrap scroll on bar: %s",
wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s",
config->current_bar->id);
} else if (strcasecmp("no", argv[0]) == 0) {
config->current_bar->wrap_scroll = false;
wlr_log(L_DEBUG, "Disabling wrap scroll on bar: %s",
wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s",
config->current_bar->id);
} else {
return cmd_results_new(CMD_INVALID,

View file

@ -184,7 +184,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
for (int i = 0; i < mode_bindings->length; ++i) {
struct sway_binding *config_binding = mode_bindings->items[i];
if (binding_key_compare(binding, config_binding)) {
wlr_log(L_DEBUG, "overwriting old binding with command '%s'",
wlr_log(WLR_DEBUG, "overwriting old binding with command '%s'",
config_binding->command);
free_sway_binding(config_binding);
mode_bindings->items[i] = binding;
@ -196,7 +196,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
list_add(mode_bindings, binding);
}
wlr_log(L_DEBUG, "%s - Bound %s to command %s",
wlr_log(WLR_DEBUG, "%s - Bound %s to command %s",
bindtype, argv[0], binding->command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -8,7 +8,7 @@ struct cmd_results *cmd_exec(int argc, char **argv) {
if (!config->active) return cmd_results_new(CMD_DEFER, "exec", NULL);
if (config->reloading) {
char *args = join_args(argv, argc);
wlr_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
wlr_log(WLR_DEBUG, "Ignoring 'exec %s' due to reload", args);
free(args);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -20,7 +20,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
char *tmp = NULL;
if (strcmp((char*)*argv, "--no-startup-id") == 0) {
wlr_log(L_INFO, "exec switch '--no-startup-id' not supported, ignored.");
wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored.");
if ((error = checkarg(argc - 1, "exec_always", EXPECTED_MORE_THAN, 0))) {
return error;
}
@ -35,11 +35,11 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
strncpy(cmd, tmp, sizeof(cmd) - 1);
cmd[sizeof(cmd) - 1] = 0;
free(tmp);
wlr_log(L_DEBUG, "Executing %s", cmd);
wlr_log(WLR_DEBUG, "Executing %s", cmd);
int fd[2];
if (pipe(fd) != 0) {
wlr_log(L_ERROR, "Unable to create pipe for fork");
wlr_log(WLR_ERROR, "Unable to create pipe for fork");
}
pid_t pid, child;
@ -73,7 +73,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
// cleanup child process
waitpid(pid, NULL, 0);
if (child > 0) {
wlr_log(L_DEBUG, "Child process created with pid %d", child);
wlr_log(WLR_DEBUG, "Child process created with pid %d", child);
// TODO: add PID to active workspace
} else {
return cmd_results_new(CMD_FAILURE, "exec_always",

View file

@ -24,7 +24,7 @@ struct cmd_results *cmd_for_window(int argc, char **argv) {
criteria->cmdlist = join_args(argv + 1, argc - 1);
list_add(config->criteria, criteria);
wlr_log(L_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);
wlr_log(WLR_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}

View file

@ -35,7 +35,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
return error;
}
wlr_log(L_DEBUG, "entering input block: %s", argv[0]);
wlr_log(WLR_DEBUG, "entering input block: %s", argv[0]);
config->handler_context.input_config = new_input_config(argv[0]);
if (!config->handler_context.input_config) {

View file

@ -16,7 +16,7 @@ struct cmd_results *input_cmd_events(int argc, char **argv) {
return cmd_results_new(CMD_FAILURE, "events",
"No input device defined.");
}
wlr_log(L_DEBUG, "events for device: %s",
wlr_log(WLR_DEBUG, "events for device: %s",
current_input_config->identifier);
struct input_config *new_config =
new_input_config(current_input_config->identifier);

View file

@ -28,7 +28,7 @@ struct cmd_results *input_cmd_tap(int argc, char **argv) {
"Expected 'tap <enabled|disabled>'");
}
wlr_log(L_DEBUG, "apply-tap for device: %s",
wlr_log(WLR_DEBUG, "apply-tap for device: %s",
current_input_config->identifier);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
new_config->xkb_layout = strdup(argv[0]);
wlr_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s",
wlr_log(WLR_DEBUG, "apply-xkb_layout for device: %s layout: %s",
current_input_config->identifier, new_config->xkb_layout);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
new_config->xkb_model = strdup(argv[0]);
wlr_log(L_DEBUG, "apply-xkb_model for device: %s model: %s",
wlr_log(WLR_DEBUG, "apply-xkb_model for device: %s model: %s",
current_input_config->identifier, new_config->xkb_model);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
new_config->xkb_options = strdup(argv[0]);
wlr_log(L_DEBUG, "apply-xkb_options for device: %s options: %s",
wlr_log(WLR_DEBUG, "apply-xkb_options for device: %s options: %s",
current_input_config->identifier, new_config->xkb_options);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
new_config->xkb_rules = strdup(argv[0]);
wlr_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s",
wlr_log(WLR_DEBUG, "apply-xkb_rules for device: %s rules: %s",
current_input_config->identifier, new_config->xkb_rules);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
new_config->xkb_variant = strdup(argv[0]);
wlr_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s",
wlr_log(WLR_DEBUG, "apply-xkb_variant for device: %s variant: %s",
current_input_config->identifier, new_config->xkb_variant);
apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -65,7 +65,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) {
return error;
}
if ((config->reading && argc > 1) || (!config->reading && argc == 1)) {
wlr_log(L_DEBUG, "Switching to mode `%s' (pango=%d)",
wlr_log(WLR_DEBUG, "Switching to mode `%s' (pango=%d)",
mode->name, mode->pango);
}
// Set current mode

View file

@ -29,7 +29,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
struct output_config *output = new_output_config(argv[0]);
if (!output) {
wlr_log(L_ERROR, "Failed to allocate output config");
wlr_log(WLR_ERROR, "Failed to allocate output config");
return NULL;
}
argc--; argv++;
@ -71,7 +71,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
list_add(config->output_configs, output);
}
wlr_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
wlr_log(WLR_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
"position %d,%d scale %f transform %d) (bg %s %s) (dpms %d)",
output->name, output->enabled, output->width, output->height,
output->refresh_rate, output->x, output->y, output->scale,
@ -85,7 +85,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
struct sway_output *sway_output;
wl_list_for_each(sway_output, &root_container.sway_root->outputs, link) {
output_get_identifier(identifier, sizeof(identifier), sway_output);
wlr_log(L_DEBUG, "Checking identifier %s", identifier);
wlr_log(WLR_DEBUG, "Checking identifier %s", identifier);
if (all || strcmp(sway_output->wlr_output->name, output->name) == 0
|| strcmp(identifier, output->name) == 0) {
if (!sway_output->swayc) {

View file

@ -72,7 +72,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
src = strdup(p.we_wordv[0]);
wordfree(&p);
if (!src) {
wlr_log(L_ERROR, "Failed to duplicate string");
wlr_log(WLR_ERROR, "Failed to duplicate string");
return cmd_results_new(CMD_FAILURE, "output",
"Unable to allocate resource");
}
@ -82,7 +82,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
char *conf = strdup(config->current_config);
if (!conf) {
wlr_log(L_ERROR, "Failed to duplicate string");
wlr_log(WLR_ERROR, "Failed to duplicate string");
free(src);
return cmd_results_new(CMD_FAILURE, "output",
"Unable to allocate resources");
@ -94,7 +94,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
if (!src) {
free(rel_path);
free(conf);
wlr_log(L_ERROR, "Unable to allocate memory");
wlr_log(WLR_ERROR, "Unable to allocate memory");
return cmd_results_new(CMD_FAILURE, "output",
"Unable to allocate resources");
}

View file

@ -68,7 +68,7 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
"Workspace already exists");
}
wlr_log(L_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);
wlr_log(WLR_DEBUG, "renaming workspace '%s' to '%s'", workspace->name, new_name);
free(workspace->name);
workspace->name = new_name;

View file

@ -95,7 +95,7 @@ static void resize_tiled(int amount, enum resize_axis axis) {
return;
}
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Found the proper parent: %p. It has %d l conts, and %d r conts",
parent->parent, minor_weight, major_weight);

View file

@ -32,7 +32,7 @@ struct cmd_results *cmd_set(int argc, char **argv) {
}
if (argv[0][0] != '$') {
wlr_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
wlr_log(WLR_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
size_t size = snprintf(NULL, 0, "$%s", argv[0]);
tmp = malloc(size + 1);

View file

@ -13,7 +13,7 @@ struct cmd_results *cmd_swaybg_command(int argc, char **argv) {
free(config->swaybg_command);
}
config->swaybg_command = join_args(argv, argc);
wlr_log(L_DEBUG, "Using custom swaybg command: %s",
wlr_log(WLR_DEBUG, "Using custom swaybg command: %s",
config->swaybg_command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View file

@ -51,7 +51,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
free(old); // workspaces can only be assigned to a single output
list_del(config->workspace_outputs, i);
}
wlr_log(L_DEBUG, "Assigning workspace %s to output %s", wso->workspace, wso->output);
wlr_log(WLR_DEBUG, "Assigning workspace %s to output %s", wso->workspace, wso->output);
list_add(config->workspace_outputs, wso);
} else {
if (config->reading || !config->active) {

View file

@ -276,12 +276,12 @@ static char *get_config_path(void) {
char *home = getenv("HOME");
char *config_home = malloc(strlen(home) + strlen("/.config") + 1);
if (!config_home) {
wlr_log(L_ERROR, "Unable to allocate $HOME/.config");
wlr_log(WLR_ERROR, "Unable to allocate $HOME/.config");
} else {
strcpy(config_home, home);
strcat(config_home, "/.config");
setenv("XDG_CONFIG_HOME", config_home, 1);
wlr_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
wlr_log(WLR_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
free(config_home);
}
}
@ -308,11 +308,11 @@ const char *current_config_path;
static bool load_config(const char *path, struct sway_config *config) {
if (path == NULL) {
wlr_log(L_ERROR, "Unable to find a config file!");
wlr_log(WLR_ERROR, "Unable to find a config file!");
return false;
}
wlr_log(L_INFO, "Loading config from %s", path);
wlr_log(WLR_INFO, "Loading config from %s", path);
current_config_path = path;
struct stat sb;
@ -322,7 +322,7 @@ static bool load_config(const char *path, struct sway_config *config) {
FILE *f = fopen(path, "r");
if (!f) {
wlr_log(L_ERROR, "Unable to open %s for reading", path);
wlr_log(WLR_ERROR, "Unable to open %s for reading", path);
return false;
}
@ -330,7 +330,7 @@ static bool load_config(const char *path, struct sway_config *config) {
fclose(f);
if (!config_load_success) {
wlr_log(L_ERROR, "Error(s) loading config!");
wlr_log(WLR_ERROR, "Error(s) loading config!");
}
current_config_path = NULL;
@ -353,7 +353,7 @@ bool load_main_config(const char *file, bool is_active) {
config_defaults(config);
if (is_active) {
wlr_log(L_DEBUG, "Performing configuration file reload");
wlr_log(WLR_DEBUG, "Performing configuration file reload");
config->reloading = true;
config->active = true;
}
@ -369,7 +369,7 @@ bool load_main_config(const char *file, bool is_active) {
/*
DIR *dir = opendir(SYSCONFDIR "/sway/security.d");
if (!dir) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"%s does not exist, sway will have no security configuration"
" and will probably be broken", SYSCONFDIR "/sway/security.d");
} else {
@ -398,7 +398,7 @@ bool load_main_config(const char *file, bool is_active) {
if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 ||
(((s.st_mode & 0777) != 0644) &&
(s.st_mode & 0777) != 0444)) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"Refusing to load %s - it must be owned by root "
"and mode 644 or 444", _path);
success = false;
@ -436,7 +436,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
len = len + strlen(parent_dir) + 2;
full_path = malloc(len * sizeof(char));
if (!full_path) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"Unable to allocate full path to included config");
return false;
}
@ -449,7 +449,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
free(full_path);
if (real_path == NULL) {
wlr_log(L_DEBUG, "%s not found.", path);
wlr_log(WLR_DEBUG, "%s not found.", path);
return false;
}
@ -458,7 +458,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
for (j = 0; j < config->config_chain->length; ++j) {
char *old_path = config->config_chain->items[j];
if (strcmp(real_path, old_path) == 0) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"%s already included once, won't be included again.",
real_path);
free(real_path);
@ -512,7 +512,7 @@ bool load_include_configs(const char *path, struct sway_config *config) {
// restore wd
if (chdir(wd) < 0) {
free(wd);
wlr_log(L_ERROR, "failed to restore working directory");
wlr_log(WLR_ERROR, "failed to restore working directory");
return false;
}
@ -527,13 +527,13 @@ static int detect_brace_on_following_line(FILE *file, char *line,
char *peeked = NULL;
long position = 0;
do {
wlr_log(L_DEBUG, "Peeking line %d", line_number + lines + 1);
wlr_log(WLR_DEBUG, "Peeking line %d", line_number + lines + 1);
free(peeked);
peeked = peek_line(file, lines, &position);
if (peeked) {
peeked = strip_whitespace(peeked);
}
wlr_log(L_DEBUG, "Peeked line: `%s`", peeked);
wlr_log(WLR_DEBUG, "Peeked line: `%s`", peeked);
lines++;
} while (peeked && strlen(peeked) == 0);
@ -552,7 +552,7 @@ static char *expand_line(const char *block, const char *line, bool add_brace) {
+ (add_brace ? 2 : 0) + 1;
char *expanded = calloc(1, size);
if (!expanded) {
wlr_log(L_ERROR, "Cannot allocate expanded line buffer");
wlr_log(WLR_ERROR, "Cannot allocate expanded line buffer");
return NULL;
}
snprintf(expanded, size, "%s%s%s%s", block ? block : "",
@ -572,7 +572,7 @@ bool read_config(FILE *file, struct sway_config *config) {
continue;
}
line_number++;
wlr_log(L_DEBUG, "Read line %d: %s", line_number, line);
wlr_log(WLR_DEBUG, "Read line %d: %s", line_number, line);
line = strip_whitespace(line);
if (line[0] == '#') {
free(line);
@ -586,7 +586,7 @@ bool read_config(FILE *file, struct sway_config *config) {
line_number);
if (brace_detected > 0) {
line_number += brace_detected;
wlr_log(L_DEBUG, "Detected open brace on line %d", line_number);
wlr_log(WLR_DEBUG, "Detected open brace on line %d", line_number);
}
char *expanded = expand_line(block, line, brace_detected > 0);
if (!expanded) {
@ -594,7 +594,7 @@ bool read_config(FILE *file, struct sway_config *config) {
list_free(stack);
return false;
}
wlr_log(L_DEBUG, "Expanded line: %s", expanded);
wlr_log(WLR_DEBUG, "Expanded line: %s", expanded);
struct cmd_results *res;
if (block && strcmp(block, "<commands>") == 0) {
// Special case
@ -606,23 +606,23 @@ bool read_config(FILE *file, struct sway_config *config) {
switch(res->status) {
case CMD_FAILURE:
case CMD_INVALID:
wlr_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number,
wlr_log(WLR_ERROR, "Error on line %i '%s': %s (%s)", line_number,
line, res->error, config->current_config);
success = false;
break;
case CMD_DEFER:
wlr_log(L_DEBUG, "Deferring command `%s'", line);
wlr_log(WLR_DEBUG, "Deferring command `%s'", line);
list_add(config->cmd_queue, strdup(line));
break;
case CMD_BLOCK_COMMANDS:
wlr_log(L_DEBUG, "Entering commands block");
wlr_log(WLR_DEBUG, "Entering commands block");
list_insert(stack, 0, "<commands>");
break;
case CMD_BLOCK:
wlr_log(L_DEBUG, "Entering block '%s'", res->input);
wlr_log(WLR_DEBUG, "Entering block '%s'", res->input);
list_insert(stack, 0, strdup(res->input));
if (strcmp(res->input, "bar") == 0) {
config->current_bar = NULL;
@ -631,7 +631,7 @@ bool read_config(FILE *file, struct sway_config *config) {
case CMD_BLOCK_END:
if (!block) {
wlr_log(L_DEBUG, "Unmatched '}' on line %i", line_number);
wlr_log(WLR_DEBUG, "Unmatched '}' on line %i", line_number);
success = false;
break;
}
@ -639,7 +639,7 @@ bool read_config(FILE *file, struct sway_config *config) {
config->current_bar = NULL;
}
wlr_log(L_DEBUG, "Exiting block '%s'", block);
wlr_log(WLR_DEBUG, "Exiting block '%s'", block);
list_del(stack, 0);
free(block);
memset(&config->handler_context, 0,
@ -682,7 +682,7 @@ char *do_var_replacement(char *str) {
int vvlen = strlen(var->value);
char *newstr = malloc(strlen(str) - vnlen + vvlen + 1);
if (!newstr) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"Unable to allocate replacement "
"during variable expansion");
break;

View file

@ -16,10 +16,10 @@
#include "log.h"
static void terminate_swaybar(pid_t pid) {
wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
wlr_log(WLR_DEBUG, "Terminating swaybar %d", pid);
int ret = kill(-pid, SIGTERM);
if (ret != 0) {
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
wlr_log_errno(WLR_ERROR, "Unable to terminate swaybar %d", pid);
} else {
int status;
waitpid(pid, &status, 0);
@ -167,7 +167,7 @@ void invoke_swaybar(struct bar_config *bar) {
// Pipe to communicate errors
int filedes[2];
if (pipe(filedes) == -1) {
wlr_log(L_ERROR, "Pipe setup failed! Cannot fork into bar");
wlr_log(WLR_ERROR, "Pipe setup failed! Cannot fork into bar");
return;
}
@ -197,17 +197,17 @@ void invoke_swaybar(struct bar_config *bar) {
execvp(cmd[0], cmd);
exit(1);
}
wlr_log(L_DEBUG, "Spawned swaybar %d", bar->pid);
wlr_log(WLR_DEBUG, "Spawned swaybar %d", bar->pid);
close(filedes[0]);
size_t len;
if (read(filedes[1], &len, sizeof(size_t)) == sizeof(size_t)) {
char *buf = malloc(len);
if(!buf) {
wlr_log(L_ERROR, "Cannot allocate error string");
wlr_log(WLR_ERROR, "Cannot allocate error string");
return;
}
if (read(filedes[1], buf, len)) {
wlr_log(L_ERROR, "%s", buf);
wlr_log(WLR_ERROR, "%s", buf);
}
free(buf);
}
@ -244,7 +244,7 @@ void load_swaybars() {
if (bar->pid != 0) {
terminate_swaybar(bar->pid);
}
wlr_log(L_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
wlr_log(WLR_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
invoke_swaybar(bar);
}
}

View file

@ -8,13 +8,13 @@
struct input_config *new_input_config(const char* identifier) {
struct input_config *input = calloc(1, sizeof(struct input_config));
if (!input) {
wlr_log(L_DEBUG, "Unable to allocate input config");
wlr_log(WLR_DEBUG, "Unable to allocate input config");
return NULL;
}
wlr_log(L_DEBUG, "new_input_config(%s)", identifier);
wlr_log(WLR_DEBUG, "new_input_config(%s)", identifier);
if (!(input->identifier = strdup(identifier))) {
free(input);
wlr_log(L_DEBUG, "Unable to allocate input config");
wlr_log(WLR_DEBUG, "Unable to allocate input config");
return NULL;
}
@ -112,7 +112,7 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
struct input_config *copy_input_config(struct input_config *ic) {
struct input_config *copy = calloc(1, sizeof(struct input_config));
if (copy == NULL) {
wlr_log(L_ERROR, "could not allocate input config");
wlr_log(WLR_ERROR, "could not allocate input config");
return NULL;
}
merge_input_config(copy, ic);

View file

@ -90,7 +90,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
float refresh_rate) {
int mhz = (int)(refresh_rate * 1000);
if (wl_list_empty(&output->modes)) {
wlr_log(L_DEBUG, "Assigning custom mode to %s", output->name);
wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name);
wlr_output_set_custom_mode(output, width, height, mhz);
return;
}
@ -106,9 +106,9 @@ static void set_mode(struct wlr_output *output, int width, int height,
}
}
if (!best) {
wlr_log(L_ERROR, "Configured mode for %s not available", output->name);
wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name);
} else {
wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name);
wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name);
wlr_output_set_mode(output, best);
}
}
@ -116,7 +116,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
void terminate_swaybg(pid_t pid) {
int ret = kill(pid, SIGTERM);
if (ret != 0) {
wlr_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
} else {
int status;
waitpid(pid, &status, 0);
@ -144,22 +144,22 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
}
if (oc && oc->width > 0 && oc->height > 0) {
wlr_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
oc->height, oc->refresh_rate);
set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
}
if (oc && oc->scale > 0) {
wlr_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
wlr_output_set_scale(wlr_output, oc->scale);
}
if (oc && oc->transform >= 0) {
wlr_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
wlr_output_set_transform(wlr_output, oc->transform);
}
// Find position for it
if (oc && (oc->x != -1 || oc->y != -1)) {
wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y);
} else {
wlr_output_layout_add_auto(output_layout, wlr_output);
@ -187,7 +187,7 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
terminate_swaybg(output->sway_output->bg_pid);
}
wlr_log(L_DEBUG, "Setting background for output %d to %s",
wlr_log(WLR_DEBUG, "Setting background for output %d to %s",
output_i, oc->background);
size_t len = snprintf(NULL, 0, "%s %d %s %s",
@ -195,13 +195,13 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
output_i, oc->background, oc->background_option);
char *command = malloc(len + 1);
if (!command) {
wlr_log(L_DEBUG, "Unable to allocate swaybg command");
wlr_log(WLR_DEBUG, "Unable to allocate swaybg command");
return;
}
snprintf(command, len + 1, "%s %d %s %s",
config->swaybg_command ? config->swaybg_command : "swaybg",
output_i, oc->background, oc->background_option);
wlr_log(L_DEBUG, "-> %s", command);
wlr_log(WLR_DEBUG, "-> %s", command);
char *const cmd[] = { "sh", "-c", command, NULL };
output->sway_output->bg_pid = fork();
@ -212,11 +212,11 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
if (oc && oc->dpms_state != DPMS_IGNORE) {
switch (oc->dpms_state) {
case DPMS_ON:
wlr_log(L_DEBUG, "Turning on screen");
wlr_log(WLR_DEBUG, "Turning on screen");
wlr_output_enable(wlr_output, true);
break;
case DPMS_OFF:
wlr_log(L_DEBUG, "Turning off screen");
wlr_log(WLR_DEBUG, "Turning off screen");
wlr_output_enable(wlr_output, false);
break;
case DPMS_IGNORE:

View file

@ -7,11 +7,11 @@
struct seat_config *new_seat_config(const char* name) {
struct seat_config *seat = calloc(1, sizeof(struct seat_config));
if (!seat) {
wlr_log(L_DEBUG, "Unable to allocate seat config");
wlr_log(WLR_DEBUG, "Unable to allocate seat config");
return NULL;
}
wlr_log(L_DEBUG, "new_seat_config(%s)", name);
wlr_log(WLR_DEBUG, "new_seat_config(%s)", name);
seat->name = strdup(name);
if (!sway_assert(seat->name, "could not allocate name for seat")) {
free(seat);
@ -34,7 +34,7 @@ struct seat_attachment_config *seat_attachment_config_new() {
struct seat_attachment_config *attachment =
calloc(1, sizeof(struct seat_attachment_config));
if (!attachment) {
wlr_log(L_DEBUG, "cannot allocate attachment config");
wlr_log(WLR_DEBUG, "cannot allocate attachment config");
return NULL;
}
return attachment;

View file

@ -507,7 +507,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) {
}
unescape(value);
}
wlr_log(L_DEBUG, "Found pair: %s=%s", name, value);
wlr_log(WLR_DEBUG, "Found pair: %s=%s", name, value);
if (!parse_token(criteria, name, value)) {
*error_arg = error;
goto cleanup;

View file

@ -9,7 +9,7 @@
static void handle_destroy(struct wl_listener *listener, void *data) {
struct sway_idle_inhibitor_v1 *inhibitor =
wl_container_of(listener, inhibitor, destroy);
wlr_log(L_DEBUG, "Sway idle inhibitor destroyed");
wlr_log(WLR_DEBUG, "Sway idle inhibitor destroyed");
wl_list_remove(&inhibitor->link);
wl_list_remove(&inhibitor->destroy.link);
idle_inhibit_v1_check_active(inhibitor->manager);
@ -20,7 +20,7 @@ void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data) {
struct wlr_idle_inhibitor_v1 *wlr_inhibitor = data;
struct sway_idle_inhibit_manager_v1 *manager =
wl_container_of(listener, manager, new_idle_inhibitor_v1);
wlr_log(L_DEBUG, "New sway idle inhibitor");
wlr_log(WLR_DEBUG, "New sway idle inhibitor");
struct sway_idle_inhibitor_v1 *inhibitor =
calloc(1, sizeof(struct sway_idle_inhibitor_v1));

View file

@ -174,7 +174,7 @@ void arrange_layers(struct sway_output *output) {
if (memcmp(&usable_area, &output->usable_area,
sizeof(struct wlr_box)) != 0) {
wlr_log(L_DEBUG, "Usable area changed, rearranging output");
wlr_log(WLR_DEBUG, "Usable area changed, rearranging output");
memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box));
arrange_and_commit(output->swayc);
}
@ -269,7 +269,7 @@ static void unmap(struct sway_layer_surface *sway_layer) {
static void handle_destroy(struct wl_listener *listener, void *data) {
struct sway_layer_surface *sway_layer =
wl_container_of(listener, sway_layer, destroy);
wlr_log(L_DEBUG, "Layer surface destroyed (%s)",
wlr_log(WLR_DEBUG, "Layer surface destroyed (%s)",
sway_layer->layer_surface->namespace);
if (sway_layer->layer_surface->mapped) {
unmap(sway_layer);
@ -316,7 +316,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
struct wlr_layer_surface *layer_surface = data;
struct sway_server *server =
wl_container_of(listener, server, layer_shell_surface);
wlr_log(L_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
"size %dx%d margin %d,%d,%d,%d",
layer_surface->namespace, layer_surface->layer, layer_surface->layer,
layer_surface->client_pending.desired_width,

View file

@ -525,7 +525,7 @@ struct sway_output *output_from_wlr_output(struct wlr_output *wlr_output) {
void handle_new_output(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, new_output);
struct wlr_output *wlr_output = data;
wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
wlr_log(WLR_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
struct sway_output *output = calloc(1, sizeof(struct sway_output));
if (!output) {

View file

@ -175,7 +175,7 @@ void transaction_add_container(struct sway_transaction *transaction,
* Apply a transaction to the "current" state of the tree.
*/
static void transaction_apply(struct sway_transaction *transaction) {
wlr_log(L_DEBUG, "Applying transaction %p", transaction);
wlr_log(WLR_DEBUG, "Applying transaction %p", transaction);
if (server.debug_txn_timings) {
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
@ -186,7 +186,7 @@ static void transaction_apply(struct sway_transaction *transaction) {
float ms_waiting = (now.tv_sec - commit->tv_sec) * 1000 +
(now.tv_nsec - commit->tv_nsec) / 1000000.0;
float ms_total = ms_arranging + ms_waiting;
wlr_log(L_DEBUG, "Transaction %p: %.1fms arranging, %.1fms waiting, "
wlr_log(WLR_DEBUG, "Transaction %p: %.1fms arranging, %.1fms waiting, "
"%.1fms total (%.1f frames if 60Hz)", transaction,
ms_arranging, ms_waiting, ms_total, ms_total / (1000.0f / 60));
}
@ -251,7 +251,7 @@ static void transaction_progress_queue() {
static int handle_timeout(void *data) {
struct sway_transaction *transaction = data;
wlr_log(L_DEBUG, "Transaction %p timed out (%li waiting)",
wlr_log(WLR_DEBUG, "Transaction %p timed out (%li waiting)",
transaction, transaction->num_waiting);
transaction->num_waiting = 0;
transaction_progress_queue();
@ -286,7 +286,7 @@ static bool should_configure(struct sway_container *con,
}
void transaction_commit(struct sway_transaction *transaction) {
wlr_log(L_DEBUG, "Transaction %p committing with %i instructions",
wlr_log(WLR_DEBUG, "Transaction %p committing with %i instructions",
transaction, transaction->instructions->length);
transaction->num_waiting = 0;
for (int i = 0; i < transaction->instructions->length; ++i) {
@ -319,7 +319,7 @@ void transaction_commit(struct sway_transaction *transaction) {
} else {
// There are no other transactions in progress, and this one has nothing
// to wait for, so we can skip the queue.
wlr_log(L_DEBUG, "Transaction %p has nothing to wait for", transaction);
wlr_log(WLR_DEBUG, "Transaction %p has nothing to wait for", transaction);
transaction_apply(transaction);
transaction_destroy(transaction);
idle_inhibit_v1_check_active(server.idle_inhibit_manager_v1);
@ -350,7 +350,7 @@ static void set_instruction_ready(
struct timespec *start = &transaction->commit_time;
float ms = (now.tv_sec - start->tv_sec) * 1000 +
(now.tv_nsec - start->tv_nsec) / 1000000.0;
wlr_log(L_DEBUG, "Transaction %p: %li/%li ready in %.1fms (%s)",
wlr_log(WLR_DEBUG, "Transaction %p: %li/%li ready in %.1fms (%s)",
transaction,
transaction->num_configures - transaction->num_waiting + 1,
transaction->num_configures, ms,
@ -362,7 +362,7 @@ static void set_instruction_ready(
// If the transaction has timed out then its num_waiting will be 0 already.
if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
#if !TRANSACTION_DEBUG
wlr_log(L_DEBUG, "Transaction %p is ready", transaction);
wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
wl_event_source_timer_update(transaction->timer, 0);
transaction_progress_queue();
#endif

View file

@ -304,11 +304,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
struct wlr_xdg_surface *xdg_surface = data;
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
wlr_log(L_DEBUG, "New xdg_shell popup");
wlr_log(WLR_DEBUG, "New xdg_shell popup");
return;
}
wlr_log(L_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
wlr_xdg_surface_ping(xdg_surface);

View file

@ -295,11 +295,11 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
struct wlr_xdg_surface_v6 *xdg_surface = data;
if (xdg_surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP) {
wlr_log(L_DEBUG, "New xdg_shell_v6 popup");
wlr_log(WLR_DEBUG, "New xdg_shell_v6 popup");
return;
}
wlr_log(L_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",
wlr_log(WLR_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",
xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
wlr_xdg_surface_v6_ping(xdg_surface);

View file

@ -119,7 +119,7 @@ static struct sway_xwayland_unmanaged *create_unmanaged(
struct sway_xwayland_unmanaged *surface =
calloc(1, sizeof(struct sway_xwayland_unmanaged));
if (surface == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return NULL;
}
@ -432,12 +432,12 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
if (wlr_xwayland_surface_is_unmanaged(xsurface) ||
xsurface->override_redirect) {
wlr_log(L_DEBUG, "New xwayland unmanaged surface");
wlr_log(WLR_DEBUG, "New xwayland unmanaged surface");
create_unmanaged(xsurface);
return;
}
wlr_log(L_DEBUG, "New xwayland surface title='%s' class='%s'",
wlr_log(WLR_DEBUG, "New xwayland surface title='%s' class='%s'",
xsurface->title, xsurface->class);
struct sway_xwayland_view *xwayland_view =
@ -490,7 +490,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
xcb_connection_t *xcb_conn = xcb_connect(NULL, NULL);
int err = xcb_connection_has_error(xcb_conn);
if (err) {
wlr_log(L_ERROR, "XCB connect failed: %d", err);
wlr_log(WLR_ERROR, "XCB connect failed: %d", err);
return;
}
@ -509,7 +509,7 @@ void handle_xwayland_ready(struct wl_listener *listener, void *data) {
free(reply);
if (error != NULL) {
wlr_log(L_ERROR, "could not resolve atom %s, X11 error code %d",
wlr_log(WLR_ERROR, "could not resolve atom %s, X11 error code %d",
atom_map[i], error->error_code);
free(error);
break;

View file

@ -474,7 +474,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
// TODO: check cursor mode
if (focused_client == NULL ||
event->seat_client->client != focused_client) {
wlr_log(L_DEBUG, "denying request to set cursor from unfocused client");
wlr_log(WLR_DEBUG, "denying request to set cursor from unfocused client");
return;
}

View file

@ -61,7 +61,7 @@ static char *get_device_identifier(struct wlr_input_device *device) {
int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
char *identifier = malloc(len);
if (!identifier) {
wlr_log(L_ERROR, "Unable to allocate unique input device name");
wlr_log(WLR_ERROR, "Unable to allocate unique input device name");
return NULL;
}
@ -104,74 +104,74 @@ static void input_manager_libinput_config_pointer(
}
libinput_device = wlr_libinput_get_device_handle(wlr_device);
wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)",
wlr_log(WLR_DEBUG, "input_manager_libinput_config_pointer(%s)",
ic->identifier);
if (ic->accel_profile != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
ic->identifier, ic->accel_profile);
libinput_device_config_accel_set_profile(libinput_device,
ic->accel_profile);
}
if (ic->click_method != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
ic->identifier, ic->click_method);
libinput_device_config_click_set_method(libinput_device,
ic->click_method);
}
if (ic->drag_lock != INT_MIN) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
ic->identifier, ic->click_method);
libinput_device_config_tap_set_drag_lock_enabled(libinput_device,
ic->drag_lock);
}
if (ic->dwt != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
ic->identifier, ic->dwt);
libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
}
if (ic->left_handed != INT_MIN) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"libinput_config_pointer(%s) left_handed_set_enabled(%d)",
ic->identifier, ic->left_handed);
libinput_device_config_left_handed_set(libinput_device,
ic->left_handed);
}
if (ic->middle_emulation != INT_MIN) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
ic->identifier, ic->middle_emulation);
libinput_device_config_middle_emulation_set_enabled(libinput_device,
ic->middle_emulation);
}
if (ic->natural_scroll != INT_MIN) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
ic->identifier, ic->natural_scroll);
libinput_device_config_scroll_set_natural_scroll_enabled(
libinput_device, ic->natural_scroll);
}
if (ic->pointer_accel != FLT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
ic->identifier, ic->pointer_accel);
libinput_device_config_accel_set_speed(libinput_device,
ic->pointer_accel);
}
if (ic->scroll_method != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
ic->identifier, ic->scroll_method);
libinput_device_config_scroll_set_method(libinput_device,
ic->scroll_method);
}
if (ic->send_events != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
ic->identifier, ic->send_events);
libinput_device_config_send_events_set_mode(libinput_device,
ic->send_events);
}
if (ic->tap != INT_MIN) {
wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
ic->identifier, ic->tap);
libinput_device_config_tap_set_enabled(libinput_device, ic->tap);
}
@ -187,7 +187,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
return;
}
wlr_log(L_DEBUG, "removing device: '%s'",
wlr_log(WLR_DEBUG, "removing device: '%s'",
input_device->identifier);
struct sway_seat *seat = NULL;
@ -217,7 +217,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
input_device->identifier = get_device_identifier(device);
wl_list_insert(&input->devices, &input_device->link);
wlr_log(L_DEBUG, "adding device: '%s'",
wlr_log(WLR_DEBUG, "adding device: '%s'",
input_device->identifier);
if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
@ -229,7 +229,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
struct sway_seat *seat = NULL;
if (!input_has_seat_configuration(input)) {
wlr_log(L_DEBUG, "no seat configuration, using default seat");
wlr_log(WLR_DEBUG, "no seat configuration, using default seat");
seat = input_manager_get_seat(input, default_seat);
seat_add_device(seat, input_device);
return;
@ -259,7 +259,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
}
if (!added) {
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"device '%s' is not configured on any seats",
input_device->identifier);
}
@ -282,7 +282,7 @@ static void handle_inhibit_deactivate(struct wl_listener *listener, void *data)
seat_set_exclusive_client(seat, NULL);
struct sway_container *previous = seat_get_focus(seat);
if (previous) {
wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous,
wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous,
container_type_to_str(previous->type), previous->name);
// Hack to get seat to re-focus the return value of get_focus
seat_set_focus(seat, previous->parent);
@ -359,7 +359,7 @@ void input_manager_apply_input_config(struct sway_input_manager *input,
void input_manager_apply_seat_config(struct sway_input_manager *input,
struct seat_config *seat_config) {
wlr_log(L_DEBUG, "applying new seat config for seat %s",
wlr_log(WLR_DEBUG, "applying new seat config for seat %s",
seat_config->name);
struct sway_seat *seat = input_manager_get_seat(input, seat_config->name);
if (!seat) {

View file

@ -108,7 +108,7 @@ static void get_active_binding(const struct sway_shortcut_state *state,
}
if (*current_binding && *current_binding != binding) {
wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d",
wlr_log(WLR_DEBUG, "encountered duplicate bindings %d and %d",
(*current_binding)->order, binding->order);
} else {
*current_binding = binding;
@ -122,12 +122,12 @@ static void get_active_binding(const struct sway_shortcut_state *state,
*/
static void keyboard_execute_command(struct sway_keyboard *keyboard,
struct sway_binding *binding) {
wlr_log(L_DEBUG, "running command for binding: %s",
wlr_log(WLR_DEBUG, "running command for binding: %s",
binding->command);
config->handler_context.seat = keyboard->seat_device->sway_seat;
struct cmd_results *results = execute_command(binding->command, NULL);
if (results->status != CMD_SUCCESS) {
wlr_log(L_DEBUG, "could not run command for binding: %s (%s)",
wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
binding->command, results->error);
}
free_cmd_results(results);
@ -386,7 +386,7 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!keymap) {
wlr_log(L_DEBUG, "cannot configure keyboard: keymap does not exist");
wlr_log(WLR_DEBUG, "cannot configure keyboard: keymap does not exist");
xkb_context_unref(context);
return;
}

View file

@ -75,7 +75,7 @@ static void seat_send_activate(struct sway_container *con,
struct sway_seat *seat) {
if (con->type == C_VIEW) {
if (!seat_is_input_allowed(seat, con->sway_view->surface)) {
wlr_log(L_DEBUG, "Refusing to set focus, input is inhibited");
wlr_log(WLR_DEBUG, "Refusing to set focus, input is inhibited");
return;
}
view_set_activated(con->sway_view, true);
@ -219,7 +219,7 @@ static struct sway_seat_container *seat_container_from_container(
seat_con = calloc(1, sizeof(struct sway_seat_container));
if (seat_con == NULL) {
wlr_log(L_ERROR, "could not allocate seat container");
wlr_log(WLR_ERROR, "could not allocate seat container");
return NULL;
}
@ -301,7 +301,7 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) {
struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon));
if (icon == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return;
}
icon->seat = seat;
@ -391,7 +391,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
struct input_config *ic = input_device_get_config(
sway_device->input_device);
if (ic != NULL) {
wlr_log(L_DEBUG, "Applying input config to %s",
wlr_log(WLR_DEBUG, "Applying input config to %s",
sway_device->input_device->identifier);
mapped_to_output = ic->mapped_to_output;
@ -401,7 +401,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
mapped_to_output = sway_device->input_device->wlr_device->output_name;
}
if (mapped_to_output != NULL) {
wlr_log(L_DEBUG, "Mapping input device %s to output %s",
wlr_log(WLR_DEBUG, "Mapping input device %s to output %s",
sway_device->input_device->identifier, mapped_to_output);
struct sway_container *output = NULL;
for (int i = 0; i < root_container.children->length; ++i) {
@ -415,7 +415,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
wlr_cursor_map_input_to_output(seat->cursor->cursor,
sway_device->input_device->wlr_device,
output->sway_output->wlr_output);
wlr_log(L_DEBUG, "Mapped to output %s", output->name);
wlr_log(WLR_DEBUG, "Mapped to output %s", output->name);
}
}
}
@ -495,7 +495,7 @@ void seat_configure_device(struct sway_seat *seat,
seat_configure_tablet_tool(seat, seat_device);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
wlr_log(L_DEBUG, "TODO: configure tablet pad");
wlr_log(WLR_DEBUG, "TODO: configure tablet pad");
break;
}
}
@ -510,11 +510,11 @@ void seat_add_device(struct sway_seat *seat,
struct sway_seat_device *seat_device =
calloc(1, sizeof(struct sway_seat_device));
if (!seat_device) {
wlr_log(L_DEBUG, "could not allocate seat device");
wlr_log(WLR_DEBUG, "could not allocate seat device");
return;
}
wlr_log(L_DEBUG, "adding device %s to seat %s",
wlr_log(WLR_DEBUG, "adding device %s to seat %s",
input_device->identifier, seat->wlr_seat->name);
seat_device->sway_seat = seat;
@ -533,7 +533,7 @@ void seat_remove_device(struct sway_seat *seat,
return;
}
wlr_log(L_DEBUG, "removing device %s from seat %s",
wlr_log(WLR_DEBUG, "removing device %s from seat %s",
input_device->identifier, seat->wlr_seat->name);
seat_device_destroy(seat_device);
@ -752,7 +752,7 @@ void seat_set_focus_layer(struct sway_seat *seat,
struct sway_container *previous =
seat_get_focus_inactive(seat, &root_container);
if (previous) {
wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous,
wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous,
container_type_to_str(previous->type), previous->name);
// Hack to get seat to re-focus the return value of get_focus
seat_set_focus(seat, previous->parent);

View file

@ -138,32 +138,32 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
int ipc_handle_connection(int fd, uint32_t mask, void *data) {
(void) fd;
struct sway_server *server = data;
wlr_log(L_DEBUG, "Event on IPC listening socket");
wlr_log(WLR_DEBUG, "Event on IPC listening socket");
assert(mask == WL_EVENT_READABLE);
int client_fd = accept(ipc_socket, NULL, NULL);
if (client_fd == -1) {
wlr_log_errno(L_ERROR, "Unable to accept IPC client connection");
wlr_log_errno(WLR_ERROR, "Unable to accept IPC client connection");
return 0;
}
int flags;
if ((flags = fcntl(client_fd, F_GETFD)) == -1
|| fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
wlr_log_errno(L_ERROR, "Unable to set CLOEXEC on IPC client socket");
wlr_log_errno(WLR_ERROR, "Unable to set CLOEXEC on IPC client socket");
close(client_fd);
return 0;
}
if ((flags = fcntl(client_fd, F_GETFL)) == -1
|| fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) {
wlr_log_errno(L_ERROR, "Unable to set NONBLOCK on IPC client socket");
wlr_log_errno(WLR_ERROR, "Unable to set NONBLOCK on IPC client socket");
close(client_fd);
return 0;
}
struct ipc_client *client = malloc(sizeof(struct ipc_client));
if (!client) {
wlr_log(L_ERROR, "Unable to allocate ipc client");
wlr_log(WLR_ERROR, "Unable to allocate ipc client");
close(client_fd);
return 0;
}
@ -179,12 +179,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
client->write_buffer_len = 0;
client->write_buffer = malloc(client->write_buffer_size);
if (!client->write_buffer) {
wlr_log(L_ERROR, "Unable to allocate ipc client write buffer");
wlr_log(WLR_ERROR, "Unable to allocate ipc client write buffer");
close(client_fd);
return 0;
}
wlr_log(L_DEBUG, "New client: fd %d", client_fd);
wlr_log(WLR_DEBUG, "New client: fd %d", client_fd);
list_add(ipc_client_list, client);
return 0;
}
@ -195,22 +195,22 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
struct ipc_client *client = data;
if (mask & WL_EVENT_ERROR) {
wlr_log(L_ERROR, "IPC Client socket error, removing client");
wlr_log(WLR_ERROR, "IPC Client socket error, removing client");
ipc_client_disconnect(client);
return 0;
}
if (mask & WL_EVENT_HANGUP) {
wlr_log(L_DEBUG, "Client %d hung up", client->fd);
wlr_log(WLR_DEBUG, "Client %d hung up", client->fd);
ipc_client_disconnect(client);
return 0;
}
wlr_log(L_DEBUG, "Client %d readable", client->fd);
wlr_log(WLR_DEBUG, "Client %d readable", client->fd);
int read_available;
if (ioctl(client_fd, FIONREAD, &read_available) == -1) {
wlr_log_errno(L_INFO, "Unable to read IPC socket buffer size");
wlr_log_errno(WLR_INFO, "Unable to read IPC socket buffer size");
ipc_client_disconnect(client);
return 0;
}
@ -232,13 +232,13 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
// Should be fully available, because read_available >= ipc_header_size
ssize_t received = recv(client_fd, buf, ipc_header_size, 0);
if (received == -1) {
wlr_log_errno(L_INFO, "Unable to receive header from IPC client");
wlr_log_errno(WLR_INFO, "Unable to receive header from IPC client");
ipc_client_disconnect(client);
return 0;
}
if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) {
wlr_log(L_DEBUG, "IPC header check failed");
wlr_log(WLR_DEBUG, "IPC header check failed");
ipc_client_disconnect(client);
return 0;
}
@ -272,7 +272,7 @@ static void ipc_send_event(const char *json_string, enum ipc_command_type event)
}
client->current_command = event;
if (!ipc_send_reply(client, json_string, (uint32_t) strlen(json_string))) {
wlr_log_errno(L_INFO, "Unable to send reply to IPC client");
wlr_log_errno(WLR_INFO, "Unable to send reply to IPC client");
/* ipc_send_reply destroys client on error, which also
* removes it from the list, so we need to process
* current index again */
@ -286,7 +286,7 @@ void ipc_event_workspace(struct sway_container *old,
if (!ipc_has_event_listeners(IPC_EVENT_WORKSPACE)) {
return;
}
wlr_log(L_DEBUG, "Sending workspace::%s event", change);
wlr_log(WLR_DEBUG, "Sending workspace::%s event", change);
json_object *obj = json_object_new_object();
json_object_object_add(obj, "change", json_object_new_string(change));
if (strcmp("focus", change) == 0) {
@ -314,7 +314,7 @@ void ipc_event_window(struct sway_container *window, const char *change) {
if (!ipc_has_event_listeners(IPC_EVENT_WINDOW)) {
return;
}
wlr_log(L_DEBUG, "Sending window::%s event", change);
wlr_log(WLR_DEBUG, "Sending window::%s event", change);
json_object *obj = json_object_new_object();
json_object_object_add(obj, "change", json_object_new_string(change));
json_object_object_add(obj, "container", ipc_json_describe_container_recursive(window));
@ -328,7 +328,7 @@ void ipc_event_barconfig_update(struct bar_config *bar) {
if (!ipc_has_event_listeners(IPC_EVENT_BARCONFIG_UPDATE)) {
return;
}
wlr_log(L_DEBUG, "Sending barconfig_update event");
wlr_log(WLR_DEBUG, "Sending barconfig_update event");
json_object *json = ipc_json_describe_bar_config(bar);
const char *json_string = json_object_to_json_string(json);
@ -340,7 +340,7 @@ void ipc_event_mode(const char *mode, bool pango) {
if (!ipc_has_event_listeners(IPC_EVENT_MODE)) {
return;
}
wlr_log(L_DEBUG, "Sending mode::%s event", mode);
wlr_log(WLR_DEBUG, "Sending mode::%s event", mode);
json_object *obj = json_object_new_object();
json_object_object_add(obj, "change", json_object_new_string(mode));
json_object_object_add(obj, "pango_markup",
@ -355,13 +355,13 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
struct ipc_client *client = data;
if (mask & WL_EVENT_ERROR) {
wlr_log(L_ERROR, "IPC Client socket error, removing client");
wlr_log(WLR_ERROR, "IPC Client socket error, removing client");
ipc_client_disconnect(client);
return 0;
}
if (mask & WL_EVENT_HANGUP) {
wlr_log(L_DEBUG, "Client %d hung up", client->fd);
wlr_log(WLR_DEBUG, "Client %d hung up", client->fd);
ipc_client_disconnect(client);
return 0;
}
@ -370,14 +370,14 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
return 0;
}
wlr_log(L_DEBUG, "Client %d writable", client->fd);
wlr_log(WLR_DEBUG, "Client %d writable", client->fd);
ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len);
if (written == -1 && errno == EAGAIN) {
return 0;
} else if (written == -1) {
wlr_log_errno(L_INFO, "Unable to send data from queue to IPC client");
wlr_log_errno(WLR_INFO, "Unable to send data from queue to IPC client");
ipc_client_disconnect(client);
return 0;
}
@ -400,7 +400,7 @@ void ipc_client_disconnect(struct ipc_client *client) {
shutdown(client->fd, SHUT_RDWR);
wlr_log(L_INFO, "IPC Client %d disconnected", client->fd);
wlr_log(WLR_INFO, "IPC Client %d disconnected", client->fd);
wl_event_source_remove(client->event_source);
if (client->writable_event_source) {
wl_event_source_remove(client->writable_event_source);
@ -461,7 +461,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
char *buf = malloc(client->payload_length + 1);
if (!buf) {
wlr_log_errno(L_INFO, "Unable to allocate IPC payload");
wlr_log_errno(WLR_INFO, "Unable to allocate IPC payload");
ipc_client_disconnect(client);
return;
}
@ -470,7 +470,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
ssize_t received = recv(client->fd, buf, client->payload_length, 0);
if (received == -1)
{
wlr_log_errno(L_INFO, "Unable to receive payload from IPC client");
wlr_log_errno(WLR_INFO, "Unable to receive payload from IPC client");
ipc_client_disconnect(client);
free(buf);
return;
@ -533,7 +533,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
struct json_object *request = json_tokener_parse(buf);
if (request == NULL) {
client_valid = ipc_send_reply(client, "{\"success\": false}", 18);
wlr_log_errno(L_INFO, "Failed to read request");
wlr_log_errno(WLR_INFO, "Failed to read request");
goto exit_cleanup;
}
@ -556,7 +556,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
client_valid =
ipc_send_reply(client, "{\"success\": false}", 18);
json_object_put(request);
wlr_log_errno(L_INFO, "Failed to parse request");
wlr_log_errno(WLR_INFO, "Failed to parse request");
goto exit_cleanup;
}
}
@ -668,7 +668,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
}
default:
wlr_log(L_INFO, "Unknown IPC command type %i", client->current_command);
wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command);
goto exit_cleanup;
}
@ -696,14 +696,14 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
}
if (client->write_buffer_size > 4e6) { // 4 MB
wlr_log(L_ERROR, "Client write buffer too big, disconnecting client");
wlr_log(WLR_ERROR, "Client write buffer too big, disconnecting client");
ipc_client_disconnect(client);
return false;
}
char *new_buffer = realloc(client->write_buffer, client->write_buffer_size);
if (!new_buffer) {
wlr_log(L_ERROR, "Unable to reallocate ipc client write buffer");
wlr_log(WLR_ERROR, "Unable to reallocate ipc client write buffer");
ipc_client_disconnect(client);
return false;
}
@ -720,6 +720,6 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
ipc_client_handle_writable, client);
}
wlr_log(L_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload);
wlr_log(WLR_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload);
return true;
}

View file

@ -129,7 +129,7 @@ static void log_env() {
"SWAYSOCK"
};
for (size_t i = 0; i < sizeof(log_vars) / sizeof(char *); ++i) {
wlr_log(L_INFO, "%s=%s", log_vars[i], getenv(log_vars[i]));
wlr_log(WLR_INFO, "%s=%s", log_vars[i], getenv(log_vars[i]));
}
}
@ -144,14 +144,14 @@ static void log_distro() {
for (size_t i = 0; i < sizeof(paths) / sizeof(char *); ++i) {
FILE *f = fopen(paths[i], "r");
if (f) {
wlr_log(L_INFO, "Contents of %s:", paths[i]);
wlr_log(WLR_INFO, "Contents of %s:", paths[i]);
while (!feof(f)) {
char *line;
if (!(line = read_line(f))) {
break;
}
if (*line) {
wlr_log(L_INFO, "%s", line);
wlr_log(WLR_INFO, "%s", line);
}
free(line);
}
@ -163,7 +163,7 @@ static void log_distro() {
static void log_kernel() {
FILE *f = popen("uname -a", "r");
if (!f) {
wlr_log(L_INFO, "Unable to determine kernel version");
wlr_log(WLR_INFO, "Unable to determine kernel version");
return;
}
while (!feof(f)) {
@ -172,7 +172,7 @@ static void log_kernel() {
break;
}
if (*line) {
wlr_log(L_INFO, "%s", line);
wlr_log(WLR_INFO, "%s", line);
}
free(line);
}
@ -183,14 +183,14 @@ static void security_sanity_check() {
// TODO: Notify users visually if this has issues
struct stat s;
if (stat("/proc", &s)) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"!! DANGER !! /proc is not available - sway CANNOT enforce security rules!");
}
#ifdef __linux__
cap_flag_value_t v;
cap_t cap = cap_get_proc();
if (!cap || cap_get_flag(cap, CAP_SYS_PTRACE, CAP_PERMITTED, &v) != 0 || v != CAP_SET) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"!! DANGER !! Sway does not have CAP_SYS_PTRACE and cannot enforce security rules for processes running as other users.");
}
if (cap) {
@ -206,13 +206,13 @@ static void executable_sanity_check() {
stat(exe, &sb);
// We assume that cap_get_file returning NULL implies ENODATA
if (sb.st_mode & (S_ISUID|S_ISGID) && cap_get_file(exe)) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"sway executable has both the s(g)uid bit AND file caps set.");
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"This is strongly discouraged (and completely broken).");
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"Please clear one of them (either the suid bit, or the file caps).");
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"If unsure, strip the file caps.");
exit(EXIT_FAILURE);
}
@ -223,16 +223,16 @@ static void executable_sanity_check() {
static void drop_permissions(bool keep_caps) {
if (getuid() != geteuid() || getgid() != getegid()) {
if (setgid(getgid()) != 0) {
wlr_log(L_ERROR, "Unable to drop root");
wlr_log(WLR_ERROR, "Unable to drop root");
exit(EXIT_FAILURE);
}
if (setuid(getuid()) != 0) {
wlr_log(L_ERROR, "Unable to drop root");
wlr_log(WLR_ERROR, "Unable to drop root");
exit(EXIT_FAILURE);
}
}
if (setuid(0) != -1) {
wlr_log(L_ERROR, "Root privileges can be restored.");
wlr_log(WLR_ERROR, "Root privileges can be restored.");
exit(EXIT_FAILURE);
}
#ifdef __linux__
@ -240,11 +240,11 @@ static void drop_permissions(bool keep_caps) {
// Drop every cap except CAP_SYS_PTRACE
cap_t caps = cap_init();
cap_value_t keep = CAP_SYS_PTRACE;
wlr_log(L_INFO, "Dropping extra capabilities");
wlr_log(WLR_INFO, "Dropping extra capabilities");
if (cap_set_flag(caps, CAP_PERMITTED, 1, &keep, CAP_SET) ||
cap_set_flag(caps, CAP_EFFECTIVE, 1, &keep, CAP_SET) ||
cap_set_proc(caps)) {
wlr_log(L_ERROR, "Failed to drop extra capabilities");
wlr_log(WLR_ERROR, "Failed to drop extra capabilities");
exit(EXIT_FAILURE);
}
}
@ -335,22 +335,22 @@ int main(int argc, char **argv) {
// TODO: switch logging over to wlroots?
if (debug) {
wlr_log_init(L_DEBUG, NULL);
wlr_log_init(WLR_DEBUG, NULL);
} else if (verbose || validate) {
wlr_log_init(L_INFO, NULL);
wlr_log_init(WLR_INFO, NULL);
} else {
wlr_log_init(L_ERROR, NULL);
wlr_log_init(WLR_ERROR, NULL);
}
if (optind < argc) { // Behave as IPC client
if(optind != 1) {
wlr_log(L_ERROR, "Don't use options with the IPC client");
wlr_log(WLR_ERROR, "Don't use options with the IPC client");
exit(EXIT_FAILURE);
}
drop_permissions(false);
char *socket_path = getenv("SWAYSOCK");
if (!socket_path) {
wlr_log(L_ERROR, "Unable to retrieve socket path");
wlr_log(WLR_ERROR, "Unable to retrieve socket path");
exit(EXIT_FAILURE);
}
char *command = join_args(argv + optind, argc - optind);
@ -369,7 +369,7 @@ int main(int argc, char **argv) {
if (getuid() != geteuid() || getgid() != getegid()) {
// Retain capabilities after setuid()
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) {
wlr_log(L_ERROR, "Cannot keep caps after setuid()");
wlr_log(WLR_ERROR, "Cannot keep caps after setuid()");
exit(EXIT_FAILURE);
}
suid = true;
@ -390,7 +390,7 @@ int main(int argc, char **argv) {
// prevent ipc from crashing sway
signal(SIGPIPE, SIG_IGN);
wlr_log(L_INFO, "Starting sway version " SWAY_VERSION);
wlr_log(WLR_INFO, "Starting sway version " SWAY_VERSION);
layout_init();
@ -423,7 +423,7 @@ int main(int argc, char **argv) {
char *line = config->cmd_queue->items[0];
struct cmd_results *res = execute_command(line, NULL);
if (res->status != CMD_SUCCESS) {
wlr_log(L_ERROR, "Error on line '%s': %s", line, res->error);
wlr_log(WLR_ERROR, "Error on line '%s': %s", line, res->error);
}
free_cmd_results(res);
free(line);
@ -434,7 +434,7 @@ int main(int argc, char **argv) {
server_run(&server);
}
wlr_log(L_INFO, "Shutting down sway");
wlr_log(WLR_INFO, "Shutting down sway");
server_fini(&server);

View file

@ -29,20 +29,20 @@
#include "sway/xwayland.h"
bool server_privileged_prepare(struct sway_server *server) {
wlr_log(L_DEBUG, "Preparing Wayland server initialization");
wlr_log(WLR_DEBUG, "Preparing Wayland server initialization");
server->wl_display = wl_display_create();
server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
if (!server->backend) {
wlr_log(L_ERROR, "Unable to create backend");
wlr_log(WLR_ERROR, "Unable to create backend");
return false;
}
return true;
}
bool server_init(struct sway_server *server) {
wlr_log(L_DEBUG, "Initializing Wayland server");
wlr_log(WLR_DEBUG, "Initializing Wayland server");
struct wlr_renderer *renderer = wlr_backend_get_renderer(server->backend);
assert(renderer);
@ -116,7 +116,7 @@ bool server_init(struct sway_server *server) {
server->socket = wl_display_add_socket_auto(server->wl_display);
if (!server->socket) {
wlr_log(L_ERROR, "Unable to open wayland socket");
wlr_log(WLR_ERROR, "Unable to open wayland socket");
wlr_backend_destroy(server->backend);
return false;
}
@ -141,10 +141,10 @@ void server_fini(struct sway_server *server) {
}
void server_run(struct sway_server *server) {
wlr_log(L_INFO, "Running compositor on wayland display '%s'",
wlr_log(WLR_INFO, "Running compositor on wayland display '%s'",
server->socket);
if (!wlr_backend_start(server->backend)) {
wlr_log(L_ERROR, "Failed to start backend");
wlr_log(WLR_ERROR, "Failed to start backend");
wlr_backend_destroy(server->backend);
return;
}

View file

@ -47,11 +47,11 @@ static void apply_horiz_layout(struct sway_container *parent) {
double scale = parent->width / total_width;
// Resize windows
wlr_log(L_DEBUG, "Arranging %p horizontally", parent);
wlr_log(WLR_DEBUG, "Arranging %p horizontally", parent);
double child_x = parent->x;
for (size_t i = 0; i < num_children; ++i) {
struct sway_container *child = parent->children->items[i];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, child->width, scale);
child->x = child_x;
@ -99,11 +99,11 @@ static void apply_vert_layout(struct sway_container *parent) {
double scale = parent_height / total_height;
// Resize
wlr_log(L_DEBUG, "Arranging %p vertically", parent);
wlr_log(WLR_DEBUG, "Arranging %p vertically", parent);
double child_y = parent->y + parent_offset;
for (size_t i = 0; i < num_children; ++i) {
struct sway_container *child = parent->children->items[i];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, child->height, scale);
child->x = parent->x;
@ -179,7 +179,7 @@ static void arrange_children_of(struct sway_container *parent,
if (config->reloading) {
return;
}
wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", parent,
wlr_log(WLR_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", parent,
parent->name, parent->width, parent->height, parent->x, parent->y);
// Calculate x, y, width and height of children
@ -226,7 +226,7 @@ static void arrange_workspace(struct sway_container *workspace,
}
struct sway_container *output = workspace->parent;
struct wlr_box *area = &output->sway_output->usable_area;
wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d",
wlr_log(WLR_DEBUG, "Usable area for ws: %dx%d@%d,%d",
area->width, area->height, area->x, area->y);
remove_gaps(workspace);
workspace->width = area->width;
@ -235,7 +235,7 @@ static void arrange_workspace(struct sway_container *workspace,
workspace->y = output->y + area->y;
add_gaps(workspace);
transaction_add_container(transaction, workspace);
wlr_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name,
wlr_log(WLR_DEBUG, "Arranging workspace '%s' at %f, %f", workspace->name,
workspace->x, workspace->y);
arrange_floating(workspace->sway_workspace->floating, transaction);
arrange_children_of(workspace, transaction);
@ -254,7 +254,7 @@ static void arrange_output(struct sway_container *output,
output->width = output_box->width;
output->height = output_box->height;
transaction_add_container(transaction, output);
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
wlr_log(WLR_DEBUG, "Arranging output '%s' at %f,%f",
output->name, output->x, output->y);
for (int i = 0; i < output->children->length; ++i) {
struct sway_container *workspace = output->children->items[i];
@ -315,7 +315,7 @@ void arrange_and_commit(struct sway_container *container) {
void remove_gaps(struct sway_container *c) {
if (c->current_gaps == 0) {
wlr_log(L_DEBUG, "Removing gaps: not gapped: %p", c);
wlr_log(WLR_DEBUG, "Removing gaps: not gapped: %p", c);
return;
}
@ -326,12 +326,12 @@ void remove_gaps(struct sway_container *c) {
c->current_gaps = 0;
wlr_log(L_DEBUG, "Removing gaps %p", c);
wlr_log(WLR_DEBUG, "Removing gaps %p", c);
}
void add_gaps(struct sway_container *c) {
if (c->current_gaps > 0 || c->type == C_CONTAINER) {
wlr_log(L_DEBUG, "Not adding gaps: %p", c);
wlr_log(WLR_DEBUG, "Not adding gaps: %p", c);
return;
}
@ -348,5 +348,5 @@ void add_gaps(struct sway_container *c) {
c->height -= 2 * gaps;
c->current_gaps = gaps;
wlr_log(L_DEBUG, "Adding gaps: %p", c);
wlr_log(WLR_DEBUG, "Adding gaps: %p", c);
}

View file

@ -31,7 +31,7 @@ static list_t *get_bfs_queue() {
if (!bfs_queue) {
bfs_queue = create_list();
if (!bfs_queue) {
wlr_log(L_ERROR, "could not allocate list for bfs queue");
wlr_log(WLR_ERROR, "could not allocate list for bfs queue");
return NULL;
}
}
@ -213,7 +213,7 @@ static struct sway_container *container_workspace_destroy(
return NULL;
}
wlr_log(L_DEBUG, "destroying workspace '%s'", workspace->name);
wlr_log(WLR_DEBUG, "destroying workspace '%s'", workspace->name);
struct sway_container *parent = workspace->parent;
if (!workspace_is_empty(workspace) && output) {
@ -226,7 +226,7 @@ static struct sway_container *container_workspace_destroy(
}
}
wlr_log(L_DEBUG, "moving children to different workspace '%s' -> '%s'",
wlr_log(WLR_DEBUG, "moving children to different workspace '%s' -> '%s'",
workspace->name, new_workspace->name);
for (int i = 0; i < workspace->children->length; i++) {
container_move_to(workspace->children->items[i], new_workspace);
@ -292,7 +292,7 @@ static struct sway_container *container_output_destroy(
output->sway_output->swayc = NULL;
output->sway_output = NULL;
wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
wlr_log(WLR_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
return &root_container;
}
@ -319,7 +319,7 @@ static struct sway_container *container_destroy_noreaping(
// Workspaces will refuse to be destroyed if they're the last workspace
// on their output.
if (!container_workspace_destroy(con)) {
wlr_log(L_ERROR, "workspace doesn't want to destroy");
wlr_log(WLR_ERROR, "workspace doesn't want to destroy");
return NULL;
}
}
@ -346,7 +346,7 @@ bool container_reap_empty(struct sway_container *con) {
break;
case C_WORKSPACE:
if (!workspace_is_visible(con) && workspace_is_empty(con)) {
wlr_log(L_DEBUG, "Destroying workspace via reaper");
wlr_log(WLR_DEBUG, "Destroying workspace via reaper");
container_destroy_noreaping(con);
return true;
}
@ -439,7 +439,7 @@ struct sway_container *container_view_create(struct sway_container *sibling,
}
const char *title = view_get_title(sway_view);
struct sway_container *swayc = container_create(C_VIEW);
wlr_log(L_DEBUG, "Adding new view %p:%s to container %p %d %s",
wlr_log(WLR_DEBUG, "Adding new view %p:%s to container %p %d %s",
swayc, title, sibling, sibling ? sibling->type : 0, sibling->name);
// Setup values
swayc->sway_view = sway_view;
@ -702,7 +702,7 @@ void container_for_each_descendant_bfs(struct sway_container *con,
}
if (queue == NULL) {
wlr_log(L_ERROR, "could not allocate list");
wlr_log(WLR_ERROR, "could not allocate list");
return;
}

View file

@ -101,7 +101,7 @@ void container_insert_child(struct sway_container *parent,
if (old_parent) {
container_remove_child(child);
}
wlr_log(L_DEBUG, "Inserting id:%zd at index %d", child->id, i);
wlr_log(WLR_DEBUG, "Inserting id:%zd at index %d", child->id, i);
list_insert(parent->children, i, child);
child->parent = parent;
container_handle_fullscreen_reparent(child, old_parent);
@ -127,7 +127,7 @@ struct sway_container *container_add_sibling(struct sway_container *fixed,
void container_add_child(struct sway_container *parent,
struct sway_container *child) {
wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
wlr_log(WLR_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
child, child->type, child->width, child->height,
parent, parent->type, parent->width, parent->height);
struct sway_container *old_parent = child->parent;
@ -319,13 +319,13 @@ static void move_out_of_tabs_stacks(struct sway_container *container,
int offs) {
if (container->parent == current->parent
&& current->parent->children->length == 1) {
wlr_log(L_DEBUG, "Changing layout of %zd", current->parent->id);
wlr_log(WLR_DEBUG, "Changing layout of %zd", current->parent->id);
current->parent->layout = move_dir ==
MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT;
return;
}
wlr_log(L_DEBUG, "Moving out of tab/stack into a split");
wlr_log(WLR_DEBUG, "Moving out of tab/stack into a split");
bool is_workspace = current->parent->type == C_WORKSPACE;
struct sway_container *new_parent = container_split(current->parent,
move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT);
@ -370,7 +370,7 @@ void container_move(struct sway_container *container,
}
parent = current->parent;
wlr_log(L_DEBUG, "Visiting %p %s '%s'", current,
wlr_log(WLR_DEBUG, "Visiting %p %s '%s'", current,
container_type_to_str(current->type), current->name);
int index = index_child(current);
@ -388,12 +388,12 @@ void container_move(struct sway_container *container,
root_container.sway_root->output_layout, wlr_dir,
current->sway_output->wlr_output, ref_lx, ref_ly);
if (!next) {
wlr_log(L_DEBUG, "Hit edge of output, nowhere else to go");
wlr_log(WLR_DEBUG, "Hit edge of output, nowhere else to go");
return;
}
struct sway_output *next_output = next->data;
current = next_output->swayc;
wlr_log(L_DEBUG, "Selected next output (%s)", current->name);
wlr_log(WLR_DEBUG, "Selected next output (%s)", current->name);
// Select workspace and get outta here
current = seat_get_focus_inactive(
config->handler_context.seat, current);
@ -406,20 +406,20 @@ void container_move(struct sway_container *container,
case C_WORKSPACE:
if (!is_parallel(current->layout, move_dir)) {
if (current->children->length >= 2) {
wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)",
wlr_log(WLR_DEBUG, "Rejiggering the workspace (%d kiddos)",
current->children->length);
workspace_rejigger(current, container, move_dir);
return;
} else {
wlr_log(L_DEBUG, "Selecting output");
wlr_log(WLR_DEBUG, "Selecting output");
current = current->parent;
}
} else if (current->layout == L_TABBED
|| current->layout == L_STACKED) {
wlr_log(L_DEBUG, "Rejiggering out of tabs/stacks");
wlr_log(WLR_DEBUG, "Rejiggering out of tabs/stacks");
workspace_rejigger(current, container, move_dir);
} else {
wlr_log(L_DEBUG, "Selecting output");
wlr_log(WLR_DEBUG, "Selecting output");
current = current->parent;
}
break;
@ -435,11 +435,11 @@ void container_move(struct sway_container *container,
move_dir, offs);
return;
} else {
wlr_log(L_DEBUG, "Hit limit, selecting parent");
wlr_log(WLR_DEBUG, "Hit limit, selecting parent");
current = current->parent;
}
} else {
wlr_log(L_DEBUG, "Hit limit, "
wlr_log(WLR_DEBUG, "Hit limit, "
"promoting descendant to sibling");
// Special case
container_insert_child(current->parent, container,
@ -449,14 +449,14 @@ void container_move(struct sway_container *container,
}
} else {
sibling = parent->children->items[index + offs];
wlr_log(L_DEBUG, "Selecting sibling id:%zd", sibling->id);
wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id);
}
} else if (parent->layout == L_TABBED
|| parent->layout == L_STACKED) {
move_out_of_tabs_stacks(container, current, move_dir, offs);
return;
} else {
wlr_log(L_DEBUG, "Moving up to find a parallel container");
wlr_log(WLR_DEBUG, "Moving up to find a parallel container");
current = current->parent;
}
break;
@ -475,11 +475,11 @@ void container_move(struct sway_container *container,
switch (sibling->type) {
case C_VIEW:
if (sibling->parent == container->parent) {
wlr_log(L_DEBUG, "Swapping siblings");
wlr_log(WLR_DEBUG, "Swapping siblings");
sibling->parent->children->items[index + offs] = container;
sibling->parent->children->items[index] = sibling;
} else {
wlr_log(L_DEBUG, "Promoting to sibling of cousin");
wlr_log(WLR_DEBUG, "Promoting to sibling of cousin");
container_insert_child(sibling->parent, container,
index_child(sibling) + (offs > 0 ? 0 : 1));
container->width = container->height = 0;
@ -490,31 +490,31 @@ void container_move(struct sway_container *container,
case C_CONTAINER:
if (is_parallel(sibling->layout, move_dir)) {
int limit = container_limit(sibling, invert_movement(move_dir));
wlr_log(L_DEBUG, "limit: %d", limit);
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG, "limit: %d", limit);
wlr_log(WLR_DEBUG,
"Reparenting container (parallel) to index %d "
"(move dir: %d)", limit, move_dir);
container_insert_child(sibling, container, limit);
container->width = container->height = 0;
sibling = NULL;
} else {
wlr_log(L_DEBUG, "Reparenting container (perpendicular)");
wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
struct sway_container *focus_inactive = seat_get_focus_inactive(
config->handler_context.seat, sibling);
if (focus_inactive && focus_inactive != sibling) {
while (focus_inactive->parent != sibling) {
focus_inactive = focus_inactive->parent;
}
wlr_log(L_DEBUG, "Focus inactive: id:%zd",
wlr_log(WLR_DEBUG, "Focus inactive: id:%zd",
focus_inactive->id);
sibling = focus_inactive;
continue;
} else if (sibling->children->length) {
wlr_log(L_DEBUG, "No focus-inactive, adding arbitrarily");
wlr_log(WLR_DEBUG, "No focus-inactive, adding arbitrarily");
container_remove_child(container);
container_add_sibling(sibling->children->items[0], container);
} else {
wlr_log(L_DEBUG, "No kiddos, adding container alone");
wlr_log(WLR_DEBUG, "No kiddos, adding container alone");
container_remove_child(container);
container_add_child(sibling, container);
}
@ -611,7 +611,7 @@ static struct sway_container *get_swayc_in_output_direction(
}
if (ws == NULL) {
wlr_log(L_ERROR, "got an output without a workspace");
wlr_log(WLR_ERROR, "got an output without a workspace");
return NULL;
}
@ -783,7 +783,7 @@ struct sway_container *container_get_in_direction(
} else {
struct sway_container *desired_con =
parent->children->items[desired];
wlr_log(L_DEBUG,
wlr_log(WLR_DEBUG,
"cont %d-%p dir %i sibling %d: %p", idx,
container, dir, desired, desired_con);
return seat_get_focus_inactive_view(seat, desired_con);
@ -848,7 +848,7 @@ struct sway_container *container_split(struct sway_container *child,
struct sway_container *cont = container_create(C_CONTAINER);
wlr_log(L_DEBUG, "creating container %p around %p", cont, child);
wlr_log(WLR_DEBUG, "creating container %p around %p", cont, child);
remove_gaps(child);
@ -896,7 +896,7 @@ struct sway_container *container_split(struct sway_container *child,
void container_recursive_resize(struct sway_container *container,
double amount, enum resize_edge edge) {
bool layout_match = true;
wlr_log(L_DEBUG, "Resizing %p with amount: %f", container, amount);
wlr_log(WLR_DEBUG, "Resizing %p with amount: %f", container, amount);
if (edge == RESIZE_EDGE_LEFT || edge == RESIZE_EDGE_RIGHT) {
container->width += amount;
layout_match = container->layout == L_HORIZ;
@ -986,7 +986,7 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) {
return;
}
wlr_log(L_DEBUG, "Swapping containers %zu and %zu", con1->id, con2->id);
wlr_log(WLR_DEBUG, "Swapping containers %zu and %zu", con1->id, con2->id);
int fs1 = con1->type == C_VIEW && con1->sway_view->is_fullscreen;
int fs2 = con2->type == C_VIEW && con2->sway_view->is_fullscreen;

View file

@ -43,11 +43,11 @@ struct sway_container *output_create(
if (strcasecmp(name, cur->name) == 0 ||
strcasecmp(identifier, cur->name) == 0) {
wlr_log(L_DEBUG, "Matched output config for %s", name);
wlr_log(WLR_DEBUG, "Matched output config for %s", name);
oc = cur;
}
if (strcasecmp("*", cur->name) == 0) {
wlr_log(L_DEBUG, "Matched wildcard output config for %s", name);
wlr_log(WLR_DEBUG, "Matched wildcard output config for %s", name);
all = cur;
}
@ -86,7 +86,7 @@ struct sway_container *output_create(
if (!output->children->length) {
// Create workspace
char *ws_name = workspace_next_name(output->name);
wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
wlr_log(WLR_DEBUG, "Creating default workspace %s", ws_name);
struct sway_container *ws = workspace_create(output, ws_name);
// Set each seat's focus if not already set
struct sway_seat *seat = NULL;

View file

@ -462,17 +462,17 @@ void view_execute_criteria(struct sway_view *view) {
list_t *criterias = criteria_for_view(view, CT_COMMAND);
for (int i = 0; i < criterias->length; i++) {
struct criteria *criteria = criterias->items[i];
wlr_log(L_DEBUG, "Checking criteria %s", criteria->raw);
wlr_log(WLR_DEBUG, "Checking criteria %s", criteria->raw);
if (view_has_executed_criteria(view, criteria)) {
wlr_log(L_DEBUG, "Criteria already executed");
wlr_log(WLR_DEBUG, "Criteria already executed");
continue;
}
wlr_log(L_DEBUG, "for_window '%s' matches view %p, cmd: '%s'",
wlr_log(WLR_DEBUG, "for_window '%s' matches view %p, cmd: '%s'",
criteria->raw, view, criteria->cmdlist);
list_add(view->executed_criteria, criteria);
struct cmd_results *res = execute_command(criteria->cmdlist, NULL);
if (res->status != CMD_SUCCESS) {
wlr_log(L_ERROR, "Command '%s' failed: %s", res->input, res->error);
wlr_log(WLR_ERROR, "Command '%s' failed: %s", res->input, res->error);
}
free_cmd_results(res);
// view must be focused for commands to affect it,
@ -601,7 +601,7 @@ static void view_subsurface_create(struct sway_view *view,
struct wlr_subsurface *subsurface) {
struct sway_view_child *child = calloc(1, sizeof(struct sway_view_child));
if (child == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return;
}
view_child_init(child, NULL, view, subsurface->surface);
@ -721,7 +721,7 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
return NULL;
}
wlr_log(L_DEBUG, "Surface of unknown type (role %s): %p",
wlr_log(WLR_DEBUG, "Surface of unknown type (role %s): %p",
wlr_surface->role, wlr_surface);
return NULL;
}
@ -789,7 +789,7 @@ static char *escape_title(char *buffer) {
char *escaped_title = calloc(length + 1, sizeof(char));
int result = escape_markup_text(buffer, escaped_title, length);
if (result != length) {
wlr_log(L_ERROR, "Could not escape title: %s", buffer);
wlr_log(WLR_ERROR, "Could not escape title: %s", buffer);
free(escaped_title);
return buffer;
}

View file

@ -49,7 +49,7 @@ struct sway_container *workspace_create(struct sway_container *output,
output = get_workspace_initial_output(name);
}
wlr_log(L_DEBUG, "Added workspace %s for output %s", name, output->name);
wlr_log(WLR_DEBUG, "Added workspace %s for output %s", name, output->name);
struct sway_container *workspace = container_create(C_WORKSPACE);
workspace->x = output->x;
@ -107,7 +107,7 @@ static bool workspace_valid_on_output(const char *output_name,
}
char *workspace_next_name(const char *output_name) {
wlr_log(L_DEBUG, "Workspace: Generating new workspace name for output %s",
wlr_log(WLR_DEBUG, "Workspace: Generating new workspace name for output %s",
output_name);
// Scan all workspace bindings to find the next available workspace name,
// if none are found/available then default to a number
@ -135,7 +135,7 @@ char *workspace_next_name(const char *output_name) {
while (isspace(*_target)) {
memmove(_target, _target+1, strlen(_target+1));
}
wlr_log(L_DEBUG, "Got valid workspace command for target: '%s'",
wlr_log(WLR_DEBUG, "Got valid workspace command for target: '%s'",
_target);
// Make sure that the command references an actual workspace
@ -161,7 +161,7 @@ char *workspace_next_name(const char *output_name) {
temp[length - 1] = '\0';
free(_target);
_target = temp;
wlr_log(L_DEBUG, "Isolated name from workspace number: '%s'", _target);
wlr_log(WLR_DEBUG, "Isolated name from workspace number: '%s'", _target);
// Make sure the workspace number doesn't already exist
if (workspace_by_number(_target)) {
@ -190,7 +190,7 @@ char *workspace_next_name(const char *output_name) {
order = binding->order;
free(target);
target = _target;
wlr_log(L_DEBUG, "Workspace: Found free name %s", _target);
wlr_log(WLR_DEBUG, "Workspace: Found free name %s", _target);
} else {
free(_target);
}
@ -387,7 +387,7 @@ bool workspace_switch(struct sway_container *workspace) {
free(prev_workspace_name);
prev_workspace_name = malloc(strlen(active_ws->name) + 1);
if (!prev_workspace_name) {
wlr_log(L_ERROR, "Unable to allocate previous workspace name");
wlr_log(WLR_ERROR, "Unable to allocate previous workspace name");
return false;
}
strcpy(prev_workspace_name, active_ws->name);
@ -409,7 +409,7 @@ bool workspace_switch(struct sway_container *workspace) {
}
}
wlr_log(L_DEBUG, "Switching to workspace %p:%s",
wlr_log(WLR_DEBUG, "Switching to workspace %p:%s",
workspace, workspace->name);
struct sway_container *next = seat_get_focus_inactive(seat, workspace);
if (next == NULL) {

View file

@ -46,7 +46,7 @@ static void swaybar_output_free(struct swaybar_output *output) {
if (!output) {
return;
}
wlr_log(L_DEBUG, "Removing output %s", output->name);
wlr_log(WLR_DEBUG, "Removing output %s", output->name);
zwlr_layer_surface_v1_destroy(output->layer_surface);
wl_surface_destroy(output->surface);
wl_output_destroy(output->output);

View file

@ -31,7 +31,7 @@ static bool i3bar_parse_json(struct status_line *status, const char *text) {
status_error(status, "[failed to parse i3bar json]");
return false;
}
wlr_log(L_DEBUG, "Got i3bar json: '%s'", text);
wlr_log(WLR_DEBUG, "Got i3bar json: '%s'", text);
for (size_t i = 0; i < json_object_array_length(results); ++i) {
json_object *full_text, *short_text, *color, *min_width, *align, *urgent;
json_object *name, *instance, *separator, *separator_block_width;
@ -193,7 +193,7 @@ bool i3bar_handle_readable(struct status_line *status) {
void i3bar_block_send_click(struct status_line *status,
struct i3bar_block *block, int x, int y, uint32_t button) {
wlr_log(L_DEBUG, "block %s clicked", block->name ? block->name : "(nil)");
wlr_log(WLR_DEBUG, "block %s clicked", block->name ? block->name : "(nil)");
if (!block->name || !status->i3bar_state.click_events) {
return;
}

View file

@ -327,7 +327,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
json_object *result = json_tokener_parse(resp->payload);
if (!result) {
free_ipc_response(resp);
wlr_log(L_ERROR, "failed to parse payload as json");
wlr_log(WLR_ERROR, "failed to parse payload as json");
return false;
}
json_object *json_change, *json_pango_markup;
@ -340,7 +340,7 @@ bool handle_ipc_readable(struct swaybar *bar) {
bar->config->mode = strdup(change);
}
} else {
wlr_log(L_ERROR, "failed to parse response");
wlr_log(WLR_ERROR, "failed to parse response");
json_object_put(result);
free_ipc_response(resp);
return false;

View file

@ -75,13 +75,13 @@ int main(int argc, char **argv) {
}
if (debug) {
wlr_log_init(L_DEBUG, NULL);
wlr_log_init(WLR_DEBUG, NULL);
} else {
wlr_log_init(L_ERROR, NULL);
wlr_log_init(WLR_ERROR, NULL);
}
if (!bar_id) {
wlr_log(L_ERROR, "No bar_id passed. "
wlr_log(WLR_ERROR, "No bar_id passed. "
"Provide --bar_id or let sway start swaybar");
return 1;
}
@ -89,7 +89,7 @@ int main(int argc, char **argv) {
if (!socket_path) {
socket_path = get_socketpath();
if (!socket_path) {
wlr_log(L_ERROR, "Unable to retrieve socket path");
wlr_log(WLR_ERROR, "Unable to retrieve socket path");
return 1;
}
}

View file

@ -49,14 +49,14 @@ bool status_handle_readable(struct status_line *status) {
json_object *version;
if (json_object_object_get_ex(proto, "version", &version)
&& json_object_get_int(version) == 1) {
wlr_log(L_DEBUG, "Switched to i3bar protocol.");
wlr_log(WLR_DEBUG, "Switched to i3bar protocol.");
status->protocol = PROTOCOL_I3BAR;
}
json_object *click_events;
if (json_object_object_get_ex(
proto, "click_events", &click_events)
&& json_object_get_boolean(click_events)) {
wlr_log(L_DEBUG, "Enabled click events.");
wlr_log(WLR_DEBUG, "Enabled click events.");
status->i3bar_state.click_events = true;
const char *events_array = "[\n";
ssize_t len = strlen(events_array);
@ -91,7 +91,7 @@ struct status_line *status_line_init(char *cmd) {
int pipe_read_fd[2];
int pipe_write_fd[2];
if (pipe(pipe_read_fd) != 0 || pipe(pipe_write_fd) != 0) {
wlr_log(L_ERROR, "Unable to create pipes for status_command fork");
wlr_log(WLR_ERROR, "Unable to create pipes for status_command fork");
exit(1);
}

View file

@ -48,7 +48,7 @@ struct swaybg_state {
bool is_valid_color(const char *color) {
int len = strlen(color);
if (len != 7 || color[0] != '#') {
wlr_log(L_ERROR, "%s is not a valid color for swaybg. "
wlr_log(WLR_ERROR, "%s is not a valid color for swaybg. "
"Color should be specified as #rrggbb (no alpha).", color);
return false;
}
@ -185,10 +185,10 @@ int main(int argc, const char **argv) {
struct swaybg_args args = {0};
struct swaybg_state state = {0};
state.args = &args;
wlr_log_init(L_DEBUG, NULL);
wlr_log_init(WLR_DEBUG, NULL);
if (argc != 4) {
wlr_log(L_ERROR, "Do not run this program manually. "
wlr_log(WLR_ERROR, "Do not run this program manually. "
"See man 5 sway and look for output options.");
return 1;
}

View file

@ -59,24 +59,24 @@ static void cmd_exec(void *data) {
return;
}
char *param = (char *)data;
wlr_log(L_DEBUG, "Cmd exec %s", param);
wlr_log(WLR_DEBUG, "Cmd exec %s", param);
pid_t pid = fork();
if (pid == 0) {
pid = fork();
if (pid == 0) {
char *const cmd[] = { "sh", "-c", param, NULL, };
execvp(cmd[0], cmd);
wlr_log_errno(L_ERROR, "execve failed!");
wlr_log_errno(WLR_ERROR, "execve failed!");
exit(1);
} else if (pid < 0) {
wlr_log_errno(L_ERROR, "fork failed");
wlr_log_errno(WLR_ERROR, "fork failed");
exit(1);
}
exit(0);
} else if (pid < 0) {
wlr_log_errno(L_ERROR, "fork failed");
wlr_log_errno(WLR_ERROR, "fork failed");
} else {
wlr_log(L_DEBUG, "Spawned process %s", param);
wlr_log(WLR_DEBUG, "Spawned process %s", param);
waitpid(pid, NULL, 0);
}
}
@ -86,7 +86,7 @@ static int lock_fd = -1;
static int ongoing_fd = -1;
static int release_lock(void *data) {
wlr_log(L_INFO, "Releasing sleep lock %d", ongoing_fd);
wlr_log(WLR_INFO, "Releasing sleep lock %d", ongoing_fd);
if (ongoing_fd >= 0) {
close(ongoing_fd);
}
@ -101,7 +101,7 @@ void acquire_sleep_lock() {
int ret = sd_bus_default_system(&bus);
if (ret < 0) {
wlr_log(L_ERROR, "Failed to open D-Bus connection: %s",
wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s",
strerror(-ret));
return;
}
@ -112,17 +112,17 @@ void acquire_sleep_lock() {
&error, &msg, "ssss", "sleep", "swayidle",
"Setup Up Lock Screen", "delay");
if (ret < 0) {
wlr_log(L_ERROR, "Failed to send Inhibit signal: %s",
wlr_log(WLR_ERROR, "Failed to send Inhibit signal: %s",
strerror(-ret));
} else {
ret = sd_bus_message_read(msg, "h", &lock_fd);
if (ret < 0) {
wlr_log(L_ERROR,
wlr_log(WLR_ERROR,
"Failed to parse D-Bus response for Inhibit: %s",
strerror(-ret));
}
}
wlr_log(L_INFO, "Got sleep lock: %d", lock_fd);
wlr_log(WLR_INFO, "Got sleep lock: %d", lock_fd);
}
static int prepare_for_sleep(sd_bus_message *msg, void *userdata,
@ -131,10 +131,10 @@ static int prepare_for_sleep(sd_bus_message *msg, void *userdata,
int going_down = 1;
int ret = sd_bus_message_read(msg, "b", &going_down);
if (ret < 0) {
wlr_log(L_ERROR, "Failed to parse D-Bus response for Inhibit: %s",
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for Inhibit: %s",
strerror(-ret));
}
wlr_log(L_DEBUG, "PrepareForSleep signal received %d", going_down);
wlr_log(WLR_DEBUG, "PrepareForSleep signal received %d", going_down);
if (!going_down) {
acquire_sleep_lock();
return 0;
@ -151,7 +151,7 @@ static int prepare_for_sleep(sd_bus_message *msg, void *userdata,
wl_event_loop_add_timer(state.event_loop, release_lock, NULL);
wl_event_source_timer_update(source, 1000);
}
wlr_log(L_DEBUG, "Prepare for sleep done");
wlr_log(WLR_DEBUG, "Prepare for sleep done");
return 0;
}
@ -168,7 +168,7 @@ void setup_sleep_listener() {
int ret = sd_bus_default_system(&bus);
if (ret < 0) {
wlr_log(L_ERROR, "Failed to open D-Bus connection: %s",
wlr_log(WLR_ERROR, "Failed to open D-Bus connection: %s",
strerror(-ret));
return;
}
@ -183,7 +183,7 @@ void setup_sleep_listener() {
"/org/freedesktop/login1");
ret = sd_bus_add_match(bus, NULL, str, prepare_for_sleep, NULL);
if (ret < 0) {
wlr_log(L_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
wlr_log(WLR_ERROR, "Failed to add D-Bus match: %s", strerror(-ret));
return;
}
acquire_sleep_lock();
@ -214,7 +214,7 @@ static const struct wl_registry_listener registry_listener = {
static void handle_idle(void *data, struct org_kde_kwin_idle_timeout *timer) {
struct swayidle_timeout_cmd *cmd = data;
wlr_log(L_DEBUG, "idle state");
wlr_log(WLR_DEBUG, "idle state");
if (cmd && cmd->idle_cmd && cmd->idle_cmd->callback) {
cmd->idle_cmd->callback(cmd->idle_cmd->param);
}
@ -222,7 +222,7 @@ static void handle_idle(void *data, struct org_kde_kwin_idle_timeout *timer) {
static void handle_resume(void *data, struct org_kde_kwin_idle_timeout *timer) {
struct swayidle_timeout_cmd *cmd = data;
wlr_log(L_DEBUG, "active state");
wlr_log(WLR_DEBUG, "active state");
if (cmd && cmd->resume_cmd && cmd->resume_cmd->callback) {
cmd->resume_cmd->callback(cmd->resume_cmd->param);
}
@ -235,12 +235,12 @@ static const struct org_kde_kwin_idle_timeout_listener idle_timer_listener = {
struct swayidle_cmd *parse_command(int argc, char **argv) {
if (argc < 1) {
wlr_log(L_ERROR, "Too few parameters for command in parse_command");
wlr_log(WLR_ERROR, "Too few parameters for command in parse_command");
return NULL;
}
struct swayidle_cmd *cmd = calloc(1, sizeof(struct swayidle_cmd));
wlr_log(L_DEBUG, "Command: %s", argv[0]);
wlr_log(WLR_DEBUG, "Command: %s", argv[0]);
cmd->callback = cmd_exec;
cmd->param = argv[0];
return cmd;
@ -248,7 +248,7 @@ struct swayidle_cmd *parse_command(int argc, char **argv) {
int parse_timeout(int argc, char **argv) {
if (argc < 3) {
wlr_log(L_ERROR, "Too few parameters to timeout command. "
wlr_log(WLR_ERROR, "Too few parameters to timeout command. "
"Usage: timeout <seconds> <command>");
exit(-1);
}
@ -256,7 +256,7 @@ int parse_timeout(int argc, char **argv) {
char *endptr;
int seconds = strtoul(argv[1], &endptr, 10);
if (errno != 0 || *endptr != '\0') {
wlr_log(L_ERROR, "Invalid timeout parameter '%s', it should be a "
wlr_log(WLR_ERROR, "Invalid timeout parameter '%s', it should be a "
"numeric value representing seconds", optarg);
exit(-1);
}
@ -264,13 +264,13 @@ int parse_timeout(int argc, char **argv) {
calloc(1, sizeof(struct swayidle_timeout_cmd));
cmd->timeout = seconds * 1000;
wlr_log(L_DEBUG, "Register idle timeout at %d ms", cmd->timeout);
wlr_log(L_DEBUG, "Setup idle");
wlr_log(WLR_DEBUG, "Register idle timeout at %d ms", cmd->timeout);
wlr_log(WLR_DEBUG, "Setup idle");
cmd->idle_cmd = parse_command(argc - 2, &argv[2]);
int result = 3;
if (argc >= 5 && !strcmp("resume", argv[3])) {
wlr_log(L_DEBUG, "Setup resume");
wlr_log(WLR_DEBUG, "Setup resume");
cmd->resume_cmd = parse_command(argc - 4, &argv[4]);
result = 5;
}
@ -280,14 +280,14 @@ int parse_timeout(int argc, char **argv) {
int parse_sleep(int argc, char **argv) {
if (argc < 2) {
wlr_log(L_ERROR, "Too few parameters to before-sleep command. "
wlr_log(WLR_ERROR, "Too few parameters to before-sleep command. "
"Usage: before-sleep <command>");
exit(-1);
}
lock_cmd = parse_command(argc - 1, &argv[1]);
if (lock_cmd) {
wlr_log(L_DEBUG, "Setup sleep lock: %s", lock_cmd->param);
wlr_log(WLR_DEBUG, "Setup sleep lock: %s", lock_cmd->param);
}
return 2;
@ -314,10 +314,10 @@ int parse_args(int argc, char *argv[]) {
}
if (debug) {
wlr_log_init(L_DEBUG, NULL);
wlr_log(L_DEBUG, "Loglevel debug");
wlr_log_init(WLR_DEBUG, NULL);
wlr_log(WLR_DEBUG, "Loglevel debug");
} else {
wlr_log_init(L_INFO, NULL);
wlr_log_init(WLR_INFO, NULL);
}
@ -326,13 +326,13 @@ int parse_args(int argc, char *argv[]) {
int i = optind;
while (i < argc) {
if (!strcmp("timeout", argv[i])) {
wlr_log(L_DEBUG, "Got timeout");
wlr_log(WLR_DEBUG, "Got timeout");
i += parse_timeout(argc - i, &argv[i]);
} else if (!strcmp("before-sleep", argv[i])) {
wlr_log(L_DEBUG, "Got before-sleep");
wlr_log(WLR_DEBUG, "Got before-sleep");
i += parse_sleep(argc - i, &argv[i]);
} else {
wlr_log(L_ERROR, "Unsupported command '%s'", argv[i]);
wlr_log(WLR_ERROR, "Unsupported command '%s'", argv[i]);
exit(-1);
}
}
@ -358,7 +358,7 @@ static int display_event(int fd, uint32_t mask, void *data) {
sway_terminate(0);
}
if (wl_display_dispatch(state.display) < 0) {
wlr_log_errno(L_ERROR, "wl_display_dispatch failed, exiting");
wlr_log_errno(WLR_ERROR, "wl_display_dispatch failed, exiting");
sway_terminate(0);
};
return 0;
@ -367,7 +367,7 @@ static int display_event(int fd, uint32_t mask, void *data) {
void register_idle_timeout(void *item) {
struct swayidle_timeout_cmd *cmd = item;
if (cmd == NULL || !cmd->timeout) {
wlr_log(L_ERROR, "Invalid idle cmd, will not register");
wlr_log(WLR_ERROR, "Invalid idle cmd, will not register");
return;
}
state.idle_timer =
@ -376,7 +376,7 @@ void register_idle_timeout(void *item) {
org_kde_kwin_idle_timeout_add_listener(state.idle_timer,
&idle_timer_listener, cmd);
} else {
wlr_log(L_ERROR, "Could not create idle timer");
wlr_log(WLR_ERROR, "Could not create idle timer");
}
}
@ -390,7 +390,7 @@ int main(int argc, char *argv[]) {
state.display = wl_display_connect(NULL);
if (state.display == NULL) {
wlr_log(L_ERROR, "Failed to create display");
wlr_log(WLR_ERROR, "Failed to create display");
return -3;
}
@ -401,11 +401,11 @@ int main(int argc, char *argv[]) {
state.event_loop = wl_event_loop_create();
if (idle_manager == NULL) {
wlr_log(L_ERROR, "Display doesn't support idle protocol");
wlr_log(WLR_ERROR, "Display doesn't support idle protocol");
return -4;
}
if (seat == NULL) {
wlr_log(L_ERROR, "Seat error");
wlr_log(WLR_ERROR, "Seat error");
return -5;
}
@ -417,7 +417,7 @@ int main(int argc, char *argv[]) {
}
#endif
if (!should_run) {
wlr_log(L_INFO, "No command specified! Nothing to do, will exit");
wlr_log(WLR_INFO, "No command specified! Nothing to do, will exit");
sway_terminate(0);
}
list_foreach(state.timeout_cmds, register_idle_timeout);

View file

@ -34,7 +34,7 @@ void sway_terminate(int exit_code) {
static void daemonize() {
int fds[2];
if (pipe(fds) != 0) {
wlr_log(L_ERROR, "Failed to pipe");
wlr_log(WLR_ERROR, "Failed to pipe");
exit(1);
}
if (fork() == 0) {
@ -58,7 +58,7 @@ static void daemonize() {
close(fds[1]);
uint8_t success;
if (read(fds[0], &success, 1) != 1 || !success) {
wlr_log(L_ERROR, "Failed to daemonize");
wlr_log(WLR_ERROR, "Failed to daemonize");
exit(1);
}
close(fds[0]);
@ -238,7 +238,7 @@ static void handle_xdg_output_logical_position(void *data,
static void handle_xdg_output_name(void *data, struct zxdg_output_v1 *output,
const char *name) {
wlr_log(L_DEBUG, "output name is %s", name);
wlr_log(WLR_DEBUG, "output name is %s", name);
struct swaylock_surface *surface = data;
surface->xdg_output = output;
surface->output_name = strdup(name);
@ -354,10 +354,10 @@ static void load_image(char *arg, struct swaylock_state *state) {
}
if (exists) {
if (image->output_name) {
wlr_log(L_ERROR, "Multiple images defined for output %s",
wlr_log(WLR_ERROR, "Multiple images defined for output %s",
image->output_name);
} else {
wlr_log(L_ERROR, "Multiple default images defined");
wlr_log(WLR_ERROR, "Multiple default images defined");
}
}
@ -377,7 +377,7 @@ static void load_image(char *arg, struct swaylock_state *state) {
}
wl_list_insert(&state->images, &image->link);
state->args.mode = BACKGROUND_MODE_FILL;
wlr_log(L_DEBUG, "Loaded image %s for output %s",
wlr_log(WLR_DEBUG, "Loaded image %s for output %s",
image->path, image->output_name ? image->output_name : "*");
}
@ -416,7 +416,7 @@ int main(int argc, char **argv) {
};
wl_list_init(&state.images);
wlr_log_init(L_DEBUG, NULL);
wlr_log_init(WLR_DEBUG, NULL);
int c;
while (1) {
@ -480,13 +480,13 @@ int main(int argc, char **argv) {
wl_display_roundtrip(state.display);
assert(state.compositor && state.layer_shell && state.shm);
if (!state.input_inhibit_manager) {
wlr_log(L_ERROR, "Compositor does not support the input inhibitor "
wlr_log(WLR_ERROR, "Compositor does not support the input inhibitor "
"protocol, refusing to run insecurely");
return 1;
}
if (wl_list_empty(&state.surfaces)) {
wlr_log(L_DEBUG, "Exiting - no outputs to show on.");
wlr_log(WLR_DEBUG, "Exiting - no outputs to show on.");
return 0;
}
@ -502,7 +502,7 @@ int main(int argc, char **argv) {
}
wl_display_roundtrip(state.display);
} else {
wlr_log(L_INFO, "Compositor does not support zxdg output manager, "
wlr_log(WLR_INFO, "Compositor does not support zxdg output manager, "
"images assigned to named outputs will not work");
}

View file

@ -53,15 +53,15 @@ static bool attempt_password(struct swaylock_password *pw) {
// TODO: only call pam_start once. keep the same handle the whole time
if ((pam_err = pam_start("swaylock", username,
&local_conversation, &local_auth_handle)) != PAM_SUCCESS) {
wlr_log(L_ERROR, "PAM returned error %d", pam_err);
wlr_log(WLR_ERROR, "PAM returned error %d", pam_err);
}
if ((pam_err = pam_authenticate(local_auth_handle, 0)) != PAM_SUCCESS) {
wlr_log(L_ERROR, "pam_authenticate failed");
wlr_log(WLR_ERROR, "pam_authenticate failed");
goto fail;
}
// TODO: only call pam_end once we succeed at authing. refresh tokens beforehand
if ((pam_err = pam_end(local_auth_handle, pam_err)) != PAM_SUCCESS) {
wlr_log(L_ERROR, "pam_end failed");
wlr_log(WLR_ERROR, "pam_end failed");
goto fail;
}
clear_password_buffer(pw);

View file

@ -12,13 +12,13 @@ static void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
struct swaylock_state *state = data;
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
close(fd);
wlr_log(L_ERROR, "Unknown keymap format %d, aborting", format);
wlr_log(WLR_ERROR, "Unknown keymap format %d, aborting", format);
exit(1);
}
char *map_shm = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_shm == MAP_FAILED) {
close(fd);
wlr_log(L_ERROR, "Unable to initialize keymap shm, aborting");
wlr_log(WLR_ERROR, "Unable to initialize keymap shm, aborting");
exit(1);
}
struct xkb_keymap *keymap = xkb_keymap_new_from_string(

View file

@ -323,7 +323,7 @@ int main(int argc, char **argv) {
char *socket_path = NULL;
char *cmdtype = NULL;
wlr_log_init(L_INFO, NULL);
wlr_log_init(WLR_INFO, NULL);
static struct option long_options[] = {
{"help", no_argument, NULL, 'h'},