replace tabs by whitespace

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-12-19 15:55:37 +01:00
parent 643aebbbc3
commit 5b8ddc8c56
9 changed files with 126 additions and 129 deletions

View File

@@ -47,7 +47,7 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 25.0.0] xproto inputproto kbproto)
# -----------------------------------------------------------------------------
# Configuration options
# Configuration options
# -----------------------------------------------------------------------------
# Define a configure option for an alternate input module directory
PKG_PROG_PKG_CONFIG([0.25])
@@ -69,7 +69,7 @@ fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
# -----------------------------------------------------------------------------
# Determine which joystick backend to build
# Determine which joystick backend to build
# -----------------------------------------------------------------------------
linux_backend=yes
AC_CHECK_HEADERS([linux/joystick.h],, [linux_backend=no])

View File

@@ -175,7 +175,7 @@ jstkOpenDevice_bsd(JoystickDevPtr joystick, Bool probe)
memcpy(&bsddata->button_item[joystick->num_buttons], &h, sizeof(h));
joystick->num_buttons++;
}
}
}
}
hid_end_parse(d);

View File

@@ -189,7 +189,7 @@ jstkOpenDevice_evdev(JoystickDevPtr joystick, Bool probe)
if (probe == TRUE) {
xf86Msg(X_INFO, "Joystick: %s. bus 0x%x vendor 0x%x product 0x%x version 0x%x\n",
name, id.bustype, id.vendor, id.product, id.version);
name, id.bustype, id.vendor, id.product, id.version);
xf86Msg(X_INFO, "Joystick: found %d axes, %d buttons\n", axes, buttons);
}
@@ -278,29 +278,29 @@ jstkReadData_evdev(JoystickDevPtr joystick,
struct jstk_evdev_axis_data *axis;
axis = &data->axis[iev.code];
if ((axis->number >= 0) && (axis->number < MAXAXES)) {
/* NOTE: controllers report totally different ranges:
* - 0..256, with a center of 127 (Logitech Dual Action axes)
* - 0..256 with a center of 0 (XBox left/right triggers)
* - -32768..32768 with a center of 0 (XBox axes)
*
* These ranges will ALL be scaled to -32768..32768, with
* the center value to be assumed 0. This is for compatibility
* with the legacy joystick module, which reports values in
* the same range.
*
* The value is also important for the deadzone, which can be
* configured by the user and is in -32768..32768 range.
*
* TODO: how to respect center value, so that that XBox triggers
* and logitech axes report idle, when not moved?
* TODO: report all values as -1.0f..1.0f, but this would possibly
* break config file semantics.
*/
/* NOTE: controllers report totally different ranges:
* - 0..256, with a center of 127 (Logitech Dual Action axes)
* - 0..256 with a center of 0 (XBox left/right triggers)
* - -32768..32768 with a center of 0 (XBox axes)
*
* These ranges will ALL be scaled to -32768..32768, with
* the center value to be assumed 0. This is for compatibility
* with the legacy joystick module, which reports values in
* the same range.
*
* The value is also important for the deadzone, which can be
* configured by the user and is in -32768..32768 range.
*
* TODO: how to respect center value, so that that XBox triggers
* and logitech axes report idle, when not moved?
* TODO: report all values as -1.0f..1.0f, but this would possibly
* break config file semantics.
*/
float v = (float) iev.value;
v = (v - (float)axis->min) * 65535.0f
/ (axis->max - axis->min) - 32768.0f;
value = (int) v;
float v = (float) iev.value;
v = (v - (float)axis->min) * 65535.0f
/ (axis->max - axis->min) - 32768.0f;
value = (int) v;
if (abs(value) < joystick->axis[axis->number].deadzone) {
/* We only want one event when in deadzone */

View File

@@ -30,7 +30,7 @@
#include <misc.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
#include <xf86Opt.h>
#include <xf86_OSproc.h>
@@ -413,7 +413,7 @@ jstkDeviceControlProc(DeviceIntPtr pJstk,
xf86MotionHistoryAllocate(pInfo);
}
jstkInitProperties(pJstk, priv);
jstkInitProperties(pJstk, priv);
break;
}
@@ -668,21 +668,21 @@ jstkCoreUnInit(InputDriverPtr drv,
int flags)
{
if (pInfo->private) {
JoystickDevPtr priv = (JoystickDevPtr) pInfo->private;
if (priv->keyboard_device == pInfo) {
/* this is the keyboard device */
/* Unlink from private data to notify that the
* keyboard device is no more, but don't free */
priv->keyboard_device = NULL;
} else {
/* freeing main device
if keyboard still exists, notify keyboard device that it's
private data is gone */
if (priv->keyboard_device)
priv->keyboard_device->private = NULL;
JoystickDevPtr priv = (JoystickDevPtr) pInfo->private;
if (priv->keyboard_device == pInfo) {
/* this is the keyboard device */
/* Unlink from private data to notify that the
* keyboard device is no more, but don't free */
priv->keyboard_device = NULL;
} else {
/* freeing main device
if keyboard still exists, notify keyboard device that it's
private data is gone */
if (priv->keyboard_device)
priv->keyboard_device->private = NULL;
free (priv);
}
free (priv);
}
}
pInfo->private = NULL;

View File

@@ -77,58 +77,58 @@ jstkAxisTimer(OsTimerPtr timer,
/* Calculate scale value, so we get a range from 0 to 32768 */
scale = (32768.0f / (float)(32768 - axis->deadzone));
/* NOTE: joysticks with a rectangular field have a
* corner position of (32768,32768), joysticks with a
* circular field have (23170,23170).
*
* make sure that diagonal movement feels fast. either:
* 1) linear
*
* f(32768) ~= f(23170) + f(23170)
* f(32768) ~= a * f(23170)
* a = 2.0
*
* on circular joysticks, the time needed for xy movement is
* exactly the time needed for x + the time for y separately.
* absolute diagonal travel speed (in cm/s) is 0.707 times as fast,
* which feels pretty slow.
*
* on square joysticks, diagonal travel speed is always 1.41 times
* faster than orthogonal travel speed. time needed for diagonal
* movement is always 0.5 times as long as for orthogonal movement.
*
* the value of a = 2.0 results in a nice, non-linear acceleration.
*
* or
* 2) trigonometric
*
* f(32768) ~= sqrt(f(23170)^2 + f(23170)^2))
* f(32768) ~= a * f(23170)
* a = 1.414
*
* on circular joysticks, the absolute pointer travel speed
* (in cm/s) is now the same for both linear and diagonal movement,
* which feels natural. moving diagonally takes 0.707 times the time
* of moving orthogonally.
*
* on square joysticks, values are as in 1)
*
* the value of a = 1.414 results in linear acceleration, which feels
* too slow.
*
* to maintain non-linear acceleration, make sure that:
*
* a >>= 1.414
*
* the following formula achieves results in between,
* so it should feel natural on both devices while maintaining a
* nice acceleration:
*
* f(32768) ~= 1.620 * f(23170)
*
* TODO: make this simpler by using only values -1.0..1.0 and
* provide acceleration graphs.
*/
/* NOTE: joysticks with a rectangular field have a
* corner position of (32768,32768), joysticks with a
* circular field have (23170,23170).
*
* make sure that diagonal movement feels fast. either:
* 1) linear
*
* f(32768) ~= f(23170) + f(23170)
* f(32768) ~= a * f(23170)
* a = 2.0
*
* on circular joysticks, the time needed for xy movement is
* exactly the time needed for x + the time for y separately.
* absolute diagonal travel speed (in cm/s) is 0.707 times as fast,
* which feels pretty slow.
*
* on square joysticks, diagonal travel speed is always 1.41 times
* faster than orthogonal travel speed. time needed for diagonal
* movement is always 0.5 times as long as for orthogonal movement.
*
* the value of a = 2.0 results in a nice, non-linear acceleration.
*
* or
* 2) trigonometric
*
* f(32768) ~= sqrt(f(23170)^2 + f(23170)^2))
* f(32768) ~= a * f(23170)
* a = 1.414
*
* on circular joysticks, the absolute pointer travel speed
* (in cm/s) is now the same for both linear and diagonal movement,
* which feels natural. moving diagonally takes 0.707 times the time
* of moving orthogonally.
*
* on square joysticks, values are as in 1)
*
* the value of a = 1.414 results in linear acceleration, which feels
* too slow.
*
* to maintain non-linear acceleration, make sure that:
*
* a >>= 1.414
*
* the following formula achieves results in between,
* so it should feel natural on both devices while maintaining a
* nice acceleration:
*
* f(32768) ~= 1.620 * f(23170)
*
* TODO: make this simpler by using only values -1.0..1.0 and
* provide acceleration graphs.
*/
/* How many pixels should this axis move the cursor */
p1 = (pow((abs((float)axis->value) - (float)axis->deadzone) *
@@ -402,7 +402,7 @@ jstkHandleAbsoluteAxis(InputInfoPtr device, int number)
float rel;
int dif;
rel = 0.0f;
rel = 0.0f;
if (priv->axis[i].value > +priv->axis[i].deadzone)
rel = (priv->axis[i].value - priv->axis[i].deadzone);
if (priv->axis[i].value < -priv->axis[i].deadzone)
@@ -435,10 +435,6 @@ jstkHandleAbsoluteAxis(InputInfoPtr device, int number)
}
}
/***********************************************************************
*
* jstkPWMAxisTimer --

View File

@@ -38,11 +38,11 @@
#define MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2
#define AltMask Mod1Mask
#define NumLockMask Mod2Mask
#define AltLangMask Mod3Mask
#define KanaMask Mod4Mask
#define ScrollLockMask Mod5Mask
#define AltMask Mod1Mask
#define NumLockMask Mod2Mask
#define AltLangMask Mod3Mask
#define KanaMask Mod4Mask
#define ScrollLockMask Mod5Mask
static void
jstkKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
@@ -221,23 +221,23 @@ int jstkKeyboardPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
priv->rmlvo.rules = xf86SetStrOption(pInfo->options, "xkb_rules", NULL);
if (!priv->rmlvo.rules)
priv->rmlvo.rules = xf86SetStrOption(pInfo->options, "XkbRules", "evdev");
priv->rmlvo.rules = xf86SetStrOption(pInfo->options, "XkbRules", "evdev");
priv->rmlvo.model = xf86SetStrOption(pInfo->options, "xkb_model", NULL);
if (!priv->rmlvo.model)
priv->rmlvo.model = xf86SetStrOption(pInfo->options, "XkbModel", "evdev");
priv->rmlvo.model = xf86SetStrOption(pInfo->options, "XkbModel", "evdev");
priv->rmlvo.layout = xf86SetStrOption(pInfo->options, "xkb_layout", NULL);
if (!priv->rmlvo.layout)
priv->rmlvo.layout = xf86SetStrOption(pInfo->options, "XkbLayout", "us");
priv->rmlvo.layout = xf86SetStrOption(pInfo->options, "XkbLayout", "us");
priv->rmlvo.variant = xf86SetStrOption(pInfo->options, "xkb_variant", NULL);
if (!priv->rmlvo.variant)
priv->rmlvo.variant = xf86SetStrOption(pInfo->options, "XkbVariant", "");
priv->rmlvo.variant = xf86SetStrOption(pInfo->options, "XkbVariant", "");
priv->rmlvo.options = xf86SetStrOption(pInfo->options, "xkb_options", NULL);
if (!priv->rmlvo.options)
priv->rmlvo.options = xf86SetStrOption(pInfo->options, "XkbOptions", "");
priv->rmlvo.options = xf86SetStrOption(pInfo->options, "XkbOptions", "");
return Success;
}

View File

@@ -31,4 +31,5 @@ int jstkKeyboardPreInit(InputDriverPtr pInfo, InputInfoPtr dev, int flags);
void jstkKeyboardUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
Bool jstkKeyboardDeviceControlProc(DeviceIntPtr dev, int what);
InputInfoPtr jstkKeyboardHotplug(InputInfoPtr dev, int flags);
#endif

View File

@@ -232,7 +232,7 @@ jstkParseAxisOption(const char* org,
for (value = 0; value < MAXKEYSPERBUTTON; value++)
if (current != NULL) {
next = strchr(current, ',');
if (!next) next = strchr(current, '+');
if (!next) next = strchr(current, '+');
if (next) *(next++) = '\0';
key = strtol(current, NULL, 0);

View File

@@ -286,11 +286,11 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
float_type = XIGetKnownProperty(XATOM_FLOAT);
if (!float_type) {
float_type = MakeAtom(XATOM_FLOAT, strlen(XATOM_FLOAT), TRUE);
if (!float_type) {
xf86Msg(X_WARNING, "%s: Failed to init float atom. "
"Disabling support for float properties.\n", pJstk->name);
}
float_type = MakeAtom(XATOM_FLOAT, strlen(XATOM_FLOAT), TRUE);
if (!float_type) {
xf86Msg(X_WARNING, "%s: Failed to init float atom. "
"Disabling support for float properties.\n", pJstk->name);
}
}
@@ -370,13 +370,13 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
/* priv->axis[].amplify */
if (float_type) {
for (i=0;i<priv->num_axes;i++)
axes_floats[i] = priv->axis[i].amplify;
prop_axis_amplify = MakeAtom(JSTK_PROP_AXIS_AMPLIFY, strlen(JSTK_PROP_AXIS_AMPLIFY), TRUE);
XIChangeDeviceProperty(pJstk, prop_axis_amplify, float_type, 32,
PropModeReplace, priv->num_axes, axes_floats,
FALSE);
XISetDevicePropertyDeletable(pJstk, prop_axis_amplify, FALSE);
for (i=0;i<priv->num_axes;i++)
axes_floats[i] = priv->axis[i].amplify;
prop_axis_amplify = MakeAtom(JSTK_PROP_AXIS_AMPLIFY, strlen(JSTK_PROP_AXIS_AMPLIFY), TRUE);
XIChangeDeviceProperty(pJstk, prop_axis_amplify, float_type, 32,
PropModeReplace, priv->num_axes, axes_floats,
FALSE);
XISetDevicePropertyDeletable(pJstk, prop_axis_amplify, FALSE);
}
/* priv->axis[].keys_low */
@@ -428,13 +428,13 @@ jstkInitProperties(DeviceIntPtr pJstk, JoystickDevPtr priv)
/* priv->button[].amplify */
if (float_type) {
for (i=0;i<priv->num_buttons;i++)
button_floats[i] = priv->button[i].amplify;
prop_button_amplify = MakeAtom(JSTK_PROP_BUTTON_AMPLIFY, strlen(JSTK_PROP_BUTTON_AMPLIFY), TRUE);
XIChangeDeviceProperty(pJstk, prop_button_amplify, float_type, 32,
PropModeReplace, priv->num_buttons, button_floats,
FALSE);
XISetDevicePropertyDeletable(pJstk, prop_button_amplify, FALSE);
for (i=0;i<priv->num_buttons;i++)
button_floats[i] = priv->button[i].amplify;
prop_button_amplify = MakeAtom(JSTK_PROP_BUTTON_AMPLIFY, strlen(JSTK_PROP_BUTTON_AMPLIFY), TRUE);
XIChangeDeviceProperty(pJstk, prop_button_amplify, float_type, 32,
PropModeReplace, priv->num_buttons, button_floats,
FALSE);
XISetDevicePropertyDeletable(pJstk, prop_button_amplify, FALSE);
}
/* priv->button[].keys */