diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-12-20 13:02:45 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-12-20 19:55:29 +0100 |
commit | 88d96bc41ff638bdc767e30bf6ccbbd530258420 (patch) | |
tree | 5d822da99812aab4e849e566c53d3a6ba87ba496 /sway/commands | |
parent | 477bca5e288cc3155c536265272490b413328778 (diff) |
Combine output_by_name and output_by_identifier
This combines `output_by_name` and `output_by_identifier` into a single
function called `output_by_name_or_id`. This allows for output
identifiers to be used in all commands, simplifies the logic of the
callers, and is more efficient since worst case is a single pass through
the output list.
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/focus.c | 2 | ||||
-rw-r--r-- | sway/commands/move.c | 2 | ||||
-rw-r--r-- | sway/commands/output/transform.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 689edfec..97ffe91c 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -193,7 +193,7 @@ static struct cmd_results *focus_output(struct sway_seat *seat, "Expected 'focus output <direction|name>'"); } char *identifier = join_args(argv, argc); - struct sway_output *output = output_by_name(identifier); + struct sway_output *output = output_by_name_or_id(identifier); if (!output) { enum wlr_direction direction; diff --git a/sway/commands/move.c b/sway/commands/move.c index 4dc547db..09f19c3f 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -64,7 +64,7 @@ static struct sway_output *output_in_direction(const char *direction_string, } } - return output_by_name(direction_string); + return output_by_name_or_id(direction_string); } static bool is_parallel(enum sway_container_layout layout, diff --git a/sway/commands/output/transform.c b/sway/commands/output/transform.c index c1555323..ca6f73a4 100644 --- a/sway/commands/output/transform.c +++ b/sway/commands/output/transform.c @@ -45,7 +45,7 @@ struct cmd_results *output_cmd_transform(int argc, char **argv) { return cmd_results_new(CMD_INVALID, "output", "Cannot apply relative transform to all outputs."); } - struct sway_output *s_output = output_by_name(output->name); + struct sway_output *s_output = output_by_name_or_id(output->name); if (s_output == NULL) { return cmd_results_new(CMD_INVALID, "output", "Cannot apply relative transform to unknown output %s", output->name); |