Commit graph

7889 commits

Author SHA1 Message Date
Sylvain Becker
1d1eceb6ab Add hint SDL_HINT_MOUSE_TOUCH_EVENTS for mouse events to generate touch events
controlling whether mouse events should generate synthetic touch events
By default SDL will *not* generate touch events for mouse events
2019-04-04 16:51:50 +02:00
Sylvain Becker
d16648f8ce Bug 4576: track both FingerId and TrackId 2019-04-04 15:19:00 +02:00
Sylvain Becker
066a2112b3 Bug 4576: fix wrong scaling 2019-04-03 10:14:42 +02:00
Sylvain Becker
46212a1fa2 Bug 4576: one more warning 2019-04-02 18:07:27 +02:00
Sylvain Becker
9fc58c044c Bug 4576: fix warning and compile 2019-04-02 17:57:27 +02:00
Sylvain Becker
489c8573c2 Bug 4576: remove touch/mouse duplication for Android 2019-04-02 17:23:55 +02:00
Sylvain Becker
fb49e85bf6 Bug 4576: remove touch/mouse duplication for IOS 2019-04-02 17:18:47 +02:00
Sylvain Becker
d29be58504 Bug 4576: remove touch/mouse duplication for WinRT 2019-04-02 17:13:22 +02:00
Sylvain Becker
9e69244d5d Bug 4576: remove touch/mouse duplication for Emscripten 2019-04-02 17:10:29 +02:00
Sylvain Becker
e8431d6d53 Bug 4576: remove touch/mouse duplication for Wayland 2019-04-02 17:07:54 +02:00
Sylvain Becker
a25d2bcfc5 Bug 4576: remove touch/mouse duplication for linux/EVDEV 2019-04-02 17:03:58 +02:00
Sylvain Becker
2c8b5f513a Bug 4576: remove touch/mouse duplication for Windows 2019-04-02 16:58:11 +02:00
Sylvain Becker
fb5d1a1602 Bug 4576: handle mapping of TouchEvents to MouseEvents at higher level 2019-04-02 16:46:17 +02:00
Sam Lantinga
98db267344 Handle potentially calling SDL_JoystickUpdate() and SDL_JoystickQuit() at the same time. 2019-03-27 08:17:05 -07:00
Ryan C. Gordon
cc94b3330b coreaudio: Set audio callback thread priority.
Fixes Bugzilla #4155.
2019-03-25 12:59:30 -04:00
Ryan C. Gordon
5f18108aec Backed out changeset ffd52bb02bcc
This was meant to migrate CoreAudio onto the same SDL_RunAudio() path that
most other audio drivers are on, but it introduced a bug because it doesn't
deal with dropped audio buffers...and fixing that properly just introduces
latency.

I might revisit this later, perhaps by reworking SDL_RunAudio to allow for
this sort of API better, or redesigning the whole subsystem or something, I
don't know. I'm not super-thrilled that this has to exist outside of the usual
codepaths, though.

Fixes Bugzilla #4481.
2019-03-25 12:24:38 -04:00
Ryan C. Gordon
abdc48613d opengles2: Fix static analysis warning.
Not clear if this could ever dereference NULL in real life, but better safe
than sorry!
2019-03-21 10:39:49 -04:00
Sam Lantinga
b1b373cac7 Hopefully fixed the mingw32 build 2019-03-19 17:20:54 -07:00
Sam Lantinga
3fdd9cc679 Fixed Visual Studio build 2019-03-19 17:05:22 -07:00
Sam Lantinga
3d95e53a1d Didn't need to add SDL_windows.h include, that was already included 2019-03-19 16:53:55 -07:00
Sam Lantinga
2085fa0bd7 Fixed Windows RT build 2019-03-19 16:52:09 -07:00
Sam Lantinga
597d8d450b Added support for building SDL as a dynamic library on iOS 2019-03-19 07:53:33 -07:00
Sebastian Krzyszkowiak
fac19b06bb emscripten: force resize event when pixel ratio changes
Without this, applications can't react to changed canvas size on window zoom.
2019-03-16 19:08:59 -07:00
Sam Lantinga
4542d16cbf Fixed bug 4450 - SDL_mouse.c fails to compile with CMake generated Visual Studio files if SDL_VIDEO_VULKAN 0/undefined
Max Waine

