Commit graph

14 commits

Author SHA1 Message Date
Sylvain Becker 6a2200823c
Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line
2022-11-27 08:38:43 -08:00
Sam Lantinga 0a48abc860 Switch header convention from #include "SDL.h" to #include <SDL3/SDLh>
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00
Sam Lantinga 63f307fe1f Remove SDL_config.h from the public headers
The SDL headers are no longer dependent on the build configuration.

Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
2022-11-26 04:48:36 -08:00
Simon McVittie 7d230af51d testevdev: Explain why the test data is encoded the way it is
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 19:20:40 +03:00
Simon McVittie 81dee31949 testevdev: Add a static assertion for supported sizeof(long)
If this assertion fails on some platform (unlikely), we will need a
third implementation for SwapLongLE().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 19:20:40 +03:00
Helge Deller fb32effd15 testevdev: Fix detection of word size
The check for whether to use a 32- or 64-bit swap for an array of long
values always took the 64-bit path, because <limits.h> wasn't included
and therefore ULONG_MAX wasn't defined. Turn this into a runtime check,
which a reasonable compiler will optimize into a constant.

This fixes testevdev failures on 32-bit big-endian platforms such as hppa
and older powerpc. Little-endian and/or 64-bit platforms are unaffected.

[smcv: Added commit message]
Bug-Debian: https://bugs.debian.org/1021310
Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-10-11 14:33:34 -07:00
Simon McVittie b299f74d05 test: Make testevdev succeed if the feature is disabled
"Not applicable" is more like success than it is like failure.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-04 18:17:55 -07:00
Simon McVittie b4256d03e9 testevdev: Adapt to a broader definition of keyboards
At the time I contributed this unit test, SDL had a relatively narrow
definition of what is a keyboard, approximately matching udev
ID_INPUT_KEYBOARD. Now it uses the equivalent of udev ID_INPUT_KEY,
which matches anything with keyboard keys, and not just reasonably
complete alphanumeric keyboards.

Fixes: 040bd7a9 "Fix udev not detecting ID_INPUT_KEY devices when udev is not running"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
Simon McVittie c2946902fa testevdev: Recognise touchpads as such
At the time I contributed this unit test, SDL didn't understand Linux
touchpads, but now it does.

Fixes: 373216ae "Added support for touchpads in the Linux evdev code"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga e6a4230de9 Revert testevdev libc changes
This file uses internal SDL headers as a hack, without actually being built as part of SDL, so we should use normal C functions here.
2021-11-23 03:51:32 -08:00
Sylvain d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Simon McVittie 65847539dd test: Add a unit test for input device classification heuristics
This uses pre-recorded evdev capabilities, so that we can check for
regressions without the devices having to be physically present.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:15:43 -08:00