diff options
author | M Stoeckl <code@mstoeckl.com> | 2019-01-20 13:51:12 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-01-21 12:59:42 +0100 |
commit | 1211a81aad18bbc4d9e8fb9973238ad8e7e1f688 (patch) | |
tree | 5c3f60e0219cb8b4a1b7cafb760a871661866e32 /sway/tree/workspace.c | |
parent | Log libinput_config_status errors (diff) | |
download | sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.gz sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.tar.zst sway-1211a81aad18bbc4d9e8fb9973238ad8e7e1f688.zip |
Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.
wlr_log_init is still invoked in sway/main.c
This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 7f18046d..e89c0849 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -69,12 +69,12 @@ struct sway_workspace *workspace_create(struct sway_output *output, | |||
69 | output = workspace_get_initial_output(name); | 69 | output = workspace_get_initial_output(name); |
70 | } | 70 | } |
71 | 71 | ||
72 | wlr_log(WLR_DEBUG, "Adding workspace %s for output %s", name, | 72 | sway_log(SWAY_DEBUG, "Adding workspace %s for output %s", name, |
73 | output->wlr_output->name); | 73 | output->wlr_output->name); |
74 | 74 | ||
75 | struct sway_workspace *ws = calloc(1, sizeof(struct sway_workspace)); | 75 | struct sway_workspace *ws = calloc(1, sizeof(struct sway_workspace)); |
76 | if (!ws) { | 76 | if (!ws) { |
77 | wlr_log(WLR_ERROR, "Unable to allocate sway_workspace"); | 77 | sway_log(SWAY_ERROR, "Unable to allocate sway_workspace"); |
78 | return NULL; | 78 | return NULL; |
79 | } | 79 | } |
80 | node_init(&ws->node, N_WORKSPACE, ws); | 80 | node_init(&ws->node, N_WORKSPACE, ws); |
@@ -152,7 +152,7 @@ void workspace_destroy(struct sway_workspace *workspace) { | |||
152 | } | 152 | } |
153 | 153 | ||
154 | void workspace_begin_destroy(struct sway_workspace *workspace) { | 154 | void workspace_begin_destroy(struct sway_workspace *workspace) { |
155 | wlr_log(WLR_DEBUG, "Destroying workspace '%s'", workspace->name); | 155 | sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name); |
156 | ipc_event_workspace(NULL, workspace, "empty"); // intentional | 156 | ipc_event_workspace(NULL, workspace, "empty"); // intentional |
157 | wl_signal_emit(&workspace->node.events.destroy, &workspace->node); | 157 | wl_signal_emit(&workspace->node.events.destroy, &workspace->node); |
158 | 158 | ||
@@ -223,7 +223,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, | |||
223 | char *_target = strdup(name); | 223 | char *_target = strdup(name); |
224 | _target = do_var_replacement(_target); | 224 | _target = do_var_replacement(_target); |
225 | strip_quotes(_target); | 225 | strip_quotes(_target); |
226 | wlr_log(WLR_DEBUG, "Got valid workspace command for target: '%s'", | 226 | sway_log(SWAY_DEBUG, "Got valid workspace command for target: '%s'", |
227 | _target); | 227 | _target); |
228 | 228 | ||
229 | // Make sure that the command references an actual workspace | 229 | // Make sure that the command references an actual workspace |
@@ -248,7 +248,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, | |||
248 | temp[length - 1] = '\0'; | 248 | temp[length - 1] = '\0'; |
249 | free(_target); | 249 | free(_target); |
250 | _target = temp; | 250 | _target = temp; |
251 | wlr_log(WLR_DEBUG, "Isolated name from workspace number: '%s'", _target); | 251 | sway_log(SWAY_DEBUG, "Isolated name from workspace number: '%s'", _target); |
252 | 252 | ||
253 | // Make sure the workspace number doesn't already exist | 253 | // Make sure the workspace number doesn't already exist |
254 | if (isdigit(_target[0]) && workspace_by_number(_target)) { | 254 | if (isdigit(_target[0]) && workspace_by_number(_target)) { |
@@ -277,7 +277,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, | |||
277 | *min_order = binding->order; | 277 | *min_order = binding->order; |
278 | free(*earliest_name); | 278 | free(*earliest_name); |
279 | *earliest_name = _target; | 279 | *earliest_name = _target; |
280 | wlr_log(WLR_DEBUG, "Workspace: Found free name %s", _target); | 280 | sway_log(SWAY_DEBUG, "Workspace: Found free name %s", _target); |
281 | } else { | 281 | } else { |
282 | free(_target); | 282 | free(_target); |
283 | } | 283 | } |
@@ -286,7 +286,7 @@ static void workspace_name_from_binding(const struct sway_binding * binding, | |||
286 | } | 286 | } |
287 | 287 | ||
288 | char *workspace_next_name(const char *output_name) { | 288 | char *workspace_next_name(const char *output_name) { |
289 | wlr_log(WLR_DEBUG, "Workspace: Generating new workspace name for output %s", | 289 | sway_log(SWAY_DEBUG, "Workspace: Generating new workspace name for output %s", |
290 | output_name); | 290 | output_name); |
291 | // Scan for available workspace names by looking through output-workspace | 291 | // Scan for available workspace names by looking through output-workspace |
292 | // assignments primarily, falling back to bindings and numbers. | 292 | // assignments primarily, falling back to bindings and numbers. |
@@ -468,13 +468,13 @@ bool workspace_switch(struct sway_workspace *workspace, | |||
468 | free(seat->prev_workspace_name); | 468 | free(seat->prev_workspace_name); |
469 | seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); | 469 | seat->prev_workspace_name = malloc(strlen(active_ws->name) + 1); |
470 | if (!seat->prev_workspace_name) { | 470 | if (!seat->prev_workspace_name) { |
471 | wlr_log(WLR_ERROR, "Unable to allocate previous workspace name"); | 471 | sway_log(SWAY_ERROR, "Unable to allocate previous workspace name"); |
472 | return false; | 472 | return false; |
473 | } | 473 | } |
474 | strcpy(seat->prev_workspace_name, active_ws->name); | 474 | strcpy(seat->prev_workspace_name, active_ws->name); |
475 | } | 475 | } |
476 | 476 | ||
477 | wlr_log(WLR_DEBUG, "Switching to workspace %p:%s", | 477 | sway_log(SWAY_DEBUG, "Switching to workspace %p:%s", |
478 | workspace, workspace->name); | 478 | workspace, workspace->name); |
479 | struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); | 479 | struct sway_node *next = seat_get_focus_inactive(seat, &workspace->node); |
480 | if (next == NULL) { | 480 | if (next == NULL) { |