SDL_mouse.c, if compiled for Windows, requires GetDoubleClickTime to compile (available from winuser.h). Without Vulkan present this fails to compile as the include chain for winuser.h is the following.

SDL_mouse.c -> SDL_sysvideo.h -> SDL_vulkan_internal.h -> SDL_windows.h -> windows.h -> winuser.h.
Problem is that SDL_vulkan_internal.h doesn't include SDL_windows.h if Vulkan isn't present, so under MinGW/GCC it will give a -Wimplicit-function-declaration warning for GetDoubleClickTime, and under MSVC fails to compile completely.

The solution to this would be to simplify the include chain: including SDL_windows.h under the same condition as GetDoubleClickTime (#ifdef __WIN32__) in SDL_mouse.c (or another file that isn't quite so indirectly included).
2019-03-16 19:07:34 -07:00
Sam Lantinga
7dc21399a0 Fixed bug 4511 - SDL_gamecontrollerdb Mapping for Sony Playstation USB controller
Renaud Lepage

Simply submitting a new mapping.
2019-03-16 19:03:13 -07:00
Silent
2a2ccad040 Fixed DualShock 3 mapping 2019-02-14 20:46:58 +01:00
Sam Lantinga
42f18ab3a6 Fixed bug 4525 - Fix crash in ALSA_HotplugThread caused by bad return value check
Anthony Pesch

Fix snd_device_name_hint return value check

According to the ALSA documentation, snd_device_name_hint returns 0 on
success, otherwise a negative error code. The code previously only
considered -1 to be an error, which let other error codes through
resulting in a segfault when hints (which was NULL) was dereferenced
2019-03-16 18:48:21 -07:00
Sam Lantinga
74e23455ab Fixed CVE-2019-7635 and bug 4498 - Heap-Buffer Overflow in Blit1to4 pertaining to SDL_blit_1.c
Petr Pisar

The root cause is that the POC BMP file declares 3 colors used and 4 bpp palette, but pixel at line 28 and column 1 (counted from 0) has color number 3. Then when the image loaded into a surface is passed to SDL_DisplayFormat(), in order to convert it to a video format, a used bliting function looks up a color number 3 in a 3-element long color bliting map. (The map obviously has the same number entries as the surface format has colors.)

Proper fix should refuse broken BMP images that have a pixel with a color index higher than declared number of "used" colors. Possibly more advanced fix could try to relocate the out-of-range color index into a vacant index (if such exists).
2019-03-16 18:34:33 -07:00
Jimb Esser
b7be1a9526 Fix polling left trigger reporting right trigger's values. 2019-03-16 18:12:26 -07:00
Jimb Esser
2da2a90694 Fix DirectInput error codes being lost 2019-03-16 18:11:09 -07:00
Ethan Lee
cc665e2a57 hidapi: Add support for Wii U/Switch USB GameCube controller adapter.
Note that a single USB device is responsible for all 4 joysticks, so a large
rewrite of the DeviceDriver functions was necessary to allow a single device to
produce multiple joysticks.
2019-03-12 20:27:54 -04:00
Ryan C. Gordon
40130d3208 Fix compiler warnings. 2019-03-16 00:08:19 -04:00
Ryan C. Gordon
35ccceb805 events: Disable all the signal-handling code on platforms without support.
So on Windows, for example, this mostly becomes a few empty functions.
2019-03-15 16:13:19 -04:00
Ryan C. Gordon
26afcb485a events: Let arbitrary signals to simulate iOS/Android backgrounding events.
This lets you build a custom embedded device that roughly offers the "this
process is going to the background NOW" semantics of SDL on a mobile device.
2019-03-15 15:51:05 -04:00
Ryan C. Gordon
64d44bc32f events: Make debug logging of the event queue a hint instead of an #ifdef.
This makes it easy to toggle it on when debugging a new platform (or just
getting more visibility into an app) without having to rebuild SDL.

--HG--
extra : rebase_source : b8676f90fbb0b57a6d210ba17af0f69b3e543fe4
2019-03-15 14:08:30 -04:00
Sylvain Becker
dde12980b1 KMSDRM: valid file descriptors could positive or 0. -1 is invalid. (Bug 4530) 2019-03-13 14:54:51 +01:00
Sylvain Becker
1a45c58431 Android: check SDL is initialized before sending the event
Avoid error message:
SDLActivity thread ends (error=Video subsystem has not been initialized)
2019-03-13 09:39:30 +01:00
Sam Lantinga
d7e04b16d7 [iOS DAC] Fix touch events getting from SDL2 to source2. 2019-03-12 14:45:04 -07:00
Sam Lantinga
0f79ef9a72 Fixed initial display orientation at Android app start 2019-03-12 14:44:25 -07:00
Sam Lantinga
4f7d417d71 HIDAPI: fix bug that caused non-HID class parts of composite devices to have windows HID functions called on them. 2019-03-12 14:44:12 -07:00
Sylvain Becker
340a13885b Fixed bug 4513 - Wayland, fix crash when remove event is sent (from Sebastian Krzyszkowiak) 2019-03-12 20:04:08 +01:00
Sylvain Becker
41de2fd2a0 SDL_EVDEV_kbd_init: uninitialized data for ioctl (Bug 4530)
Only two chars are used but the full prototype is:

int tioclinux(struct tty_struct *tty, unsigned long arg)

==5010== Syscall param ioctl(TIOCLINUX) points to uninitialised byte(s)
==5010==    at 0x53E73C7: ioctl (syscall-template.S:78)
==5010==    by 0x4A887DA: SDL_EVDEV_Init (SDL_evdev.c:163)
==5010==    by 0x4A7D157: KMSDRM_VideoInit (SDL_kmsdrmvideo.c:509)
==5010==    by 0x497D959: SDL_VideoInit_REAL (SDL_video.c:529)
==5010==    by 0x487ACBC: SDL_InitSubSystem_REAL (SDL.c:171)
==5010==    by 0x487B052: SDL_Init_REAL (SDL.c:256)
==5010==    by 0x488F7D6: SDL_Init (SDL_dynapi_procs.h:85)
2019-03-12 14:20:37 +01:00
Sylvain Becker
d12de4fc50 Fixed bug 4542 - Image flipped vertically when rendering on texture
Have to recompute  viewport because projection/glOrtho is different
wether rendering is on target texture or not
2019-03-12 07:59:53 +01:00
Sylvain Becker
6459df3bb7 SDL_MouseQuit(): clear mouse->cur_cursor (Bug 4530) 2019-03-11 15:31:46 +01:00
Sylvain Becker
ae05c2a19a KMSDRM: missing return value in VideoInit() (Bug 4530) 2019-03-11 15:27:42 +01:00
Sylvain Becker
ac5db2a7bd KMSDRM: change calls free() to SDL_free() (Bug 4529) 2019-03-11 15:22:40 +01:00
Sylvain Becker
eef44efa4c Un-activate some routine on mips because they are slowers (Bug 4503) 2019-02-23 09:36:56 +01:00
Sylvain Becker
9004c45b2e BlitNtoN BlitNtoNKey: remove non-aligned word read/store (bpp 3<->4) (Bug 4503)
Mips and (old) ARM doesn't allow word read/write when adress isn't 4bytes
aligned. So just remove that.
2019-02-22 09:30:45 +01:00
Ryan C. Gordon
6825a01478 raspberry: expose second display.
This lets apps see and choose between both an HDMI and DSI-connected display,
such as a television and the Pi Foundation's official touchscreen. It only
exposes the second display if the hardware reports that it is connected.

--HG--
extra : histedit_source : 10e02ab4f4e59329d69838e12d76ec2e88312014
2019-02-19 23:46:54 -05:00
Sylvain Becker
7a61dbc2ce Fix windows build 2019-02-18 22:48:14 +01:00