Linux: Add hint for disabling deadzones
This commit is contained in:
parent
86517d3eda
commit
c3ecf18cc4
2 changed files with 15 additions and 1 deletions
|
@ -38,6 +38,7 @@
|
|||
#include <linux/joystick.h>
|
||||
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_timer.h"
|
||||
|
@ -706,6 +707,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
|
|||
}
|
||||
if (test_bit(i, absbit)) {
|
||||
struct input_absinfo absinfo;
|
||||
SDL_bool hint_used = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_DEADZONES, SDL_TRUE);
|
||||
|
||||
if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) {
|
||||
continue;
|
||||
|
@ -721,7 +723,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
|
|||
if (absinfo.minimum == absinfo.maximum) {
|
||||
joystick->hwdata->abs_correct[i].used = 0;
|
||||
} else {
|
||||
joystick->hwdata->abs_correct[i].used = 1;
|
||||
joystick->hwdata->abs_correct[i].used = hint_used;
|
||||
joystick->hwdata->abs_correct[i].coef[0] =
|
||||
(absinfo.maximum + absinfo.minimum) - 2 * absinfo.flat;
|
||||
joystick->hwdata->abs_correct[i].coef[1] =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue