diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-14 11:44:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-14 11:44:18 -0500 |
commit | 15cd8b6a86295a445a1037afd0028b1226a14c82 (patch) | |
tree | 56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/input/map_from_region.c | |
parent | Merge pull request #3418 from RyanDwyer/remove-resize-axis (diff) | |
parent | Remove now-unused "input" argument of cmd_results_new (diff) | |
download | sway-15cd8b6a86295a445a1037afd0028b1226a14c82.tar.gz sway-15cd8b6a86295a445a1037afd0028b1226a14c82.tar.zst sway-15cd8b6a86295a445a1037afd0028b1226a14c82.zip |
Merge pull request #3403 from mstoeckl/ipcleanup
Remove 'input' field of IPC command return json
Diffstat (limited to 'sway/commands/input/map_from_region.c')
-rw-r--r-- | sway/commands/input/map_from_region.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sway/commands/input/map_from_region.c b/sway/commands/input/map_from_region.c index 53608a67..de00b714 100644 --- a/sway/commands/input/map_from_region.c +++ b/sway/commands/input/map_from_region.c | |||
@@ -40,8 +40,7 @@ struct cmd_results *input_cmd_map_from_region(int argc, char **argv) { | |||
40 | } | 40 | } |
41 | struct input_config *ic = config->handler_context.input_config; | 41 | struct input_config *ic = config->handler_context.input_config; |
42 | if (!ic) { | 42 | if (!ic) { |
43 | return cmd_results_new(CMD_FAILURE, "map_from_region", | 43 | return cmd_results_new(CMD_FAILURE, "No input device defined"); |
44 | "No input device defined"); | ||
45 | } | 44 | } |
46 | 45 | ||
47 | ic->mapped_from_region = | 46 | ic->mapped_from_region = |
@@ -52,30 +51,27 @@ struct cmd_results *input_cmd_map_from_region(int argc, char **argv) { | |||
52 | &ic->mapped_from_region->y1, &mm1)) { | 51 | &ic->mapped_from_region->y1, &mm1)) { |
53 | free(ic->mapped_from_region); | 52 | free(ic->mapped_from_region); |
54 | ic->mapped_from_region = NULL; | 53 | ic->mapped_from_region = NULL; |
55 | return cmd_results_new(CMD_FAILURE, "map_from_region", | 54 | return cmd_results_new(CMD_FAILURE, "Invalid top-left coordinates"); |
56 | "Invalid top-left coordinates"); | ||
57 | } | 55 | } |
58 | if (!parse_coords(argv[1], &ic->mapped_from_region->x2, | 56 | if (!parse_coords(argv[1], &ic->mapped_from_region->x2, |
59 | &ic->mapped_from_region->y2, &mm2)) { | 57 | &ic->mapped_from_region->y2, &mm2)) { |
60 | free(ic->mapped_from_region); | 58 | free(ic->mapped_from_region); |
61 | ic->mapped_from_region = NULL; | 59 | ic->mapped_from_region = NULL; |
62 | return cmd_results_new(CMD_FAILURE, "map_from_region", | 60 | return cmd_results_new(CMD_FAILURE, "Invalid bottom-right coordinates"); |
63 | "Invalid bottom-right coordinates"); | ||
64 | } | 61 | } |
65 | if (ic->mapped_from_region->x1 > ic->mapped_from_region->x2 || | 62 | if (ic->mapped_from_region->x1 > ic->mapped_from_region->x2 || |
66 | ic->mapped_from_region->y1 > ic->mapped_from_region->y2) { | 63 | ic->mapped_from_region->y1 > ic->mapped_from_region->y2) { |
67 | free(ic->mapped_from_region); | 64 | free(ic->mapped_from_region); |
68 | ic->mapped_from_region = NULL; | 65 | ic->mapped_from_region = NULL; |
69 | return cmd_results_new(CMD_FAILURE, "map_from_region", | 66 | return cmd_results_new(CMD_FAILURE, "Invalid rectangle"); |
70 | "Invalid rectangle"); | ||
71 | } | 67 | } |
72 | if (mm1 != mm2) { | 68 | if (mm1 != mm2) { |
73 | free(ic->mapped_from_region); | 69 | free(ic->mapped_from_region); |
74 | ic->mapped_from_region = NULL; | 70 | ic->mapped_from_region = NULL; |
75 | return cmd_results_new(CMD_FAILURE, "map_from_region", | 71 | return cmd_results_new(CMD_FAILURE, |
76 | "Both coordinates must be in the same unit"); | 72 | "Both coordinates must be in the same unit"); |
77 | } | 73 | } |
78 | ic->mapped_from_region->mm = mm1; | 74 | ic->mapped_from_region->mm = mm1; |
79 | 75 | ||
80 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 76 | return cmd_results_new(CMD_SUCCESS, NULL); |
81 | } | 77 | } |