2018-07-14 07:01:47 +02:00
|
|
|
#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;
|
|
|
|
}
|
2018-09-24 01:56:52 +02:00
|
|
|
struct input_config *ic = config->handler_context.input_config;
|
|
|
|
if (!ic) {
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
2018-07-14 07:01:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strcasecmp(argv[0], "lrm") == 0) {
|
2018-09-24 01:56:52 +02:00
|
|
|
ic->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
2018-07-14 07:01:47 +02:00
|
|
|
} else if (strcasecmp(argv[0], "lmr") == 0) {
|
2018-09-24 01:56:52 +02:00
|
|
|
ic->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
|
2018-07-14 07:01:47 +02:00
|
|
|
} else {
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_INVALID,
|
2018-07-14 07:01:47 +02:00
|
|
|
"Expected 'tap_button_map <lrm|lmr>'");
|
|
|
|
}
|
|
|
|
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
2018-07-14 07:01:47 +02:00
|
|
|
}
|