sway: change all sway_log to wlr_log

This commit is contained in:
Dominique Martinet 2018-01-05 22:32:51 +01:00
parent fdc92e7454
commit 67985e9031
36 changed files with 167 additions and 190 deletions

View File

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

View File

@ -8,7 +8,7 @@ char *read_line(FILE *file) {
char *string = malloc(size); char *string = malloc(size);
char lastChar = '\0'; char lastChar = '\0';
if (!string) { if (!string) {
sway_log(L_ERROR, "Unable to allocate memory for read_line"); wlr_log(L_ERROR, "Unable to allocate memory for read_line");
return NULL; return NULL;
} }
while (1) { while (1) {
@ -29,7 +29,7 @@ char *read_line(FILE *file) {
char *new_string = realloc(string, size *= 2); char *new_string = realloc(string, size *= 2);
if (!new_string) { if (!new_string) {
free(string); free(string);
sway_log(L_ERROR, "Unable to allocate memory for read_line"); wlr_log(L_ERROR, "Unable to allocate memory for read_line");
return NULL; return NULL;
} }
string = new_string; string = new_string;

View File

@ -113,7 +113,7 @@ uint32_t parse_color(const char *color) {
int len = strlen(color); int len = strlen(color);
if (len != 6 && len != 8) { if (len != 6 && len != 8) {
sway_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); wlr_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
uint32_t res = (uint32_t)strtoul(color, NULL, 16); uint32_t res = (uint32_t)strtoul(color, NULL, 16);

View File

@ -1,22 +1,7 @@
#ifndef _SWAY_LOG_H #ifndef _SWAY_LOG_H
#define _SWAY_LOG_H #define _SWAY_LOG_H
#include <stdbool.h> #include <stdbool.h>
#include <wlr/util/log.h>
typedef enum {
L_SILENT = 0,
L_ERROR = 1,
L_INFO = 2,
L_DEBUG = 3,
} log_importance_t;
void init_log(log_importance_t verbosity);
void set_log_level(log_importance_t verbosity);
log_importance_t get_log_level(void);
void reset_log_level(void);
// returns whether debug logging is on after switching.
bool toggle_debug_logging(void);
void sway_log_colors(int mode);
void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3)));
void _sway_abort(const char *filename, int line, const char* format, ...) __attribute__((format(printf,3,4))); void _sway_abort(const char *filename, int line, const char* format, ...) __attribute__((format(printf,3,4)));
#define sway_abort(FMT, ...) \ #define sway_abort(FMT, ...) \
@ -26,14 +11,6 @@ bool _sway_assert(bool condition, const char *filename, int line, const char* fo
#define sway_assert(COND, FMT, ...) \ #define sway_assert(COND, FMT, ...) \
_sway_assert(COND, __FILE__, __LINE__, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__) _sway_assert(COND, __FILE__, __LINE__, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__)
void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5)));
#define sway_log(VERBOSITY, FMT, ...) \
_sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__)
#define sway_vlog(VERBOSITY, FMT, VA_ARGS) \
_sway_vlog(__FILE__, __LINE__, VERBOSITY, FMT, VA_ARGS)
void error_handler(int sig); void error_handler(int sig);
#endif #endif

View File

