diff options
-rw-r--r-- | conf/pro1_mouse.conf | 4 | ||||
-rw-r--r-- | include/relabsd/device/axis_types.h | 5 | ||||
-rw-r--r-- | src/config/parameters/handle_remote_client_commands.c | 17 | ||||
-rw-r--r-- | src/config/parameters/parameters.c | 10 | ||||
-rw-r--r-- | src/device/axis/axis_filter.c | 5 | ||||
-rw-r--r-- | src/device/axis/axis_option.c | 6 |
6 files changed, 37 insertions, 10 deletions
diff --git a/conf/pro1_mouse.conf b/conf/pro1_mouse.conf index 6fe718e..82dab38 100644 --- a/conf/pro1_mouse.conf +++ b/conf/pro1_mouse.conf @@ -1,4 +1,4 @@ # Pro1 mouse, just rename axis # AXIS MIN MAX FUZZ FLAT RESOLUTION OPTIONS -X 0 0 0 0 0 notabs,convert_to=Y -Y 0 0 0 0 0 notabs,convert_to=X +X 0 0 0 0 0 not_abs,convert_to=Y +Y 0 0 0 0 0 not_abs,invert,convert_to=X diff --git a/include/relabsd/device/axis_types.h b/include/relabsd/device/axis_types.h index 20ed44c..f6a1207 100644 --- a/include/relabsd/device/axis_types.h +++ b/include/relabsd/device/axis_types.h @@ -2,7 +2,7 @@ /* Number of axes that can be configured. */ #define RELABSD_AXIS_VALID_AXES_COUNT 8 -#define RELABSD_AXIS_FLAGS_COUNT 4 +#define RELABSD_AXIS_FLAGS_COUNT 5 /* * C enumerations are always int, and the standard does specify that it starts @@ -27,7 +27,8 @@ enum relabsd_axis_flag RELABSD_DIRECT, RELABSD_REAL_FUZZ, RELABSD_FRAMED, - RELABSD_NOT_ABS + RELABSD_NOT_ABS, + RELABSD_INVERT }; struct relabsd_axis diff --git a/src/config/parameters/handle_remote_client_commands.c b/src/config/parameters/handle_remote_client_commands.c index caa82dc..95830c7 100644 --- a/src/config/parameters/handle_remote_client_commands.c +++ b/src/config/parameters/handle_remote_client_commands.c @@ -366,10 +366,27 @@ static int handle_option_toggle { parameters->axes[axis_name].flags[RELABSD_REAL_FUZZ] ^= 1; } + else if (RELABSD_STRING_EQUALS("invert", input->buffer)) + { + parameters->axes[axis_name].flags[RELABSD_INVERT] ^= 1; + } + else if (RELABSD_STRING_EQUALS("not_abs", input->buffer)) + { + parameters->axes[axis_name].flags[RELABSD_NOT_ABS] ^= 1; + } else if (RELABSD_STRING_EQUALS("enable", input->buffer)) { parameters->axes[axis_name].is_enabled ^= 1; } + else if (RELABSD_IS_PREFIX("convert_to=", input->buffer)) + { + relabsd_axis_enable_option_from_name + ( + input->buffer, + relabsd_axis_name_to_string(axis_name), + (parameters->axes + axis_name) + ); + } else { RELABSD_ERROR diff --git a/src/config/parameters/parameters.c b/src/config/parameters/parameters.c index cee6f2e..d9a3d46 100644 --- a/src/config/parameters/parameters.c +++ b/src/config/parameters/parameters.c @@ -320,7 +320,7 @@ int relabsd_parameters_parse_options RELABSD_STRING_EQUALS("-m", argv[i]) || RELABSD_STRING_EQUALS("--mod-axis", argv[i]) || RELABSD_STRING_EQUALS("-o", argv[i]) - || RELABSD_STRING_EQUALS("--toggle-argv[i]", argv[i]) + || RELABSD_STRING_EQUALS("--toggle-option", argv[i]) ||RELABSD_STRING_EQUALS("-q", argv[i]) || RELABSD_STRING_EQUALS("--quit", argv[i]) ) @@ -460,13 +460,13 @@ void relabsd_parameters_print_usage (const char exec [const restrict static 1]) "\t[-q | --quit]\n" "\t\tTerminates the targeted server instance.\n\n" - "\t[-m | --mod-axis] <axis_name> [min|max|fuzz|flat|resolution]" - " [+|-|=]<value>\n" + "\t[-m | --mod-axis] <axis_name> " + "[min|max|fuzz|flat|resolution] [+|-|=]<value>\n" "\t\tModifies an axis.\n\n" "\t[-o | --toggle-option] <axis_name> " - "[direct|real_fuzz|framed|enable|convert_to=<axis_name>]\n" - "\t\tToggles an axis option.\n", + "[direct|real_fuzz|framed|enable|invert|not_abs|convert_to=<axis_name>]\n" + "\t\tToggles or sets an axis option.\n", exec, exec, exec, diff --git a/src/device/axis/axis_filter.c b/src/device/axis/axis_filter.c index 6258ad9..d7840ca 100644 --- a/src/device/axis/axis_filter.c +++ b/src/device/axis/axis_filter.c @@ -122,6 +122,11 @@ int relabsd_axis_filter_new_value return 0; } + if (axis->flags[RELABSD_INVERT]) + { + *value = -(*value); + } + if (axis->flags[RELABSD_NOT_ABS]) { return 1; diff --git a/src/device/axis/axis_option.c b/src/device/axis/axis_option.c index 7796eb7..e8d06f5 100644 --- a/src/device/axis/axis_option.c +++ b/src/device/axis/axis_option.c @@ -57,10 +57,14 @@ int relabsd_axis_enable_option_from_name ); } } - else if (RELABSD_IS_PREFIX("notabs", option_name)) + else if (RELABSD_IS_PREFIX("not_abs", option_name)) { axis->flags[RELABSD_NOT_ABS] = 1; } + else if (RELABSD_IS_PREFIX("invert", option_name)) + { + axis->flags[RELABSD_INVERT] = 1; + } else if (RELABSD_IS_PREFIX("convert_to=", option_name)) { axis->convert_to = |