Update for SDL3 coding style (#6717)

I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174)
This commit is contained in:
Sam Lantinga
2022-11-30 12:51:59 -08:00
parent 5c4bc807f7
commit b8d85c6939
764 changed files with 50598 additions and 54407 deletions

View File

@@ -30,12 +30,12 @@
#include "../../core/linux/SDL_evdev_capabilities.h"
#include "../../core/linux/SDL_udev.h"
#include <unistd.h> /* close */
#include <linux/input.h> /* Force feedback linux stuff. */
#include <fcntl.h> /* O_RDWR */
#include <limits.h> /* INT_MAX */
#include <errno.h> /* errno, strerror */
#include <sys/stat.h> /* stat */
#include <unistd.h> /* close */
#include <linux/input.h> /* Force feedback linux stuff. */
#include <fcntl.h> /* O_RDWR */
#include <limits.h> /* INT_MAX */
#include <errno.h> /* errno, strerror */
#include <sys/stat.h> /* stat */
/* Just in case. */
#ifndef M_PI
@@ -56,45 +56,42 @@ static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class,
*/
typedef struct SDL_hapticlist_item
{
char *fname; /* Dev path name (like /dev/input/event1) */
SDL_Haptic *haptic; /* Associated haptic. */
char *fname; /* Dev path name (like /dev/input/event1) */
SDL_Haptic *haptic; /* Associated haptic. */
dev_t dev_num;
struct SDL_hapticlist_item *next;
} SDL_hapticlist_item;
/*
* Haptic system hardware data.
*/
struct haptic_hwdata
{
int fd; /* File descriptor of the device. */
char *fname; /* Points to the name in SDL_hapticlist. */
int fd; /* File descriptor of the device. */
char *fname; /* Points to the name in SDL_hapticlist. */
};
/*
* Haptic system effect data.
*/
struct haptic_hweffect
{
struct ff_effect effect; /* The linux kernel effect structure. */
struct ff_effect effect; /* The linux kernel effect structure. */
};
static SDL_hapticlist_item *SDL_hapticlist = NULL;
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
static int numhaptics = 0;
#define EV_TEST(ev,f) \
if (test_bit((ev), features)) { \
ret |= (f); \
}
#define EV_TEST(ev, f) \
if (test_bit((ev), features)) { \
ret |= (f); \
}
/*
* Test whether a device has haptic properties.
* Returns available properties or 0 if there are none.
*/
static int
EV_IsHaptic(int fd)
static int EV_IsHaptic(int fd)
{
unsigned int ret;
unsigned long features[1 + FF_MAX / sizeof(unsigned long)];
@@ -128,12 +125,10 @@ EV_IsHaptic(int fd)
return ret;
}
/*
* Tests whether a device is a mouse or not.
*/
static int
EV_IsMouse(int fd)
static int EV_IsMouse(int fd)
{
unsigned long argp[40];
@@ -153,8 +148,7 @@ EV_IsMouse(int fd)
/*
* Initializes the haptic subsystem by finding available devices.
*/
int
SDL_SYS_HapticInit(void)
int SDL_SYS_HapticInit(void)
{
const char joydev_pattern[] = "/dev/input/event%d";
char path[PATH_MAX];
@@ -176,7 +170,7 @@ SDL_SYS_HapticInit(void)
return SDL_SetError("Could not initialize UDEV");
}
if ( SDL_UDEV_AddCallback(haptic_udev_callback) < 0) {
if (SDL_UDEV_AddCallback(haptic_udev_callback) < 0) {
SDL_UDEV_Quit();
return SDL_SetError("Could not setup haptic <-> udev callback");
}
@@ -188,14 +182,12 @@ SDL_SYS_HapticInit(void)
return numhaptics;
}
int
SDL_SYS_NumHaptics(void)
int SDL_SYS_NumHaptics(void)
{
return numhaptics;
}
static SDL_hapticlist_item *
HapticByDevIndex(int device_index)
static SDL_hapticlist_item *HapticByDevIndex(int device_index)
{
SDL_hapticlist_item *item = SDL_hapticlist;
@@ -219,25 +211,22 @@ static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class,
return;
}
switch( udev_type )
{
case SDL_UDEV_DEVICEADDED:
MaybeAddDevice(devpath);
break;
switch (udev_type) {
case SDL_UDEV_DEVICEADDED:
MaybeAddDevice(devpath);
break;
case SDL_UDEV_DEVICEREMOVED:
MaybeRemoveDevice(devpath);
break;
case SDL_UDEV_DEVICEREMOVED:
MaybeRemoveDevice(devpath);
break;
default:
break;
default:
break;
}
}
#endif /* SDL_USE_LIBUDEV */
static int
MaybeAddDevice(const char *path)
static int MaybeAddDevice(const char *path)
{
struct stat sb;
int fd;
@@ -256,7 +245,7 @@ MaybeAddDevice(const char *path)
/* check for duplicates */
for (item = SDL_hapticlist; item != NULL; item = item->next) {
if (item->dev_num == sb.st_rdev) {
return -1; /* duplicate. */
return -1; /* duplicate. */
}
}
@@ -277,7 +266,7 @@ MaybeAddDevice(const char *path)
return -1;
}
item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item));
item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
if (item == NULL) {
return -1;
}
@@ -306,8 +295,7 @@ MaybeAddDevice(const char *path)
}
#if SDL_USE_LIBUDEV
static int
MaybeRemoveDevice(const char* path)
static int MaybeRemoveDevice(const char *path)
{
SDL_hapticlist_item *item;
SDL_hapticlist_item *prev = NULL;
@@ -349,8 +337,7 @@ MaybeRemoveDevice(const char* path)
/*
* Gets the name from a file descriptor.
*/
static const char *
SDL_SYS_HapticNameFromFD(int fd)
static const char *SDL_SYS_HapticNameFromFD(int fd)
{
static char namebuf[128];
@@ -362,7 +349,6 @@ SDL_SYS_HapticNameFromFD(int fd)
return namebuf;
}
/*
* Return the name of a haptic device, does not need to be opened.
*/
@@ -391,12 +377,10 @@ SDL_SYS_HapticName(int index)
return name;
}
/*
* Opens the haptic device from the file descriptor.
*/
static int
SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
static int SDL_SYS_HapticOpenFromFD(SDL_Haptic *haptic, int fd)
{
/* Allocate the hwdata */
haptic->hwdata = (struct haptic_hwdata *)
@@ -410,7 +394,7 @@ SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
/* Set the data. */
haptic->hwdata->fd = fd;
haptic->supported = EV_IsHaptic(fd);
haptic->naxes = 2; /* Hardcoded for now, not sure if it's possible to find out. */
haptic->naxes = 2; /* Hardcoded for now, not sure if it's possible to find out. */
/* Set the effects */
if (ioctl(fd, EVIOCGEFFECTS, &haptic->neffects) < 0) {
@@ -418,7 +402,7 @@ SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
strerror(errno));
goto open_err;
}
haptic->nplaying = haptic->neffects; /* Linux makes no distinction. */
haptic->nplaying = haptic->neffects; /* Linux makes no distinction. */
haptic->effects = (struct haptic_effect *)
SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
if (haptic->effects == NULL) {
@@ -432,7 +416,7 @@ SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
return 0;
/* Error handling */
open_err:
open_err:
close(fd);
if (haptic->hwdata != NULL) {
SDL_free(haptic->hwdata);
@@ -441,12 +425,10 @@ SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
return -1;
}
/*
* Opens a haptic device for usage.
*/
int
SDL_SYS_HapticOpen(SDL_Haptic * haptic)
int SDL_SYS_HapticOpen(SDL_Haptic *haptic)
{
int fd;
int ret;
@@ -467,16 +449,14 @@ SDL_SYS_HapticOpen(SDL_Haptic * haptic)
}
/* Set the fname. */
haptic->hwdata->fname = SDL_strdup( item->fname );
haptic->hwdata->fname = SDL_strdup(item->fname);
return 0;
}
/*
* Opens a haptic device from first mouse it finds for usage.
*/
int
SDL_SYS_HapticMouse(void)
int SDL_SYS_HapticMouse(void)
{
int fd;
int device_index = 0;
@@ -504,12 +484,10 @@ SDL_SYS_HapticMouse(void)
return -1;
}
/*
* Checks to see if a joystick has haptic features.
*/
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_LINUX
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
@@ -522,12 +500,10 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
return SDL_FALSE;
}
/*
* Checks to see if the haptic device and joystick are in reality the same.
*/
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
int SDL_SYS_JoystickSameHaptic(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_LINUX
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
@@ -542,19 +518,17 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
return 0;
}
/*
* Opens a SDL_Haptic from a SDL_Joystick.
*/
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
#ifdef SDL_JOYSTICK_LINUX
int device_index = 0;
int fd;
int ret;
SDL_hapticlist_item *item;
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
return -1;
}
@@ -581,7 +555,7 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
return -1;
}
haptic->hwdata->fname = SDL_strdup( joystick->hwdata->fname );
haptic->hwdata->fname = SDL_strdup(joystick->hwdata->fname);
return 0;
#else
@@ -589,12 +563,10 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
#endif
}
/*
* Closes the haptic device.
*/
void
SDL_SYS_HapticClose(SDL_Haptic * haptic)
void SDL_SYS_HapticClose(SDL_Haptic *haptic)
{
if (haptic->hwdata) {
@@ -616,12 +588,10 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
SDL_memset(haptic, 0, sizeof(SDL_Haptic));
}
/*
* Clean up after system specific haptic stuff
*/
void
SDL_SYS_HapticQuit(void)
void SDL_SYS_HapticQuit(void)
{
SDL_hapticlist_item *item = NULL;
SDL_hapticlist_item *next = NULL;
@@ -644,12 +614,10 @@ SDL_SYS_HapticQuit(void)
SDL_hapticlist_tail = NULL;
}
/*
* Converts an SDL button to a ff_trigger button.
*/
static Uint16
SDL_SYS_ToButton(Uint16 button)
static Uint16 SDL_SYS_ToButton(Uint16 button)
{
Uint16 ff_button;
@@ -666,12 +634,10 @@ SDL_SYS_ToButton(Uint16 button)
return ff_button;
}
/*
* Initializes the ff_effect usable direction from a SDL_HapticDirection.
*/
static int
SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
static int SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection *src)
{
Uint32 tmp;
@@ -689,21 +655,21 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
i.e. the opposite convention of SDL directions.
*/
tmp = ((src->dir[0] % 36000) * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
*dest = (Uint16) tmp;
*dest = (Uint16)tmp;
break;
case SDL_HAPTIC_SPHERICAL:
/*
We convert to polar, because that's the only supported direction on Linux.
The first value of a spherical direction is practically the same as a
Polar direction, except that we have to add 90 degrees. It is the angle
from EAST {1,0} towards SOUTH {0,1}.
--> add 9000
--> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
*/
tmp = ((src->dir[0]) + 9000) % 36000; /* Convert to polars */
tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
*dest = (Uint16) tmp;
/*
We convert to polar, because that's the only supported direction on Linux.
The first value of a spherical direction is practically the same as a
Polar direction, except that we have to add 90 degrees. It is the angle
from EAST {1,0} towards SOUTH {0,1}.
--> add 9000
--> finally convert to [0,0xFFFF] as in case SDL_HAPTIC_POLAR.
*/
tmp = ((src->dir[0]) + 9000) % 36000; /* Convert to polars */
tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
*dest = (Uint16)tmp;
break;
case SDL_HAPTIC_CARTESIAN:
@@ -725,7 +691,7 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
*/
tmp = (((Sint32) (f * 18000. / M_PI)) + 45000) % 36000;
tmp = (tmp * 0x8000) / 18000; /* convert to range [0,0xFFFF] */
*dest = (Uint16) tmp;
*dest = (Uint16)tmp;
}
break;
case SDL_HAPTIC_STEERING_AXIS:
@@ -738,14 +704,12 @@ SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection * src)
return 0;
}
#define CLAMP(x) (((x) > 32767) ? 32767 : x)
#define CLAMP(x) (((x) > 32767) ? 32767 : x)
/*
* Initializes the Linux effect struct from a haptic_effect.
* Values above 32767 (for unsigned) are unspecified so we must clamp.
*/
static int
SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
static int SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect *src)
{
SDL_HapticConstant *constant;
SDL_HapticPeriodic *periodic;
@@ -767,8 +731,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
}
/* Replay */
dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ?
0 : CLAMP(constant->length);
dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(constant->length);
dest->replay.delay = CLAMP(constant->delay);
/* Trigger */
@@ -803,8 +766,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
}
/* Replay */
dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ?
0 : CLAMP(periodic->length);
dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(periodic->length);
dest->replay.delay = CLAMP(periodic->delay);
/* Trigger */
@@ -814,9 +776,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
/* Periodic */
if (periodic->type == SDL_HAPTIC_SINE) {
dest->u.periodic.waveform = FF_SINE;
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* else if (periodic->type == SDL_HAPTIC_SQUARE)
dest->u.periodic.waveform = FF_SQUARE; */
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* else if (periodic->type == SDL_HAPTIC_SQUARE)
dest->u.periodic.waveform = FF_SQUARE; */
} else if (periodic->type == SDL_HAPTIC_TRIANGLE) {
dest->u.periodic.waveform = FF_TRIANGLE;
} else if (periodic->type == SDL_HAPTIC_SAWTOOTHUP) {
@@ -856,12 +818,11 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
} else if (condition->type == SDL_HAPTIC_FRICTION) {
dest->type = FF_FRICTION;
}
dest->direction = 0; /* Handled by the condition-specifics. */
dest->direction = 0; /* Handled by the condition-specifics. */
/* Replay */
dest->replay.length = (condition->length == SDL_HAPTIC_INFINITY) ?
0 : CLAMP(condition->length);
dest->replay.length = (condition->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(condition->length);
dest->replay.delay = CLAMP(condition->delay);
/* Trigger */
@@ -900,8 +861,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
}
/* Replay */
dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ?
0 : CLAMP(ramp->length);
dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(ramp->length);
dest->replay.delay = CLAMP(ramp->delay);
/* Trigger */
@@ -928,8 +888,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
dest->direction = 0;
/* Replay */
dest->replay.length = (leftright->length == SDL_HAPTIC_INFINITY) ?
0 : CLAMP(leftright->length);
dest->replay.length = (leftright->length == SDL_HAPTIC_INFINITY) ? 0 : CLAMP(leftright->length);
/* Trigger */
dest->trigger.button = 0;
@@ -941,7 +900,6 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
break;
default:
return SDL_SetError("Haptic: Unknown effect type.");
}
@@ -949,13 +907,11 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
return 0;
}
/*
* Creates a new haptic effect.
*/
int
SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
SDL_HapticEffect * base)
int SDL_SYS_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect,
SDL_HapticEffect *base)
{
struct ff_effect *linux_effect;
@@ -971,7 +927,7 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
if (SDL_SYS_ToFFEffect(linux_effect, base) != 0) {
goto new_effect_err;
}
linux_effect->id = -1; /* Have the kernel give it an id */
linux_effect->id = -1; /* Have the kernel give it an id */
/* Upload the effect */
if (ioctl(haptic->hwdata->fd, EVIOCSFF, linux_effect) < 0) {
@@ -982,23 +938,21 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
return 0;
new_effect_err:
new_effect_err:
SDL_free(effect->hweffect);
effect->hweffect = NULL;
return -1;
}
/*
* Updates an effect.
*
* Note: Dynamically updating the direction can in some cases force
* the effect to restart and run once.
*/
int
SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
SDL_HapticEffect * data)
int SDL_SYS_HapticUpdateEffect(SDL_Haptic *haptic,
struct haptic_effect *effect,
SDL_HapticEffect *data)
{
struct ff_effect linux_effect;
@@ -1021,13 +975,11 @@ SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
return effect->hweffect->effect.id;
}
/*
* Runs an effect.
*/
int
SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
Uint32 iterations)
int SDL_SYS_HapticRunEffect(SDL_Haptic *haptic, struct haptic_effect *effect,
Uint32 iterations)
{
struct input_event run;
@@ -1037,19 +989,17 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
/* We don't actually have infinity here, so we just do INT_MAX which is pretty damn close. */
run.value = (iterations > INT_MAX) ? INT_MAX : iterations;
if (write(haptic->hwdata->fd, (const void *) &run, sizeof(run)) < 0) {
if (write(haptic->hwdata->fd, (const void *)&run, sizeof(run)) < 0) {
return SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));
}
return 0;
}
/*
* Stops an effect.
*/
int
SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
int SDL_SYS_HapticStopEffect(SDL_Haptic *haptic, struct haptic_effect *effect)
{
struct input_event stop;
@@ -1057,7 +1007,7 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
stop.code = effect->hweffect->effect.id;
stop.value = 0;
if (write(haptic->hwdata->fd, (const void *) &stop, sizeof(stop)) < 0) {
if (write(haptic->hwdata->fd, (const void *)&stop, sizeof(stop)) < 0) {
return SDL_SetError("Haptic: Unable to stop the effect: %s",
strerror(errno));
}
@@ -1065,12 +1015,10 @@ SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
return 0;
}
/*
* Frees the effect.
*/
void
SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
void SDL_SYS_HapticDestroyEffect(SDL_Haptic *haptic, struct haptic_effect *effect)
{
if (ioctl(haptic->hwdata->fd, EVIOCRMFF, effect->hweffect->effect.id) < 0) {
SDL_SetError("Haptic: Error removing the effect from the device: %s",
@@ -1080,15 +1028,13 @@ SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
effect->hweffect = NULL;
}
/*
* Gets the status of a haptic effect.
*/
int
SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
struct haptic_effect *effect)
int SDL_SYS_HapticGetEffectStatus(SDL_Haptic *haptic,
struct haptic_effect *effect)
{
#if 0 /* Not supported atm. */
#if 0 /* Not supported atm. */
struct input_event ie;
ie.type = EV_FF;
@@ -1105,12 +1051,10 @@ SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
return -1;
}
/*
* Sets the gain.
*/
int
SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
int SDL_SYS_HapticSetGain(SDL_Haptic *haptic, int gain)
{
struct input_event ie;
@@ -1125,12 +1069,10 @@ SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
return 0;
}
/*
* Sets the autocentering.
*/
int
SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
int SDL_SYS_HapticSetAutocenter(SDL_Haptic *haptic, int autocenter)
{
struct input_event ie;
@@ -1145,32 +1087,26 @@ SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
return 0;
}
/*
* Pausing is not supported atm by linux.
*/
int
SDL_SYS_HapticPause(SDL_Haptic * haptic)
int SDL_SYS_HapticPause(SDL_Haptic *haptic)
{
return -1;
}
/*
* Unpausing is not supported atm by linux.
*/
int
SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
int SDL_SYS_HapticUnpause(SDL_Haptic *haptic)
{
return -1;
}
/*
* Stops all the currently playing effects.
*/
int
SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
int SDL_SYS_HapticStopAll(SDL_Haptic *haptic)
{
int i, ret;
@@ -1179,8 +1115,7 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
if (haptic->effects[i].hweffect != NULL) {
ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
if (ret < 0) {
return SDL_SetError
("Haptic: Error while trying to stop all playing effects.");
return SDL_SetError("Haptic: Error while trying to stop all playing effects.");
}
}
}