@ -176,7 +176,7 @@ static struct cmd_handler seat_handlers[] = {
static struct cmd_handler *find_handler(char *line, enum cmd_status block) { static struct cmd_handler *find_handler(char *line, enum cmd_status block) {
struct cmd_handler d = { .command=line }; struct cmd_handler d = { .command=line };
struct cmd_handler *res = NULL; struct cmd_handler *res = NULL;
sway_log(L_DEBUG, "find_handler(%s) %d", line, block == CMD_BLOCK_SEAT); wlr_log(L_DEBUG, "find_handler(%s) %d", line, block == CMD_BLOCK_SEAT);
if (block == CMD_BLOCK_INPUT) { if (block == CMD_BLOCK_INPUT) {
res = bsearch(&d, input_handlers, res = bsearch(&d, input_handlers,
@ -215,10 +215,10 @@ struct cmd_results *handle_command(char *_exec) {
cmd = argsep(&cmdlist, ","); cmd = argsep(&cmdlist, ",");
cmd += strspn(cmd, whitespace); cmd += strspn(cmd, whitespace);
if (strcmp(cmd, "") == 0) { if (strcmp(cmd, "") == 0) {
sway_log(L_INFO, "Ignoring empty command."); wlr_log(L_INFO, "Ignoring empty command.");
continue; continue;
} }
sway_log(L_INFO, "Handling command '%s'", cmd); wlr_log(L_INFO, "Handling command '%s'", cmd);
//TODO better handling of argv //TODO better handling of argv
int argc; int argc;
char **argv = split_args(cmd, &argc); char **argv = split_args(cmd, &argc);
@ -276,7 +276,7 @@ struct cmd_results *config_command(char *exec, enum cmd_status block) {
goto cleanup; goto cleanup;
} }
sway_log(L_INFO, "handling config command '%s'", exec); wlr_log(L_INFO, "handling config command '%s'", exec);
// Endblock // Endblock
if (**argv == '}') { if (**argv == '}') {
results = cmd_results_new(CMD_BLOCK_END, NULL, NULL); results = cmd_results_new(CMD_BLOCK_END, NULL, NULL);
@ -380,7 +380,7 @@ struct cmd_results *config_commands_command(char *exec) {
} }
policy->context = context; policy->context = context;
sway_log(L_INFO, "Set command policy for %s to %d", wlr_log(L_INFO, "Set command policy for %s to %d",
policy->command, policy->context); policy->command, policy->context);
results = cmd_results_new(CMD_SUCCESS, NULL, NULL); results = cmd_results_new(CMD_SUCCESS, NULL, NULL);
@ -394,7 +394,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
const char *input, const char *format, ...) { const char *input, const char *format, ...) {
struct cmd_results *results = malloc(sizeof(struct cmd_results)); struct cmd_results *results = malloc(sizeof(struct cmd_results));
if (!results) { if (!results) {
sway_log(L_ERROR, "Unable to allocate command results"); wlr_log(L_ERROR, "Unable to allocate command results");
return NULL; return NULL;
} }
results->status = status; results->status = status;

View File

@ -145,7 +145,7 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
for (int i = 0; i < mode_bindings->length; ++i) { for (int i = 0; i < mode_bindings->length; ++i) {
struct sway_binding *config_binding = mode_bindings->items[i]; struct sway_binding *config_binding = mode_bindings->items[i];
if (binding_key_compare(binding, config_binding)) { if (binding_key_compare(binding, config_binding)) {
sway_log(L_DEBUG, "overwriting old binding with command '%s'", wlr_log(L_DEBUG, "overwriting old binding with command '%s'",
config_binding->command); config_binding->command);
free_sway_binding(config_binding); free_sway_binding(config_binding);
mode_bindings->items[i] = binding; mode_bindings->items[i] = binding;
@ -157,7 +157,7 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
list_add(mode_bindings, binding); list_add(mode_bindings, binding);
} }
sway_log(L_DEBUG, "bindsym - Bound %s to command %s", wlr_log(L_DEBUG, "bindsym - Bound %s to command %s",
argv[0], binding->command); argv[0], binding->command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);
} }
@ -227,7 +227,7 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
for (int i = 0; i < mode_bindings->length; ++i) { for (int i = 0; i < mode_bindings->length; ++i) {
struct sway_binding *config_binding = mode_bindings->items[i]; struct sway_binding *config_binding = mode_bindings->items[i];
if (binding_key_compare(binding, config_binding)) { if (binding_key_compare(binding, config_binding)) {
sway_log(L_DEBUG, "overwriting old binding with command '%s'", wlr_log(L_DEBUG, "overwriting old binding with command '%s'",
config_binding->command); config_binding->command);
free_sway_binding(config_binding); free_sway_binding(config_binding);
mode_bindings->items[i] = binding; mode_bindings->items[i] = binding;
@ -239,7 +239,7 @@ struct cmd_results *cmd_bindcode(int argc, char **argv) {
list_add(mode_bindings, binding); list_add(mode_bindings, binding);
} }
sway_log(L_DEBUG, "bindcode - Bound %s to command %s", wlr_log(L_DEBUG, "bindcode - Bound %s to command %s",
argv[0], binding->command); argv[0], binding->command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); 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->active) return cmd_results_new(CMD_DEFER, "exec", NULL);
if (config->reloading) { if (config->reloading) {
char *args = join_args(argv, argc); char *args = join_args(argv, argc);
sway_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args); wlr_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
free(args); free(args);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); 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; char *tmp = NULL;
if (strcmp((char*)*argv, "--no-startup-id") == 0) { if (strcmp((char*)*argv, "--no-startup-id") == 0) {
sway_log(L_INFO, "exec switch '--no-startup-id' not supported, ignored."); wlr_log(L_INFO, "exec switch '--no-startup-id' not supported, ignored.");
if ((error = checkarg(argc - 1, "exec_always", EXPECTED_MORE_THAN, 0))) { if ((error = checkarg(argc - 1, "exec_always", EXPECTED_MORE_THAN, 0))) {
return error; return error;
} }
@ -35,11 +35,11 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
strncpy(cmd, tmp, sizeof(cmd)); strncpy(cmd, tmp, sizeof(cmd));
cmd[sizeof(cmd) - 1] = 0; cmd[sizeof(cmd) - 1] = 0;
free(tmp); free(tmp);
sway_log(L_DEBUG, "Executing %s", cmd); wlr_log(L_DEBUG, "Executing %s", cmd);
int fd[2]; int fd[2];
if (pipe(fd) != 0) { if (pipe(fd) != 0) {
sway_log(L_ERROR, "Unable to create pipe for fork"); wlr_log(L_ERROR, "Unable to create pipe for fork");
} }
pid_t pid; pid_t pid;
@ -75,7 +75,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
// cleanup child process // cleanup child process
wait(0); wait(0);
if (*child > 0) { if (*child > 0) {
sway_log(L_DEBUG, "Child process created with pid %d", *child); wlr_log(L_DEBUG, "Child process created with pid %d", *child);
// TODO: add PID to active workspace // TODO: add PID to active workspace
} else { } else {
free(child); free(child);

View File

@ -12,7 +12,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
if (config->reading && strcmp("{", argv[1]) == 0) { if (config->reading && strcmp("{", argv[1]) == 0) {
current_input_config = new_input_config(argv[0]); current_input_config = new_input_config(argv[0]);
sway_log(L_DEBUG, "entering input block: %s", current_input_config->identifier); wlr_log(L_DEBUG, "entering input block: %s", current_input_config->identifier);
return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL); return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL);
} }

View File

@ -6,7 +6,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_click_method(int argc, char **argv) { struct cmd_results *input_cmd_click_method(int argc, char **argv) {
sway_log(L_DEBUG, "click_method for device: %d %s", wlr_log(L_DEBUG, "click_method for device: %d %s",
current_input_config==NULL, current_input_config->identifier); current_input_config==NULL, current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "click_method", EXPECTED_AT_LEAST, 1))) { if ((error = checkarg(argc, "click_method", EXPECTED_AT_LEAST, 1))) {

View File

@ -6,7 +6,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_events(int argc, char **argv) { struct cmd_results *input_cmd_events(int argc, char **argv) {
sway_log(L_DEBUG, "events for device: %s", wlr_log(L_DEBUG, "events for device: %s",
current_input_config->identifier); current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) { if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) {

View File

@ -6,7 +6,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_tap(int argc, char **argv) { struct cmd_results *input_cmd_tap(int argc, char **argv) {
sway_log(L_DEBUG, "tap for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "tap for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "tap", EXPECTED_AT_LEAST, 1))) { if ((error = checkarg(argc, "tap", EXPECTED_AT_LEAST, 1))) {
return error; return error;
@ -26,7 +26,7 @@ struct cmd_results *input_cmd_tap(int argc, char **argv) {
"Expected 'tap <enabled|disabled>'"); "Expected 'tap <enabled|disabled>'");
} }
sway_log(L_DEBUG, "apply-tap for device: %s", wlr_log(L_DEBUG, "apply-tap for device: %s",
current_input_config->identifier); current_input_config->identifier);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -5,7 +5,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) { struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
sway_log(L_DEBUG, "xkb layout for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "xkb layout for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_layout", EXPECTED_EQUAL_TO, 1))) { if ((error = checkarg(argc, "xkb_layout", EXPECTED_EQUAL_TO, 1))) {
return error; return error;
@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) {
new_config->xkb_layout = strdup(argv[0]); new_config->xkb_layout = strdup(argv[0]);
sway_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s", wlr_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s",
current_input_config->identifier, new_config->xkb_layout); current_input_config->identifier, new_config->xkb_layout);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -5,7 +5,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_xkb_model(int argc, char **argv) { struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
sway_log(L_DEBUG, "xkb model for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "xkb model for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_model", EXPECTED_EQUAL_TO, 1))) { if ((error = checkarg(argc, "xkb_model", EXPECTED_EQUAL_TO, 1))) {
return error; return error;
@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) {
new_config->xkb_model = strdup(argv[0]); new_config->xkb_model = strdup(argv[0]);
sway_log(L_DEBUG, "apply-xkb_model for device: %s model: %s", wlr_log(L_DEBUG, "apply-xkb_model for device: %s model: %s",
current_input_config->identifier, new_config->xkb_model); current_input_config->identifier, new_config->xkb_model);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -5,7 +5,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_xkb_options(int argc, char **argv) { struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
sway_log(L_DEBUG, "xkb options for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "xkb options for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_options", EXPECTED_EQUAL_TO, 1))) { if ((error = checkarg(argc, "xkb_options", EXPECTED_EQUAL_TO, 1))) {
return error; return error;
@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) {
new_config->xkb_options = strdup(argv[0]); new_config->xkb_options = strdup(argv[0]);
sway_log(L_DEBUG, "apply-xkb_options for device: %s options: %s", wlr_log(L_DEBUG, "apply-xkb_options for device: %s options: %s",
current_input_config->identifier, new_config->xkb_options); current_input_config->identifier, new_config->xkb_options);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -5,7 +5,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) { struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
sway_log(L_DEBUG, "xkb rules for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "xkb rules for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_rules", EXPECTED_EQUAL_TO, 1))) { if ((error = checkarg(argc, "xkb_rules", EXPECTED_EQUAL_TO, 1))) {
return error; return error;
@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) {
new_config->xkb_rules = strdup(argv[0]); new_config->xkb_rules = strdup(argv[0]);
sway_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s", wlr_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s",
current_input_config->identifier, new_config->xkb_rules); current_input_config->identifier, new_config->xkb_rules);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -5,7 +5,7 @@
#include "log.h" #include "log.h"
struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) { struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
sway_log(L_DEBUG, "xkb variant for device: %s", current_input_config->identifier); wlr_log(L_DEBUG, "xkb variant for device: %s", current_input_config->identifier);
struct cmd_results *error = NULL; struct cmd_results *error = NULL;
if ((error = checkarg(argc, "xkb_variant", EXPECTED_EQUAL_TO, 1))) { if ((error = checkarg(argc, "xkb_variant", EXPECTED_EQUAL_TO, 1))) {
return error; return error;
@ -18,7 +18,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) {
new_config->xkb_variant = strdup(argv[0]); new_config->xkb_variant = strdup(argv[0]);
sway_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s", wlr_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s",
current_input_config->identifier, new_config->xkb_variant); current_input_config->identifier, new_config->xkb_variant);
apply_input_config(new_config); apply_input_config(new_config);
return cmd_results_new(CMD_SUCCESS, NULL, NULL); return cmd_results_new(CMD_SUCCESS, NULL, NULL);

View File

@ -203,12 +203,12 @@ static struct cmd_results *cmd_output_background(struct output_config *output,
if (src) { if (src) {
sprintf(src, "%s/%s", conf_path, p.we_wordv[0]); sprintf(src, "%s/%s", conf_path, p.we_wordv[0]);
} else { } else {
sway_log(L_ERROR, wlr_log(L_ERROR,
"Unable to allocate background source"); "Unable to allocate background source");
} }
free(conf); free(conf);
} else { } else {
sway_log(L_ERROR, "Unable to allocate background source"); wlr_log(L_ERROR, "Unable to allocate background source");
} }
} }
if (!src || access(src, F_OK) == -1) { if (!src || access(src, F_OK) == -1) {
@ -238,7 +238,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
struct output_config *output = new_output_config(argv[0]); struct output_config *output = new_output_config(argv[0]);
if (!output) { if (!output) {
sway_log(L_ERROR, "Failed to allocate output config"); wlr_log(L_ERROR, "Failed to allocate output config");
return NULL; return NULL;
} }
@ -284,7 +284,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
list_add(config->output_configs, output); list_add(config->output_configs, output);
} }
sway_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz " wlr_log(L_DEBUG, "Config stored for output %s (enabled: %d) (%dx%d@%fHz "
"position %d,%d scale %f transform %d) (bg %s %s)", "position %d,%d scale %f transform %d) (bg %s %s)",
output->name, output->enabled, output->width, output->height, output->name, output->enabled, output->width, output->height,
output->refresh_rate, output->x, output->y, output->scale, output->refresh_rate, output->x, output->y, output->scale,

View File

@ -12,7 +12,7 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
if (config->reading && strcmp("{", argv[1]) == 0) { if (config->reading && strcmp("{", argv[1]) == 0) {
current_seat_config = new_seat_config(argv[0]); current_seat_config = new_seat_config(argv[0]);
sway_log(L_DEBUG, "entering seat block: %s", current_seat_config->name); wlr_log(L_DEBUG, "entering seat block: %s", current_seat_config->name);
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
} }

View File

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

View File

@ -232,12 +232,12 @@ static char *get_config_path(void) {
char *home = getenv("HOME"); char *home = getenv("HOME");
char *config_home = malloc(strlen(home) + strlen("/.config") + 1); char *config_home = malloc(strlen(home) + strlen("/.config") + 1);
if (!config_home) { if (!config_home) {
sway_log(L_ERROR, "Unable to allocate $HOME/.config"); wlr_log(L_ERROR, "Unable to allocate $HOME/.config");
} else { } else {
strcpy(config_home, home); strcpy(config_home, home);
strcat(config_home, "/.config"); strcat(config_home, "/.config");
setenv("XDG_CONFIG_HOME", config_home, 1); setenv("XDG_CONFIG_HOME", config_home, 1);
sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home); wlr_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home);
free(config_home); free(config_home);
} }
} }
@ -263,7 +263,7 @@ static char *get_config_path(void) {
const char *current_config_path; const char *current_config_path;
static bool load_config(const char *path, struct sway_config *config) { static bool load_config(const char *path, struct sway_config *config) {
sway_log(L_INFO, "Loading config from %s", path); wlr_log(L_INFO, "Loading config from %s", path);
current_config_path = path; current_config_path = path;
struct stat sb; struct stat sb;
@ -272,13 +272,13 @@ static bool load_config(const char *path, struct sway_config *config) {
} }
if (path == NULL) { if (path == NULL) {
sway_log(L_ERROR, "Unable to find a config file!"); wlr_log(L_ERROR, "Unable to find a config file!");
return false; return false;
} }
FILE *f = fopen(path, "r"); FILE *f = fopen(path, "r");
if (!f) { if (!f) {
sway_log(L_ERROR, "Unable to open %s for reading", path); wlr_log(L_ERROR, "Unable to open %s for reading", path);
return false; return false;
} }
@ -286,7 +286,7 @@ static bool load_config(const char *path, struct sway_config *config) {
fclose(f); fclose(f);
if (!config_load_success) { if (!config_load_success) {
sway_log(L_ERROR, "Error(s) loading config!"); wlr_log(L_ERROR, "Error(s) loading config!");
} }
current_config_path = NULL; current_config_path = NULL;
@ -313,7 +313,7 @@ bool load_main_config(const char *file, bool is_active) {
config_defaults(config); config_defaults(config);
if (is_active) { if (is_active) {
sway_log(L_DEBUG, "Performing configuration file reload"); wlr_log(L_DEBUG, "Performing configuration file reload");
config->reloading = true; config->reloading = true;
config->active = true; config->active = true;
} }
@ -327,7 +327,7 @@ bool load_main_config(const char *file, bool is_active) {
bool success = true; bool success = true;
DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); DIR *dir = opendir(SYSCONFDIR "/sway/security.d");
if (!dir) { if (!dir) {
sway_log(L_ERROR, wlr_log(L_ERROR,
"%s does not exist, sway will have no security configuration" "%s does not exist, sway will have no security configuration"
" and will probably be broken", SYSCONFDIR "/sway/security.d"); " and will probably be broken", SYSCONFDIR "/sway/security.d");
} else { } else {
@ -356,7 +356,7 @@ bool load_main_config(const char *file, bool is_active) {
if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 ||
(((s.st_mode & 0777) != 0644) && (((s.st_mode & 0777) != 0644) &&
(s.st_mode & 0777) != 0444)) { (s.st_mode & 0777) != 0444)) {
sway_log(L_ERROR, wlr_log(L_ERROR,
"Refusing to load %s - it must be owned by root " "Refusing to load %s - it must be owned by root "
"and mode 644 or 444", _path); "and mode 644 or 444", _path);
success = false; success = false;
@ -398,7 +398,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
len = len + strlen(parent_dir) + 2; len = len + strlen(parent_dir) + 2;
full_path = malloc(len * sizeof(char)); full_path = malloc(len * sizeof(char));
if (!full_path) { if (!full_path) {
sway_log(L_ERROR, wlr_log(L_ERROR,
"Unable to allocate full path to included config"); "Unable to allocate full path to included config");
return false; return false;
} }
@ -409,7 +409,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
free(full_path); free(full_path);
if (real_path == NULL) { if (real_path == NULL) {
sway_log(L_DEBUG, "%s not found.", path); wlr_log(L_DEBUG, "%s not found.", path);
return false; return false;
} }
@ -418,7 +418,7 @@ static bool load_include_config(const char *path, const char *parent_dir,
for (j = 0; j < config->config_chain->length; ++j) { for (j = 0; j < config->config_chain->length; ++j) {
char *old_path = config->config_chain->items[j]; char *old_path = config->config_chain->items[j];
if (strcmp(real_path, old_path) == 0) { if (strcmp(real_path, old_path) == 0) {
sway_log(L_DEBUG, wlr_log(L_DEBUG,
"%s already included once, won't be included again.", "%s already included once, won't be included again.",
real_path); real_path);
free(real_path); free(real_path);
@ -472,7 +472,7 @@ bool load_include_configs(const char *path, struct sway_config *config) {
// restore wd // restore wd
if (chdir(wd) < 0) { if (chdir(wd) < 0) {
free(wd); free(wd);
sway_log(L_ERROR, "failed to restore working directory"); wlr_log(L_ERROR, "failed to restore working directory");
return false; return false;
} }
@ -508,13 +508,13 @@ bool read_config(FILE *file, struct sway_config *config) {
switch(res->status) { switch(res->status) {
case CMD_FAILURE: case CMD_FAILURE:
case CMD_INVALID: case CMD_INVALID:
sway_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number, wlr_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number,
line, res->error, config->current_config); line, res->error, config->current_config);
success = false; success = false;
break; break;
case CMD_DEFER: case CMD_DEFER:
sway_log(L_DEBUG, "Deferring command `%s'", line); wlr_log(L_DEBUG, "Deferring command `%s'", line);
list_add(config->cmd_queue, strdup(line)); list_add(config->cmd_queue, strdup(line));
break; break;
@ -522,7 +522,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_MODE; block = CMD_BLOCK_MODE;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -530,7 +530,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_INPUT; block = CMD_BLOCK_INPUT;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -538,7 +538,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_SEAT; block = CMD_BLOCK_SEAT;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -546,7 +546,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_BAR; block = CMD_BLOCK_BAR;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -554,7 +554,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_BAR) { if (block == CMD_BLOCK_BAR) {
block = CMD_BLOCK_BAR_COLORS; block = CMD_BLOCK_BAR_COLORS;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -562,7 +562,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_COMMANDS; block = CMD_BLOCK_COMMANDS;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -570,7 +570,7 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_END) { if (block == CMD_BLOCK_END) {
block = CMD_BLOCK_IPC; block = CMD_BLOCK_IPC;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
@ -578,59 +578,59 @@ bool read_config(FILE *file, struct sway_config *config) {
if (block == CMD_BLOCK_IPC) { if (block == CMD_BLOCK_IPC) {
block = CMD_BLOCK_IPC_EVENTS; block = CMD_BLOCK_IPC_EVENTS;
} else { } else {
sway_log(L_ERROR, "Invalid block '%s'", line); wlr_log(L_ERROR, "Invalid block '%s'", line);
} }
break; break;
case CMD_BLOCK_END: case CMD_BLOCK_END:
switch(block) { switch(block) {
case CMD_BLOCK_MODE: case CMD_BLOCK_MODE:
sway_log(L_DEBUG, "End of mode block"); wlr_log(L_DEBUG, "End of mode block");
config->current_mode = config->modes->items[0]; config->current_mode = config->modes->items[0];
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_INPUT: case CMD_BLOCK_INPUT:
sway_log(L_DEBUG, "End of input block"); wlr_log(L_DEBUG, "End of input block");
free_input_config(current_input_config); free_input_config(current_input_config);
current_input_config = NULL; current_input_config = NULL;
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_SEAT: case CMD_BLOCK_SEAT:
sway_log(L_DEBUG, "End of seat block"); wlr_log(L_DEBUG, "End of seat block");
current_seat_config = NULL; current_seat_config = NULL;
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_BAR: case CMD_BLOCK_BAR:
sway_log(L_DEBUG, "End of bar block"); wlr_log(L_DEBUG, "End of bar block");
config->current_bar = NULL; config->current_bar = NULL;
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_BAR_COLORS: case CMD_BLOCK_BAR_COLORS:
sway_log(L_DEBUG, "End of bar colors block"); wlr_log(L_DEBUG, "End of bar colors block");
block = CMD_BLOCK_BAR; block = CMD_BLOCK_BAR;
break; break;
case CMD_BLOCK_COMMANDS: case CMD_BLOCK_COMMANDS:
sway_log(L_DEBUG, "End of commands block"); wlr_log(L_DEBUG, "End of commands block");
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_IPC: case CMD_BLOCK_IPC:
sway_log(L_DEBUG, "End of IPC block"); wlr_log(L_DEBUG, "End of IPC block");
block = CMD_BLOCK_END; block = CMD_BLOCK_END;
break; break;
case CMD_BLOCK_IPC_EVENTS: case CMD_BLOCK_IPC_EVENTS:
sway_log(L_DEBUG, "End of IPC events block"); wlr_log(L_DEBUG, "End of IPC events block");
block = CMD_BLOCK_IPC; block = CMD_BLOCK_IPC;
break; break;
case CMD_BLOCK_END: case CMD_BLOCK_END:
sway_log(L_ERROR, "Unmatched }"); wlr_log(L_ERROR, "Unmatched }");
break; break;
default:; default:;
@ -663,7 +663,7 @@ char *do_var_replacement(char *str) {
int vvlen = strlen(var->value); int vvlen = strlen(var->value);
char *newstr = malloc(strlen(str) - vnlen + vvlen + 1); char *newstr = malloc(strlen(str) - vnlen + vvlen + 1);
if (!newstr) { if (!newstr) {
sway_log(L_ERROR, wlr_log(L_ERROR,
"Unable to allocate replacement " "Unable to allocate replacement "
"during variable expansion"); "during variable expansion");
break; break;

View File

@ -8,13 +8,13 @@
struct input_config *new_input_config(const char* identifier) { struct input_config *new_input_config(const char* identifier) {
struct input_config *input = calloc(1, sizeof(struct input_config)); struct input_config *input = calloc(1, sizeof(struct input_config));
if (!input) { if (!input) {
sway_log(L_DEBUG, "Unable to allocate input config"); wlr_log(L_DEBUG, "Unable to allocate input config");
return NULL; return NULL;
} }
sway_log(L_DEBUG, "new_input_config(%s)", identifier); wlr_log(L_DEBUG, "new_input_config(%s)", identifier);
if (!(input->identifier = strdup(identifier))) { if (!(input->identifier = strdup(identifier))) {
free(input); free(input);
sway_log(L_DEBUG, "Unable to allocate input config"); wlr_log(L_DEBUG, "Unable to allocate input config");
return NULL; return NULL;
} }

View File

@ -84,7 +84,7 @@ static void set_mode(struct wlr_output *output, int width, int height,
float refresh_rate) { float refresh_rate) {
int mhz = (int)(refresh_rate * 1000); int mhz = (int)(refresh_rate * 1000);
if (wl_list_empty(&output->modes)) { if (wl_list_empty(&output->modes)) {
sway_log(L_DEBUG, "Assigning custom mode to %s", output->name); wlr_log(L_DEBUG, "Assigning custom mode to %s", output->name);
wlr_output_set_custom_mode(output, width, height, mhz); wlr_output_set_custom_mode(output, width, height, mhz);
return; return;
} }
@ -100,9 +100,9 @@ static void set_mode(struct wlr_output *output, int width, int height,
} }
} }
if (!best) { if (!best) {
sway_log(L_ERROR, "Configured mode for %s not available", output->name); wlr_log(L_ERROR, "Configured mode for %s not available", output->name);
} else { } else {
sway_log(L_DEBUG, "Assigning configured mode to %s", output->name); wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name);
wlr_output_set_mode(output, best); wlr_output_set_mode(output, best);
} }
} }
@ -119,22 +119,22 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
} }
if (oc && oc->width > 0 && oc->height > 0) { if (oc && oc->width > 0 && oc->height > 0) {
sway_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, wlr_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width,
oc->height, oc->refresh_rate); oc->height, oc->refresh_rate);
set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate);
} }
if (oc && oc->scale > 0) { if (oc && oc->scale > 0) {
sway_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale); wlr_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale);
wlr_output_set_scale(wlr_output, oc->scale); wlr_output_set_scale(wlr_output, oc->scale);
} }
if (oc && oc->transform >= 0) { if (oc && oc->transform >= 0) {
sway_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform); wlr_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform);
wlr_output_set_transform(wlr_output, oc->transform); wlr_output_set_transform(wlr_output, oc->transform);
} }
// Find position for it // Find position for it
if (oc && (oc->x != -1 || oc->y != -1)) { if (oc && (oc->x != -1 || oc->y != -1)) {
sway_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y);
wlr_output_layout_add(root_container.sway_root->output_layout, wlr_output_layout_add(root_container.sway_root->output_layout,
wlr_output, oc->x, oc->y); wlr_output, oc->x, oc->y);
} else { } else {
@ -165,7 +165,7 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
terminate_swaybg(output->bg_pid); terminate_swaybg(output->bg_pid);
} }
sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); wlr_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background);
size_t bufsize = 12; size_t bufsize = 12;
char output_id[bufsize]; char output_id[bufsize];

View File

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

View File

@ -110,7 +110,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
void output_add_notify(struct wl_listener *listener, void *data) { void output_add_notify(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, output_add); struct sway_server *server = wl_container_of(listener, server, output_add);
struct wlr_output *wlr_output = data; struct wlr_output *wlr_output = data;
sway_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
struct sway_output *output = calloc(1, sizeof(struct sway_output)); struct sway_output *output = calloc(1, sizeof(struct sway_output));
if (!output) { if (!output) {
@ -140,7 +140,7 @@ void output_add_notify(struct wl_listener *listener, void *data) {
void output_remove_notify(struct wl_listener *listener, void *data) { void output_remove_notify(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, output_remove); struct sway_server *server = wl_container_of(listener, server, output_remove);
struct wlr_output *wlr_output = data; struct wlr_output *wlr_output = data;
sway_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);
swayc_t *output_container = NULL; swayc_t *output_container = NULL;
for (int i = 0 ; i < root_container.children->length; ++i) { for (int i = 0 ; i < root_container.children->length; ++i) {

View File

@ -82,7 +82,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
return; return;
} }
sway_log(L_DEBUG, "New wl_shell toplevel title='%s' app_id='%s'", wlr_log(L_DEBUG, "New wl_shell toplevel title='%s' app_id='%s'",
shell_surface->title, shell_surface->class); shell_surface->title, shell_surface->class);
wlr_wl_shell_surface_ping(shell_surface); wlr_wl_shell_surface_ping(shell_surface);

View File

@ -88,7 +88,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
return; return;
} }
sway_log(L_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'", wlr_log(L_DEBUG, "New xdg_shell_v6 toplevel title='%s' app_id='%s'",
xdg_surface->title, xdg_surface->app_id); xdg_surface->title, xdg_surface->app_id);
wlr_xdg_surface_v6_ping(xdg_surface); wlr_xdg_surface_v6_ping(xdg_surface);

View File

@ -124,7 +124,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
return; return;
} }
sway_log(L_DEBUG, "New xwayland surface title='%s' class='%s'", wlr_log(L_DEBUG, "New xwayland surface title='%s' class='%s'",
xsurface->title, xsurface->class); xsurface->title, xsurface->class);
struct sway_xwayland_surface *sway_surface = struct sway_xwayland_surface *sway_surface =

View File

@ -85,35 +85,35 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, touch_down); wl_container_of(listener, cursor, touch_down);
struct wlr_event_touch_down *event = data; struct wlr_event_touch_down *event = data;
sway_log(L_DEBUG, "TODO: handle touch down event: %p", event); wlr_log(L_DEBUG, "TODO: handle touch down event: %p", event);
} }
static void handle_touch_up(struct wl_listener *listener, void *data) { static void handle_touch_up(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, touch_up); wl_container_of(listener, cursor, touch_up);
struct wlr_event_touch_up *event = data; struct wlr_event_touch_up *event = data;
sway_log(L_DEBUG, "TODO: handle touch up event: %p", event); wlr_log(L_DEBUG, "TODO: handle touch up event: %p", event);
} }
static void handle_touch_motion(struct wl_listener *listener, void *data) { static void handle_touch_motion(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, touch_motion); wl_container_of(listener, cursor, touch_motion);
struct wlr_event_touch_motion *event = data; struct wlr_event_touch_motion *event = data;
sway_log(L_DEBUG, "TODO: handle touch motion event: %p", event); wlr_log(L_DEBUG, "TODO: handle touch motion event: %p", event);
} }
static void handle_tool_axis(struct wl_listener *listener, void *data) { static void handle_tool_axis(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, tool_axis); wl_container_of(listener, cursor, tool_axis);
struct wlr_event_tablet_tool_axis *event = data; struct wlr_event_tablet_tool_axis *event = data;
sway_log(L_DEBUG, "TODO: handle tool axis event: %p", event); wlr_log(L_DEBUG, "TODO: handle tool axis event: %p", event);
} }
static void handle_tool_tip(struct wl_listener *listener, void *data) { static void handle_tool_tip(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, tool_tip); wl_container_of(listener, cursor, tool_tip);
struct wlr_event_tablet_tool_tip *event = data; struct wlr_event_tablet_tool_tip *event = data;
sway_log(L_DEBUG, "TODO: handle tool tip event: %p", event); wlr_log(L_DEBUG, "TODO: handle tool tip event: %p", event);
} }
static void handle_request_set_cursor(struct wl_listener *listener, static void handle_request_set_cursor(struct wl_listener *listener,
@ -121,7 +121,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, request_set_cursor); wl_container_of(listener, cursor, request_set_cursor);
struct wlr_seat_pointer_request_set_cursor_event *event = data; struct wlr_seat_pointer_request_set_cursor_event *event = data;
sway_log(L_DEBUG, "TODO: handle request set cursor event: %p", event); wlr_log(L_DEBUG, "TODO: handle request set cursor event: %p", event);
} }
struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { struct sway_cursor *sway_cursor_create(struct sway_seat *seat) {

View File

@ -52,7 +52,7 @@ static char *get_device_identifier(struct wlr_input_device *device) {
int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1; int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
char *identifier = malloc(len); char *identifier = malloc(len);
if (!identifier) { if (!identifier) {
sway_log(L_ERROR, "Unable to allocate unique input device name"); wlr_log(L_ERROR, "Unable to allocate unique input device name");
return NULL; return NULL;
} }
@ -93,60 +93,60 @@ static void sway_input_manager_libinput_config_pointer(struct sway_input_device
} }
libinput_device = wlr_libinput_get_device_handle(wlr_device); libinput_device = wlr_libinput_get_device_handle(wlr_device);
sway_log(L_DEBUG, "sway_input_manager_libinput_config_pointer(%s)", ic->identifier); wlr_log(L_DEBUG, "sway_input_manager_libinput_config_pointer(%s)", ic->identifier);
if (ic->accel_profile != INT_MIN) { if (ic->accel_profile != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
ic->identifier, ic->accel_profile); ic->identifier, ic->accel_profile);
libinput_device_config_accel_set_profile(libinput_device, ic->accel_profile); libinput_device_config_accel_set_profile(libinput_device, ic->accel_profile);
} }
if (ic->click_method != INT_MIN) { if (ic->click_method != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
ic->identifier, ic->click_method); ic->identifier, ic->click_method);
libinput_device_config_click_set_method(libinput_device, ic->click_method); libinput_device_config_click_set_method(libinput_device, ic->click_method);
} }
if (ic->drag_lock != INT_MIN) { if (ic->drag_lock != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
ic->identifier, ic->click_method); ic->identifier, ic->click_method);
libinput_device_config_tap_set_drag_lock_enabled(libinput_device, ic->drag_lock); libinput_device_config_tap_set_drag_lock_enabled(libinput_device, ic->drag_lock);
} }
if (ic->dwt != INT_MIN) { if (ic->dwt != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
ic->identifier, ic->dwt); ic->identifier, ic->dwt);
libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt); libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
} }
if (ic->left_handed != INT_MIN) { if (ic->left_handed != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) left_handed_set_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) left_handed_set_enabled(%d)",
ic->identifier, ic->left_handed); ic->identifier, ic->left_handed);
libinput_device_config_left_handed_set(libinput_device, ic->left_handed); libinput_device_config_left_handed_set(libinput_device, ic->left_handed);
} }
if (ic->middle_emulation != INT_MIN) { if (ic->middle_emulation != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
ic->identifier, ic->middle_emulation); ic->identifier, ic->middle_emulation);
libinput_device_config_middle_emulation_set_enabled(libinput_device, ic->middle_emulation); libinput_device_config_middle_emulation_set_enabled(libinput_device, ic->middle_emulation);
} }
if (ic->natural_scroll != INT_MIN) { if (ic->natural_scroll != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
ic->identifier, ic->natural_scroll); ic->identifier, ic->natural_scroll);
libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, ic->natural_scroll); libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, ic->natural_scroll);
} }
if (ic->pointer_accel != FLT_MIN) { if (ic->pointer_accel != FLT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
ic->identifier, ic->pointer_accel); ic->identifier, ic->pointer_accel);
libinput_device_config_accel_set_speed(libinput_device, ic->pointer_accel); libinput_device_config_accel_set_speed(libinput_device, ic->pointer_accel);
} }
if (ic->scroll_method != INT_MIN) { if (ic->scroll_method != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
ic->identifier, ic->scroll_method); ic->identifier, ic->scroll_method);
libinput_device_config_scroll_set_method(libinput_device, ic->scroll_method); libinput_device_config_scroll_set_method(libinput_device, ic->scroll_method);
} }
if (ic->send_events != INT_MIN) { if (ic->send_events != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
ic->identifier, ic->send_events); ic->identifier, ic->send_events);
libinput_device_config_send_events_set_mode(libinput_device, ic->send_events); libinput_device_config_send_events_set_mode(libinput_device, ic->send_events);
} }
if (ic->tap != INT_MIN) { if (ic->tap != INT_MIN) {
sway_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
ic->identifier, ic->tap); ic->identifier, ic->tap);
libinput_device_config_tap_set_enabled(libinput_device, ic->tap); libinput_device_config_tap_set_enabled(libinput_device, ic->tap);
} }
@ -167,7 +167,7 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
input_device->identifier = get_device_identifier(device); input_device->identifier = get_device_identifier(device);
wl_list_insert(&input->devices, &input_device->link); wl_list_insert(&input->devices, &input_device->link);
sway_log(L_DEBUG, "adding device: '%s'", wlr_log(L_DEBUG, "adding device: '%s'",
input_device->identifier); input_device->identifier);
// find config // find config
@ -185,7 +185,7 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
if (!input_has_seat_configuration(input)) { if (!input_has_seat_configuration(input)) {
sway_log(L_DEBUG, "no seat configuration, using default seat"); wlr_log(L_DEBUG, "no seat configuration, using default seat");
seat = input_manager_get_seat(input, default_seat); seat = input_manager_get_seat(input, default_seat);
sway_seat_add_device(seat, input_device); sway_seat_add_device(seat, input_device);
return; return;
@ -213,7 +213,7 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
} }
if (!added) { if (!added) {
sway_log(L_DEBUG, wlr_log(L_DEBUG,
"device '%s' is not configured on any seats", "device '%s' is not configured on any seats",
input_device->identifier); input_device->identifier);
} }
@ -231,7 +231,7 @@ static void input_remove_notify(struct wl_listener *listener, void *data) {
return; return;
} }
sway_log(L_DEBUG, "removing device: '%s'", wlr_log(L_DEBUG, "removing device: '%s'",
input_device->identifier); input_device->identifier);
struct sway_seat *seat = NULL; struct sway_seat *seat = NULL;
@ -309,7 +309,7 @@ void sway_input_manager_apply_input_config(struct sway_input_manager *input,
void sway_input_manager_apply_seat_config(struct sway_input_manager *input, void sway_input_manager_apply_seat_config(struct sway_input_manager *input,
struct seat_config *seat_config) { struct seat_config *seat_config) {
sway_log(L_DEBUG, "applying new seat config for seat %s", wlr_log(L_DEBUG, "applying new seat config for seat %s",
seat_config->name); seat_config->name);
struct sway_seat *seat = input_manager_get_seat(input, seat_config->name); struct sway_seat *seat = input_manager_get_seat(input, seat_config->name);
if (!seat) { if (!seat) {

View File

@ -90,11 +90,11 @@ static bool binding_matches_key_state(struct sway_binding *binding,
} }
static void binding_execute_command(struct sway_binding *binding) { static void binding_execute_command(struct sway_binding *binding) {
sway_log(L_DEBUG, "running command for binding: %s", wlr_log(L_DEBUG, "running command for binding: %s",
binding->command); binding->command);
struct cmd_results *results = handle_command(binding->command); struct cmd_results *results = handle_command(binding->command);
if (results->status != CMD_SUCCESS) { if (results->status != CMD_SUCCESS) {
sway_log(L_DEBUG, "could not run command for binding: %s", wlr_log(L_DEBUG, "could not run command for binding: %s",
binding->command); binding->command);
} }
free_cmd_results(results); free_cmd_results(results);
@ -467,7 +467,7 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!keymap) { if (!keymap) {
sway_log(L_DEBUG, "cannot configure keyboard: keymap does not exist"); wlr_log(L_DEBUG, "cannot configure keyboard: keymap does not exist");
xkb_context_unref(context); xkb_context_unref(context);
return; return;
} }

View File

@ -112,7 +112,7 @@ void sway_seat_configure_device(struct sway_seat *seat,
case WLR_INPUT_DEVICE_TOUCH: case WLR_INPUT_DEVICE_TOUCH:
case WLR_INPUT_DEVICE_TABLET_PAD: case WLR_INPUT_DEVICE_TABLET_PAD:
case WLR_INPUT_DEVICE_TABLET_TOOL: case WLR_INPUT_DEVICE_TABLET_TOOL:
sway_log(L_DEBUG, "TODO: configure other devices"); wlr_log(L_DEBUG, "TODO: configure other devices");
break; break;
} }
} }
@ -127,11 +127,11 @@ void sway_seat_add_device(struct sway_seat *seat,
struct sway_seat_device *seat_device = struct sway_seat_device *seat_device =
calloc(1, sizeof(struct sway_seat_device)); calloc(1, sizeof(struct sway_seat_device));
if (!seat_device) { if (!seat_device) {
sway_log(L_DEBUG, "could not allocate seat device"); wlr_log(L_DEBUG, "could not allocate seat device");
return; return;
} }
sway_log(L_DEBUG, "adding device %s to seat %s", wlr_log(L_DEBUG, "adding device %s to seat %s",
input_device->identifier, seat->wlr_seat->name); input_device->identifier, seat->wlr_seat->name);
seat_device->sway_seat = seat; seat_device->sway_seat = seat;
@ -150,7 +150,7 @@ void sway_seat_remove_device(struct sway_seat *seat,
return; return;
} }
sway_log(L_DEBUG, "removing device %s from seat %s", wlr_log(L_DEBUG, "removing device %s from seat %s",
input_device->identifier, seat->wlr_seat->name); input_device->identifier, seat->wlr_seat->name);
seat_device_destroy(seat_device); seat_device_destroy(seat_device);

View File

@ -125,32 +125,32 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
int ipc_handle_connection(int fd, uint32_t mask, void *data) { int ipc_handle_connection(int fd, uint32_t mask, void *data) {
(void) fd; (void) fd;
struct sway_server *server = data; struct sway_server *server = data;
sway_log(L_DEBUG, "Event on IPC listening socket"); wlr_log(L_DEBUG, "Event on IPC listening socket");
assert(mask == WL_EVENT_READABLE); assert(mask == WL_EVENT_READABLE);
int client_fd = accept(ipc_socket, NULL, NULL); int client_fd = accept(ipc_socket, NULL, NULL);
if (client_fd == -1) { if (client_fd == -1) {
sway_log_errno(L_ERROR, "Unable to accept IPC client connection"); wlr_log_errno(L_ERROR, "Unable to accept IPC client connection");
return 0; return 0;
} }
int flags; int flags;
if ((flags = fcntl(client_fd, F_GETFD)) == -1 if ((flags = fcntl(client_fd, F_GETFD)) == -1
|| fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) { || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
sway_log_errno(L_ERROR, "Unable to set CLOEXEC on IPC client socket"); wlr_log_errno(L_ERROR, "Unable to set CLOEXEC on IPC client socket");
close(client_fd); close(client_fd);
return 0; return 0;
} }
if ((flags = fcntl(client_fd, F_GETFL)) == -1 if ((flags = fcntl(client_fd, F_GETFL)) == -1
|| fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) { || fcntl(client_fd, F_SETFL, flags|O_NONBLOCK) == -1) {
sway_log_errno(L_ERROR, "Unable to set NONBLOCK on IPC client socket"); wlr_log_errno(L_ERROR, "Unable to set NONBLOCK on IPC client socket");
close(client_fd); close(client_fd);
return 0; return 0;
} }
struct ipc_client *client = malloc(sizeof(struct ipc_client)); struct ipc_client *client = malloc(sizeof(struct ipc_client));
if (!client) { if (!client) {
sway_log(L_ERROR, "Unable to allocate ipc client"); wlr_log(L_ERROR, "Unable to allocate ipc client");
close(client_fd); close(client_fd);
return 0; return 0;
} }
@ -166,12 +166,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
client->write_buffer_len = 0; client->write_buffer_len = 0;
client->write_buffer = malloc(client->write_buffer_size); client->write_buffer = malloc(client->write_buffer_size);
if (!client->write_buffer) { if (!client->write_buffer) {
sway_log(L_ERROR, "Unable to allocate ipc client write buffer"); wlr_log(L_ERROR, "Unable to allocate ipc client write buffer");
close(client_fd); close(client_fd);
return 0; return 0;
} }
sway_log(L_DEBUG, "New client: fd %d", client_fd); wlr_log(L_DEBUG, "New client: fd %d", client_fd);
list_add(ipc_client_list, client); list_add(ipc_client_list, client);
return 0; return 0;
} }
@ -182,22 +182,22 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
struct ipc_client *client = data; struct ipc_client *client = data;
if (mask & WL_EVENT_ERROR) { if (mask & WL_EVENT_ERROR) {
sway_log(L_ERROR, "IPC Client socket error, removing client"); wlr_log(L_ERROR, "IPC Client socket error, removing client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
if (mask & WL_EVENT_HANGUP) { if (mask & WL_EVENT_HANGUP) {
sway_log(L_DEBUG, "Client %d hung up", client->fd); wlr_log(L_DEBUG, "Client %d hung up", client->fd);
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
sway_log(L_DEBUG, "Client %d readable", client->fd); wlr_log(L_DEBUG, "Client %d readable", client->fd);
int read_available; int read_available;
if (ioctl(client_fd, FIONREAD, &read_available) == -1) { if (ioctl(client_fd, FIONREAD, &read_available) == -1) {
sway_log_errno(L_INFO, "Unable to read IPC socket buffer size"); wlr_log_errno(L_INFO, "Unable to read IPC socket buffer size");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
@ -219,13 +219,13 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) {
// Should be fully available, because read_available >= ipc_header_size // Should be fully available, because read_available >= ipc_header_size
ssize_t received = recv(client_fd, buf, ipc_header_size, 0); ssize_t received = recv(client_fd, buf, ipc_header_size, 0);
if (received == -1) { if (received == -1) {
sway_log_errno(L_INFO, "Unable to receive header from IPC client"); wlr_log_errno(L_INFO, "Unable to receive header from IPC client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) { if (memcmp(buf, ipc_magic, sizeof(ipc_magic)) != 0) {
sway_log(L_DEBUG, "IPC header check failed"); wlr_log(L_DEBUG, "IPC header check failed");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
@ -244,13 +244,13 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
struct ipc_client *client = data; struct ipc_client *client = data;
if (mask & WL_EVENT_ERROR) { if (mask & WL_EVENT_ERROR) {
sway_log(L_ERROR, "IPC Client socket error, removing client"); wlr_log(L_ERROR, "IPC Client socket error, removing client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
if (mask & WL_EVENT_HANGUP) { if (mask & WL_EVENT_HANGUP) {
sway_log(L_DEBUG, "Client %d hung up", client->fd); wlr_log(L_DEBUG, "Client %d hung up", client->fd);
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
@ -259,14 +259,14 @@ int ipc_client_handle_writable(int client_fd, uint32_t mask, void *data) {
return 0; return 0;
} }
sway_log(L_DEBUG, "Client %d writable", client->fd); wlr_log(L_DEBUG, "Client %d writable", client->fd);
ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len); ssize_t written = write(client->fd, client->write_buffer, client->write_buffer_len);
if (written == -1 && errno == EAGAIN) { if (written == -1 && errno == EAGAIN) {
return 0; return 0;
} else if (written == -1) { } else if (written == -1) {
sway_log_errno(L_INFO, "Unable to send data from queue to IPC client"); wlr_log_errno(L_INFO, "Unable to send data from queue to IPC client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return 0; return 0;
} }
@ -291,7 +291,7 @@ void ipc_client_disconnect(struct ipc_client *client) {
shutdown(client->fd, SHUT_RDWR); shutdown(client->fd, SHUT_RDWR);
} }
sway_log(L_INFO, "IPC Client %d disconnected", client->fd); wlr_log(L_INFO, "IPC Client %d disconnected", client->fd);
wl_event_source_remove(client->event_source); wl_event_source_remove(client->event_source);
if (client->writable_event_source) { if (client->writable_event_source) {
wl_event_source_remove(client->writable_event_source); wl_event_source_remove(client->writable_event_source);
@ -313,7 +313,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
char *buf = malloc(client->payload_length + 1); char *buf = malloc(client->payload_length + 1);
if (!buf) { if (!buf) {
sway_log_errno(L_INFO, "Unable to allocate IPC payload"); wlr_log_errno(L_INFO, "Unable to allocate IPC payload");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return; return;
} }
@ -322,7 +322,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
ssize_t received = recv(client->fd, buf, client->payload_length, 0); ssize_t received = recv(client->fd, buf, client->payload_length, 0);
if (received == -1) if (received == -1)
{ {
sway_log_errno(L_INFO, "Unable to receive payload from IPC client"); wlr_log_errno(L_INFO, "Unable to receive payload from IPC client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
free(buf); free(buf);
return; return;
@ -393,12 +393,12 @@ void ipc_client_handle_command(struct ipc_client *client) {
} }
default: default:
sway_log(L_INFO, "Unknown IPC command type %i", client->current_command); wlr_log(L_INFO, "Unknown IPC command type %i", client->current_command);
goto exit_cleanup; goto exit_cleanup;
} }
ipc_send_reply(client, error_denied, (uint32_t)strlen(error_denied)); ipc_send_reply(client, error_denied, (uint32_t)strlen(error_denied));
sway_log(L_DEBUG, "Denied IPC client access to %i", client->current_command); wlr_log(L_DEBUG, "Denied IPC client access to %i", client->current_command);
exit_cleanup: exit_cleanup:
client->payload_length = 0; client->payload_length = 0;
@ -422,14 +422,14 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
} }
if (client->write_buffer_size > 4e6) { // 4 MB if (client->write_buffer_size > 4e6) { // 4 MB
sway_log(L_ERROR, "Client write buffer too big, disconnecting client"); wlr_log(L_ERROR, "Client write buffer too big, disconnecting client");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return false; return false;
} }
char *new_buffer = realloc(client->write_buffer, client->write_buffer_size); char *new_buffer = realloc(client->write_buffer, client->write_buffer_size);
if (!new_buffer) { if (!new_buffer) {
sway_log(L_ERROR, "Unable to reallocate ipc client write buffer"); wlr_log(L_ERROR, "Unable to reallocate ipc client write buffer");
ipc_client_disconnect(client); ipc_client_disconnect(client);
return false; return false;
} }
@ -446,6 +446,6 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
ipc_client_handle_writable, client); ipc_client_handle_writable, client);
} }
sway_log(L_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload); wlr_log(L_DEBUG, "Added IPC reply to client %d queue: %s", client->fd, payload);
return true; return true;
} }

View File

@ -92,11 +92,11 @@ swayc_t *new_output(struct sway_output *sway_output) {
if (strcasecmp(name, cur->name) == 0 || if (strcasecmp(name, cur->name) == 0 ||
strcasecmp(identifier, cur->name) == 0) { strcasecmp(identifier, cur->name) == 0) {
sway_log(L_DEBUG, "Matched output config for %s", name); wlr_log(L_DEBUG, "Matched output config for %s", name);
oc = cur; oc = cur;
} }
if (strcasecmp("*", cur->name) == 0) { if (strcasecmp("*", cur->name) == 0) {
sway_log(L_DEBUG, "Matched wildcard output config for %s", name); wlr_log(L_DEBUG, "Matched wildcard output config for %s", name);
all = cur; all = cur;
} }
@ -126,7 +126,7 @@ swayc_t *new_output(struct sway_output *sway_output) {
// Create workspace // Create workspace
char *ws_name = workspace_next_name(output->name); char *ws_name = workspace_next_name(output->name);
sway_log(L_DEBUG, "Creating default workspace %s", ws_name); wlr_log(L_DEBUG, "Creating default workspace %s", ws_name);
new_workspace(output, ws_name); new_workspace(output, ws_name);
free(ws_name); free(ws_name);
return output; return output;
@ -136,7 +136,7 @@ swayc_t *new_workspace(swayc_t *output, const char *name) {
if (!sway_assert(output, "new_workspace called with null output")) { if (!sway_assert(output, "new_workspace called with null output")) {
return NULL; return NULL;
} }
sway_log(L_DEBUG, "Added workspace %s for output %s", name, output->name); wlr_log(L_DEBUG, "Added workspace %s for output %s", name, output->name);
swayc_t *workspace = new_swayc(C_WORKSPACE); swayc_t *workspace = new_swayc(C_WORKSPACE);
workspace->x = output->x; workspace->x = output->x;
@ -159,7 +159,7 @@ swayc_t *new_view(swayc_t *sibling, struct sway_view *sway_view) {
} }
const char *title = sway_view->iface.get_prop(sway_view, VIEW_PROP_TITLE); const char *title = sway_view->iface.get_prop(sway_view, VIEW_PROP_TITLE);
swayc_t *swayc = new_swayc(C_VIEW); swayc_t *swayc = new_swayc(C_VIEW);
sway_log(L_DEBUG, "Adding new view %p:%s to container %p %d", wlr_log(L_DEBUG, "Adding new view %p:%s to container %p %d",
swayc, title, sibling, sibling ? sibling->type : 0); swayc, title, sibling, sibling ? sibling->type : 0);
// Setup values // Setup values
swayc->sway_view = sway_view; swayc->sway_view = sway_view;
@ -200,7 +200,7 @@ swayc_t *destroy_output(swayc_t *output) {
} }
} }
sway_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
free_swayc(output); free_swayc(output);
return &root_container; return &root_container;
@ -210,7 +210,7 @@ swayc_t *destroy_view(swayc_t *view) {
if (!sway_assert(view, "null view passed to destroy_view")) { if (!sway_assert(view, "null view passed to destroy_view")) {
return NULL; return NULL;
} }
sway_log(L_DEBUG, "Destroying view '%s'", view->name); wlr_log(L_DEBUG, "Destroying view '%s'", view->name);
swayc_t *parent = view->parent; swayc_t *parent = view->parent;
free_swayc(view); free_swayc(view);

View File

@ -59,7 +59,7 @@ void init_layout(void) {
} }
void add_child(swayc_t *parent, swayc_t *child) { void add_child(swayc_t *parent, swayc_t *child) {
sway_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
child, child->type, child->width, child->height, child, child->type, child->width, child->height,
parent, parent->type, parent->width, parent->height); parent, parent->type, parent->width, parent->height);
list_add(parent->children, child); list_add(parent->children, child);
@ -145,7 +145,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
width = floor(width); width = floor(width);
height = floor(height); height = floor(height);
sway_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container, wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container,
container->name, container->width, container->height, container->x, container->name, container->width, container->height, container->x,
container->y); container->y);
@ -155,7 +155,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
// TODO: wlr_output_layout probably // TODO: wlr_output_layout probably
for (i = 0; i < container->children->length; ++i) { for (i = 0; i < container->children->length; ++i) {
swayc_t *output = container->children->items[i]; swayc_t *output = container->children->items[i];
sway_log(L_DEBUG, "Arranging output '%s' at %f,%f", wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
output->name, output->x, output->y); output->name, output->x, output->y);
arrange_windows(output, -1, -1); arrange_windows(output, -1, -1);
} }
@ -181,7 +181,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
container->height = output->height; container->height = output->height;
container->x = x; container->x = x;
container->y = y; container->y = y;
sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", wlr_log(L_DEBUG, "Arranging workspace '%s' at %f, %f",
container->name, container->x, container->y); container->name, container->x, container->y);
} }
// children are properly handled below // children are properly handled below
@ -192,7 +192,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
container->height = height; container->height = height;
container->sway_view->iface.set_size(container->sway_view, container->sway_view->iface.set_size(container->sway_view,
container->width, container->height); container->width, container->height);
sway_log(L_DEBUG, "Set view to %.f x %.f @ %.f, %.f", wlr_log(L_DEBUG, "Set view to %.f x %.f @ %.f, %.f",
container->width, container->height, container->width, container->height,
container->x, container->y); container->x, container->y);
} }
@ -215,7 +215,7 @@ void arrange_windows(swayc_t *container, double width, double height) {
container->children->length); container->children->length);
break; break;
default: default:
sway_log(L_DEBUG, "TODO: arrange layout type %d", container->layout); wlr_log(L_DEBUG, "TODO: arrange layout type %d", container->layout);
apply_horiz_layout(container, x, y, width, height, 0, apply_horiz_layout(container, x, y, width, height, 0,
container->children->length); container->children->length);
break; break;
@ -244,10 +244,10 @@ static void apply_horiz_layout(swayc_t *container,
// Resize windows // Resize windows
double child_x = x; double child_x = x;
if (scale > 0.1) { if (scale > 0.1) {
sway_log(L_DEBUG, "Arranging %p horizontally", container); wlr_log(L_DEBUG, "Arranging %p horizontally", container);
for (int i = start; i < end; ++i) { for (int i = start; i < end; ++i) {
swayc_t *child = container->children->items[i]; swayc_t *child = container->children->items[i];
sway_log(L_DEBUG, wlr_log(L_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)", "Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, width, scale); child, child->type, width, scale);
child->sway_view->iface.set_position(child->sway_view, child_x, y); child->sway_view->iface.set_position(child->sway_view, child_x, y);
@ -294,10 +294,10 @@ void apply_vert_layout(swayc_t *container,
// Resize // Resize
double child_y = y; double child_y = y;
if (scale > 0.1) { if (scale > 0.1) {
sway_log(L_DEBUG, "Arranging %p vertically", container); wlr_log(L_DEBUG, "Arranging %p vertically", container);
for (i = start; i < end; ++i) { for (i = start; i < end; ++i) {
swayc_t *child = container->children->items[i]; swayc_t *child = container->children->items[i];
sway_log(L_DEBUG, wlr_log(L_DEBUG,
"Calculating arrangement for %p:%d (will scale %f by %f)", "Calculating arrangement for %p:%d (will scale %f by %f)",
child, child->type, height, scale); child, child->type, height, scale);
child->sway_view->iface.set_position(child->sway_view, x, child_y); child->sway_view->iface.set_position(child->sway_view, x, child_y);

View File

@ -11,7 +11,7 @@ void next_name_map(swayc_t *ws, void *data) {
} }
char *workspace_next_name(const char *output_name) { char *workspace_next_name(const char *output_name) {
sway_log(L_DEBUG, "Workspace: Generating new workspace name for output %s", wlr_log(L_DEBUG, "Workspace: Generating new workspace name for output %s",
output_name); output_name);
int count = 0; int count = 0;
next_name_map(&root_container, &count); next_name_map(&root_container, &count);