diff options
author | 2015-10-23 10:34:38 -0400 | |
---|---|---|
committer | 2015-10-23 10:34:38 -0400 | |
commit | 988a0bd67e02755308b478d369a3825c712a842e (patch) | |
tree | c29db67ec97907448084a36909c1e51d74cd8eaf /include | |
parent | Merge pull request #200 from sce/fix_seamless_transitions (diff) | |
parent | commands: cmd_results->input is duplicated/freed. (diff) | |
download | sway-988a0bd67e02755308b478d369a3825c712a842e.tar.gz sway-988a0bd67e02755308b478d369a3825c712a842e.tar.zst sway-988a0bd67e02755308b478d369a3825c712a842e.zip |
Merge pull request #201 from sce/cmd_results
Replace cmd_status with cmd_results struct
Diffstat (limited to 'include')
-rw-r--r-- | include/commands.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/commands.h b/include/commands.h index 1b4cd9ca..8e53c74d 100644 --- a/include/commands.h +++ b/include/commands.h | |||
@@ -1,22 +1,33 @@ | |||
1 | #ifndef _SWAY_COMMANDS_H | 1 | #ifndef _SWAY_COMMANDS_H |
2 | #define _SWAY_COMMANDS_H | 2 | #define _SWAY_COMMANDS_H |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <json-c/json.h> | ||
4 | #include "config.h" | 5 | #include "config.h" |
5 | 6 | ||
6 | 7 | ||
7 | enum cmd_status { | 8 | enum cmd_status { |
8 | CMD_SUCCESS, | 9 | CMD_SUCCESS, |
9 | CMD_FAILURE, | 10 | CMD_FAILURE, // was or at least could be executed |
10 | CMD_INVALID, | 11 | CMD_INVALID, // unknown or parse error |
11 | CMD_DEFER, | 12 | CMD_DEFER, |
12 | // Config Blocks | 13 | // Config Blocks |
13 | CMD_BLOCK_END, | 14 | CMD_BLOCK_END, |
14 | CMD_BLOCK_MODE, | 15 | CMD_BLOCK_MODE, |
15 | }; | 16 | }; |
16 | 17 | ||
17 | enum cmd_status handle_command(char *command); | 18 | struct cmd_results { |
19 | enum cmd_status status; | ||
20 | char *input; | ||
21 | char *error; | ||
22 | }; | ||
23 | |||
24 | struct cmd_results *handle_command(char *command); | ||
18 | // Handles commands during config | 25 | // Handles commands during config |
19 | enum cmd_status config_command(char *command); | 26 | struct cmd_results *config_command(char *command); |
27 | |||
28 | struct cmd_results *cmd_results_new(enum cmd_status status, const char* input, const char *error, ...); | ||
29 | void free_cmd_results(struct cmd_results *results); | ||
30 | const char *cmd_results_to_json(struct cmd_results *results); | ||
20 | 31 | ||
21 | void remove_view_from_scratchpad(); | 32 | void remove_view_from_scratchpad(); |
22 | 33 | ||