diff options
Diffstat (limited to 'include/sway/commands.h')
-rw-r--r-- | include/sway/commands.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index b2255c4b..6e2395bd 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -3,6 +3,13 @@ | |||
3 | 3 | ||
4 | #include "config.h" | 4 | #include "config.h" |
5 | 5 | ||
6 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | ||
7 | |||
8 | struct cmd_handler { | ||
9 | char *command; | ||
10 | sway_cmd *handle; | ||
11 | }; | ||
12 | |||
6 | /** | 13 | /** |
7 | * Indicates the result of a command's execution. | 14 | * Indicates the result of a command's execution. |
8 | */ | 15 | */ |
@@ -11,16 +18,9 @@ enum cmd_status { | |||
11 | CMD_FAILURE, /**< The command resulted in an error */ | 18 | CMD_FAILURE, /**< The command resulted in an error */ |
12 | CMD_INVALID, /**< Unknown command or parser error */ | 19 | CMD_INVALID, /**< Unknown command or parser error */ |
13 | CMD_DEFER, /**< Command execution deferred */ | 20 | CMD_DEFER, /**< Command execution deferred */ |
14 | // Config Blocks | 21 | CMD_BLOCK, |
15 | CMD_BLOCK_END, | ||
16 | CMD_BLOCK_MODE, | ||
17 | CMD_BLOCK_BAR, | ||
18 | CMD_BLOCK_BAR_COLORS, | ||
19 | CMD_BLOCK_INPUT, | ||
20 | CMD_BLOCK_SEAT, | ||
21 | CMD_BLOCK_COMMANDS, | 22 | CMD_BLOCK_COMMANDS, |
22 | CMD_BLOCK_IPC, | 23 | CMD_BLOCK_END |
23 | CMD_BLOCK_IPC_EVENTS, | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | /** | 26 | /** |
@@ -45,6 +45,8 @@ enum expected_args { | |||
45 | struct cmd_results *checkarg(int argc, const char *name, | 45 | struct cmd_results *checkarg(int argc, const char *name, |
46 | enum expected_args type, int val); | 46 | enum expected_args type, int val); |
47 | 47 | ||
48 | struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, | ||
49 | int handlers_size); | ||
48 | /** | 50 | /** |
49 | * Parse and executes a command. | 51 | * Parse and executes a command. |
50 | */ | 52 | */ |
@@ -54,7 +56,12 @@ struct cmd_results *execute_command(char *command, struct sway_seat *seat); | |||
54 | * | 56 | * |
55 | * Do not use this under normal conditions. | 57 | * Do not use this under normal conditions. |
56 | */ | 58 | */ |
57 | struct cmd_results *config_command(char *command, enum cmd_status block); | 59 | struct cmd_results *config_command(char *command); |
60 | /** | ||
61 | * Parse and handle a sub command | ||
62 | */ | ||
63 | struct cmd_results *subcommand(char **argv, int argc, | ||
64 | struct cmd_handler *handlers, int handlers_size); | ||
58 | /* | 65 | /* |
59 | * Parses a command policy rule. | 66 | * Parses a command policy rule. |
60 | */ | 67 | */ |
@@ -77,8 +84,6 @@ const char *cmd_results_to_json(struct cmd_results *results); | |||
77 | struct cmd_results *add_color(const char *name, | 84 | struct cmd_results *add_color(const char *name, |
78 | char *buffer, const char *color); | 85 | char *buffer, const char *color); |
79 | 86 | ||
80 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | ||
81 | |||
82 | sway_cmd cmd_assign; | 87 | sway_cmd cmd_assign; |
83 | sway_cmd cmd_bar; | 88 | sway_cmd cmd_bar; |
84 | sway_cmd cmd_bindcode; | 89 | sway_cmd cmd_bindcode; |