diff options
Diffstat (limited to 'sway/commands/input')
-rw-r--r-- | sway/commands/input/events.c | 2 | ||||
-rw-r--r-- | sway/commands/input/scroll_button.c | 44 | ||||
-rw-r--r-- | sway/commands/input/tap.c | 2 | ||||
-rw-r--r-- | sway/commands/input/tap_button_map.c | 33 | ||||
-rw-r--r-- | sway/commands/input/xkb_layout.c | 2 | ||||
-rw-r--r-- | sway/commands/input/xkb_model.c | 2 | ||||
-rw-r--r-- | sway/commands/input/xkb_options.c | 2 | ||||
-rw-r--r-- | sway/commands/input/xkb_rules.c | 2 | ||||
-rw-r--r-- | sway/commands/input/xkb_variant.c | 2 |
9 files changed, 84 insertions, 7 deletions
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c index e2ccdc94..abfe3b12 100644 --- a/sway/commands/input/events.c +++ b/sway/commands/input/events.c @@ -16,7 +16,7 @@ struct cmd_results *input_cmd_events(int argc, char **argv) { return cmd_results_new(CMD_FAILURE, "events", "No input device defined."); } - wlr_log(L_DEBUG, "events for device: %s", + wlr_log(WLR_DEBUG, "events for device: %s", current_input_config->identifier); struct input_config *new_config = new_input_config(current_input_config->identifier); diff --git a/sway/commands/input/scroll_button.c b/sway/commands/input/scroll_button.c new file mode 100644 index 00000000..350fcca2 --- /dev/null +++ b/sway/commands/input/scroll_button.c @@ -0,0 +1,44 @@ +#include <string.h> +#include <strings.h> +#include <errno.h> +#include "sway/config.h" +#include "sway/commands.h" +#include "sway/input/input-manager.h" + +struct cmd_results *input_cmd_scroll_button(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "scroll_button", EXPECTED_AT_LEAST, 1))) { + return error; + } + struct input_config *current_input_config = + config->handler_context.input_config; + if (!current_input_config) { + return cmd_results_new(CMD_FAILURE, "scroll_button", + "No input device defined."); + } + struct input_config *new_config = + new_input_config(current_input_config->identifier); + + errno = 0; + char *endptr; + int scroll_button = strtol(*argv, &endptr, 10); + if (endptr == *argv && scroll_button == 0) { + free_input_config(new_config); + return cmd_results_new(CMD_INVALID, "scroll_button", + "Scroll button identifier must be an integer."); + } + if (errno == ERANGE) { + free_input_config(new_config); + return cmd_results_new(CMD_INVALID, "scroll_button", + "Scroll button identifier out of range."); + } + if (scroll_button < 0) { + free_input_config(new_config); + return cmd_results_new(CMD_INVALID, "scroll_button", + "Scroll button identifier cannot be negative."); + } + new_config->scroll_button = scroll_button; + + apply_input_config(new_config); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} diff --git a/sway/commands/input/tap.c b/sway/commands/input/tap.c index 7d027d5d..a8d1a10c 100644 --- a/sway/commands/input/tap.c +++ b/sway/commands/input/tap.c @@ -28,7 +28,7 @@ struct cmd_results *input_cmd_tap(int argc, char **argv) { "Expected 'tap <enabled|disabled>'"); } - wlr_log(L_DEBUG, "apply-tap for device: %s", + wlr_log(WLR_DEBUG, "apply-tap for device: %s", current_input_config->identifier); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/input/tap_button_map.c b/sway/commands/input/tap_button_map.c new file mode 100644 index 00000000..bdbba472 --- /dev/null +++ b/sway/commands/input/tap_button_map.c @@ -0,0 +1,33 @@ +#include <string.h> +#include <strings.h> +#include "sway/config.h" +#include "sway/commands.h" +#include "sway/input/input-manager.h" + +struct cmd_results *input_cmd_tap_button_map(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "tap_button_map", EXPECTED_AT_LEAST, 1))) { + return error; + } + struct input_config *current_input_config = + config->handler_context.input_config; + if (!current_input_config) { + return cmd_results_new(CMD_FAILURE, "tap_button_map", + "No input device defined."); + } + struct input_config *new_config = + new_input_config(current_input_config->identifier); + + if (strcasecmp(argv[0], "lrm") == 0) { + new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; + } else if (strcasecmp(argv[0], "lmr") == 0) { + new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR; + } else { + free_input_config(new_config); + return cmd_results_new(CMD_INVALID, "tap_button_map", + "Expected 'tap_button_map <lrm|lmr>'"); + } + + apply_input_config(new_config); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} diff --git a/sway/commands/input/xkb_layout.c b/sway/commands/input/xkb_layout.c index 867e65d3..9fa5a344 100644 --- a/sway/commands/input/xkb_layout.c +++ b/sway/commands/input/xkb_layout.c @@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_layout(int argc, char **argv) { new_config->xkb_layout = strdup(argv[0]); - wlr_log(L_DEBUG, "apply-xkb_layout for device: %s layout: %s", + wlr_log(WLR_DEBUG, "apply-xkb_layout for device: %s layout: %s", current_input_config->identifier, new_config->xkb_layout); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/input/xkb_model.c b/sway/commands/input/xkb_model.c index e8c8e04e..0d082625 100644 --- a/sway/commands/input/xkb_model.c +++ b/sway/commands/input/xkb_model.c @@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_model(int argc, char **argv) { new_config->xkb_model = strdup(argv[0]); - wlr_log(L_DEBUG, "apply-xkb_model for device: %s model: %s", + wlr_log(WLR_DEBUG, "apply-xkb_model for device: %s model: %s", current_input_config->identifier, new_config->xkb_model); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/input/xkb_options.c b/sway/commands/input/xkb_options.c index e9ddd6e3..3059d941 100644 --- a/sway/commands/input/xkb_options.c +++ b/sway/commands/input/xkb_options.c @@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_options(int argc, char **argv) { new_config->xkb_options = strdup(argv[0]); - wlr_log(L_DEBUG, "apply-xkb_options for device: %s options: %s", + wlr_log(WLR_DEBUG, "apply-xkb_options for device: %s options: %s", current_input_config->identifier, new_config->xkb_options); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/input/xkb_rules.c b/sway/commands/input/xkb_rules.c index 926d0ac1..560f088e 100644 --- a/sway/commands/input/xkb_rules.c +++ b/sway/commands/input/xkb_rules.c @@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_rules(int argc, char **argv) { new_config->xkb_rules = strdup(argv[0]); - wlr_log(L_DEBUG, "apply-xkb_rules for device: %s rules: %s", + wlr_log(WLR_DEBUG, "apply-xkb_rules for device: %s rules: %s", current_input_config->identifier, new_config->xkb_rules); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/input/xkb_variant.c b/sway/commands/input/xkb_variant.c index 0e3ffd41..0aa03440 100644 --- a/sway/commands/input/xkb_variant.c +++ b/sway/commands/input/xkb_variant.c @@ -19,7 +19,7 @@ struct cmd_results *input_cmd_xkb_variant(int argc, char **argv) { new_config->xkb_variant = strdup(argv[0]); - wlr_log(L_DEBUG, "apply-xkb_variant for device: %s variant: %s", + wlr_log(WLR_DEBUG, "apply-xkb_variant for device: %s variant: %s", current_input_config->identifier, new_config->xkb_variant); apply_input_config(new_config); return cmd_results_new(CMD_SUCCESS, NULL, NULL); |