diff options
author | Simon Ser <contact@emersion.fr> | 2020-02-10 18:25:24 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-02-17 21:47:36 +0100 |
commit | a5a4d32816a050fc213246008f3951b463b8c4e5 (patch) | |
tree | 71811b9ffa198693a612ffd814be3fc5bbd93551 /sway/commands/output | |
parent | 8b593677d262b9018d2bcb9093f03fbccb38c43b (diff) |
Fix output transform anticlockwise
This wouldn't have any effect if the transform was flipped.
Diffstat (limited to 'sway/commands/output')
-rw-r--r-- | sway/commands/output/transform.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sway/commands/output/transform.c b/sway/commands/output/transform.c index 8e5324ad..2a3d1d4b 100644 --- a/sway/commands/output/transform.c +++ b/sway/commands/output/transform.c @@ -4,6 +4,22 @@ #include "log.h" #include "sway/output.h" +static enum wl_output_transform invert_rotation_direction( + enum wl_output_transform t) { + switch (t) { + case WL_OUTPUT_TRANSFORM_90: + return WL_OUTPUT_TRANSFORM_270; + case WL_OUTPUT_TRANSFORM_270: + return WL_OUTPUT_TRANSFORM_90; + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + return WL_OUTPUT_TRANSFORM_FLIPPED_270; + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + return WL_OUTPUT_TRANSFORM_FLIPPED_90; + default: + return t; + } +} + struct cmd_results *output_cmd_transform(int argc, char **argv) { if (!config->handler_context.output_config) { return cmd_results_new(CMD_FAILURE, "Missing output config"); @@ -11,6 +27,7 @@ struct cmd_results *output_cmd_transform(int argc, char **argv) { if (!argc) { return cmd_results_new(CMD_INVALID, "Missing transform argument."); } + enum wl_output_transform transform; if (strcmp(*argv, "normal") == 0 || strcmp(*argv, "0") == 0) { @@ -32,6 +49,7 @@ struct cmd_results *output_cmd_transform(int argc, char **argv) { } else { return cmd_results_new(CMD_INVALID, "Invalid output transform."); } + struct output_config *output = config->handler_context.output_config; config->handler_context.leftovers.argc = argc - 1; config->handler_context.leftovers.argv = argv + 1; @@ -50,13 +68,14 @@ struct cmd_results *output_cmd_transform(int argc, char **argv) { "Cannot apply relative transform to unknown output %s", output->name); } if (strcmp(argv[1], "anticlockwise") == 0) { - transform = wlr_output_transform_invert(transform); + transform = invert_rotation_direction(transform); } struct wlr_output *w_output = s_output->wlr_output; transform = wlr_output_transform_compose(w_output->transform, transform); config->handler_context.leftovers.argv += 1; config->handler_context.leftovers.argc -= 1; } + output->transform = transform; return NULL; } |