From 2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 Mon Sep 17 00:00:00 2001 From: M Stoeckl Date: Thu, 10 Jan 2019 18:27:21 -0500 Subject: Remove now-unused "input" argument of cmd_results_new Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors. --- sway/commands/focus.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'sway/commands/focus.c') diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 97ffe91c..8564f3ff 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -179,17 +179,17 @@ static struct cmd_results *focus_mode(struct sway_workspace *ws, seat_set_focus_container(seat, new_focus); seat_consider_warp_to_focus(seat); } else { - return cmd_results_new(CMD_FAILURE, "focus", + return cmd_results_new(CMD_FAILURE, "Failed to find a %s container in workspace", floating ? "floating" : "tiling"); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } static struct cmd_results *focus_output(struct sway_seat *seat, int argc, char **argv) { if (!argc) { - return cmd_results_new(CMD_INVALID, "focus", + return cmd_results_new(CMD_INVALID, "Expected 'focus output '"); } char *identifier = join_args(argv, argc); @@ -199,7 +199,7 @@ static struct cmd_results *focus_output(struct sway_seat *seat, enum wlr_direction direction; if (!parse_direction(identifier, &direction)) { free(identifier); - return cmd_results_new(CMD_INVALID, "focus", + return cmd_results_new(CMD_INVALID, "There is no output with that name"); } struct sway_workspace *ws = seat_get_focused_workspace(seat); @@ -223,21 +223,21 @@ static struct cmd_results *focus_output(struct sway_seat *seat, seat_consider_warp_to_focus(seat); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } static struct cmd_results *focus_parent(void) { struct sway_seat *seat = config->handler_context.seat; struct sway_container *con = config->handler_context.container; if (!con || con->is_fullscreen) { - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } struct sway_node *parent = node_get_parent(&con->node); if (parent) { seat_set_focus(seat, parent); seat_consider_warp_to_focus(seat); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } static struct cmd_results *focus_child(void) { @@ -248,15 +248,15 @@ static struct cmd_results *focus_child(void) { seat_set_focus(seat, focus); seat_consider_warp_to_focus(seat); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } struct cmd_results *cmd_focus(int argc, char **argv) { if (config->reading || !config->active) { - return cmd_results_new(CMD_DEFER, NULL, NULL); + return cmd_results_new(CMD_DEFER, NULL); } if (!root->outputs->length) { - return cmd_results_new(CMD_INVALID, "focus", + return cmd_results_new(CMD_INVALID, "Can't run this command while there's no outputs connected."); } struct sway_node *node = config->handler_context.node; @@ -264,7 +264,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { struct sway_workspace *workspace = config->handler_context.workspace; struct sway_seat *seat = config->handler_context.seat; if (node->type < N_WORKSPACE) { - return cmd_results_new(CMD_FAILURE, "focus", + return cmd_results_new(CMD_FAILURE, "Command 'focus' cannot be used above the workspace level"); } @@ -274,7 +274,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { } seat_set_focus_container(seat, container); seat_consider_warp_to_focus(seat); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } if (strcmp(argv[0], "floating") == 0) { @@ -300,7 +300,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { enum wlr_direction direction = 0; if (!parse_direction(argv[0], &direction)) { - return cmd_results_new(CMD_INVALID, "focus", + return cmd_results_new(CMD_INVALID, "Expected 'focus ' " "or 'focus output '"); } @@ -310,14 +310,14 @@ struct cmd_results *cmd_focus(int argc, char **argv) { struct sway_output *new_output = output_get_in_direction(workspace->output, direction); if (!new_output) { - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } struct sway_node *node = get_node_in_output_direction(new_output, direction); seat_set_focus(seat, node); seat_consider_warp_to_focus(seat); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } struct sway_node *next_focus = @@ -327,5 +327,5 @@ struct cmd_results *cmd_focus(int argc, char **argv) { seat_consider_warp_to_focus(seat); } - return cmd_results_new(CMD_SUCCESS, NULL, NULL); + return cmd_results_new(CMD_SUCCESS, NULL); } -- cgit v1.2.3-54-g00ecf