mirror of
https://github.com/X11Libre/xf86-input-joystick.git
synced 2026-03-24 01:34:06 +00:00
Removed "amplifier" axis option
Added amplifier as factor to the "axis" option Updated manpage
This commit is contained in:
@@ -48,6 +48,18 @@ This joystick button won't do anything.
|
||||
.TP 7
|
||||
.BI "\*qbutton="<number> \*q
|
||||
The joystick button will generate a click with the specified button (starting with 1).
|
||||
.TP 7
|
||||
.BI "\*qaxis="[<factor>]<axis> \*q
|
||||
Where
|
||||
.I <axis>
|
||||
is one of:
|
||||
.B X, Y, ZX, ZY
|
||||
|
||||
and
|
||||
.I <factor>
|
||||
is an optional amplifier of the axis, like
|
||||
.B -, +, -5, 0.4, 1.3, ...
|
||||
Use positive and negative values to control the direction. Default: 1.0
|
||||
.RE
|
||||
.PP
|
||||
.TP 7
|
||||
@@ -62,12 +74,17 @@ may be one of:
|
||||
|
||||
.B relative, accelerated, absolute
|
||||
.TP 7
|
||||
.BI "\*qaxis="<string> \*q
|
||||
.BI "\*qaxis="[<factor>]<axis> \*q
|
||||
Where
|
||||
.I <string>
|
||||
.I <axis>
|
||||
is one of:
|
||||
|
||||
.B X, Y, ZX, ZY
|
||||
|
||||
and
|
||||
.I <factor>
|
||||
is an optional amplifier of the axis, like
|
||||
.B -, +, -5, 0.4, 1.3, ...
|
||||
Negative values will invert the movement. Default: 1.0
|
||||
.TP 7
|
||||
.BI "\*qdeadzone="<number> \*q
|
||||
Sets the unresponsive range of the axis to
|
||||
@@ -75,15 +92,6 @@ Sets the unresponsive range of the axis to
|
||||
This can be between
|
||||
.IR "0" " and " "30000" .
|
||||
Default: 10
|
||||
.TP 7
|
||||
.BI "\*qamplify="<number> \*q
|
||||
Amplifies the influence of the axis. To make cursor movement slower, set to value
|
||||
.IR \<1.0 .
|
||||
To make it faster, set to value
|
||||
.IR \>1.0 .
|
||||
To invert movement direction, set to a
|
||||
.IR "negative value" .
|
||||
Default: 1.0
|
||||
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
|
||||
@@ -26,35 +26,30 @@
|
||||
#include "jstk_options.h"
|
||||
|
||||
|
||||
static BOOL
|
||||
jstkGetButtonAxis(struct BUTTON *button, char* param, const char* name) {
|
||||
/* param can be:
|
||||
static enum JOYSTICKMAPPING
|
||||
jstkGetAxisMapping(float *value, char* param, const char* name) {
|
||||
/* param can be like:
|
||||
x
|
||||
+x
|
||||
-x
|
||||
+y
|
||||
-zx
|
||||
3x
|
||||
3.5x
|
||||
3.5zy
|
||||
-8x */
|
||||
float value;
|
||||
button->mapping = MAPPING_NONE;
|
||||
if (sscanf(param, "%f", &value)==0) {
|
||||
value = 1.0;
|
||||
if (sscanf(param, "%f", value)==0) {
|
||||
*value = 1.0;
|
||||
if (param[0]=='-')
|
||||
value = -1.0;
|
||||
*value = -1.0;
|
||||
}
|
||||
if (strstr(param, "zx") != NULL)
|
||||
button->mapping = MAPPING_ZX;
|
||||
return MAPPING_ZX;
|
||||
else if (strstr(param, "zy") != NULL)
|
||||
button->mapping = MAPPING_ZY;
|
||||
return MAPPING_ZY;
|
||||
else if (strstr(param, "x") != NULL)
|
||||
button->mapping = MAPPING_X;
|
||||
return MAPPING_X;
|
||||
else if (strstr(param, "y") != NULL)
|
||||
button->mapping = MAPPING_Y;
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
button->value = (int)(value*1000.0);
|
||||
return TRUE;
|
||||
return MAPPING_Y;
|
||||
|
||||
return MAPPING_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -75,7 +70,10 @@ jstkParseButtonOption(const char* org,
|
||||
button->mapping = MAPPING_BUTTON;
|
||||
button->value = value;
|
||||
} else if (sscanf(param, "axis=%15s", p) == 1) {
|
||||
if (jstkGetButtonAxis(button, p, name) == FALSE)
|
||||
float value;
|
||||
button->mapping = jstkGetAxisMapping(&value, p, name);
|
||||
button->value = (int)(value*1000.0);
|
||||
if (button->mapping == MAPPING_NONE)
|
||||
xf86Msg(X_WARNING, "%s: error parsing axis: %s.\n",
|
||||
name, p);
|
||||
} else {
|
||||
@@ -116,18 +114,11 @@ jstkParseAxisOption(const char* org, struct AXIS *axis, const char *name) {
|
||||
if ((tmp=strstr(param, "axis=")) != NULL) {
|
||||
if (sscanf(tmp, "axis=%15s", p) == 1) {
|
||||
p[15]='\0';
|
||||
if (strcmp(p, "x") == 0)
|
||||
axis->mapping = MAPPING_X;
|
||||
else if (strcmp(p, "y") == 0)
|
||||
axis->mapping = MAPPING_Y;
|
||||
else if (strcmp(p, "zx") == 0)
|
||||
axis->mapping = MAPPING_ZX;
|
||||
else if (strcmp(p, "zy") == 0)
|
||||
axis->mapping = MAPPING_ZY;
|
||||
else {
|
||||
xf86Msg(X_WARNING, "%s: error parsing axis.\n",
|
||||
name);
|
||||
}
|
||||
axis->mapping = jstkGetAxisMapping(&fvalue, p, name);
|
||||
axis->amplify = fvalue;
|
||||
if (axis->mapping == MAPPING_NONE)
|
||||
xf86Msg(X_WARNING, "%s: error parsing axis: %s.\n",
|
||||
name, p);
|
||||
}else xf86Msg(X_WARNING, "%s: error parsing axis.\n",
|
||||
name);
|
||||
}
|
||||
@@ -143,16 +134,6 @@ jstkParseAxisOption(const char* org, struct AXIS *axis, const char *name) {
|
||||
}else xf86Msg(X_WARNING, "%s: error parsing deadzone.\n",
|
||||
name);
|
||||
}
|
||||
if ((tmp=strstr(param, "amplify=")) != NULL ) {
|
||||
if (sscanf(tmp, "amplify=%f", &fvalue) == 1) {
|
||||
if ((fvalue > 10000)||(fvalue < -10000.0))
|
||||
xf86Msg(X_WARNING,
|
||||
"%s: amplifier of %.3f seems unreasonable. Ignored.\n",
|
||||
name, fvalue);
|
||||
else axis->amplify = fvalue;
|
||||
}else xf86Msg(X_WARNING, "%s: error parsing amplifier.\n",
|
||||
name);
|
||||
}
|
||||
|
||||
xfree(param);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user