Commit Graph

3580 Commits

Author SHA1 Message Date
Ryan C. Gordon
1f4fecc5c1 url: Patched to compile on Windows. 2020-10-05 14:07:32 -04:00
Ryan C. Gordon
777d0f19f8 url: patched to compile on macOS. 2020-10-05 14:06:25 -04:00
Ryan C. Gordon
d068d05aa5 url: Make sure Haiku's C++ implementation is flagged as 'extern "C"' 2020-10-05 14:01:08 -04:00
Ryan C. Gordon
bf9fcb539a url: The function is "SDL_Unsupported" not "SDL_Unimplemented" 2020-10-05 14:00:08 -04:00
Ryan C. Gordon
2d82cf78e1 url: put the Android bits in core/android 2020-10-05 13:59:03 -04:00
Ryan C. Gordon
efd665e2c7 Backed out changeset a43cb4e54949
Trying this a different way.
2020-10-05 13:56:45 -04:00
Ryan C. Gordon
913aa610b5 url: Include SDL_misc.h to get public function declaration. 2020-10-05 13:53:15 -04:00
Ryan C. Gordon
5f68812249 url: patched to compile on Android. 2020-10-05 13:52:52 -04:00
Ryan C. Gordon
84f1b95008 url: fixed wrong include. 2020-10-05 13:39:39 -04:00
Ryan C. Gordon
77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Sylvain Becker
cd6670bff3 SDL_Surface refcount: fix memory leak when blitting between stack'ed surfaces
(see bug 5226)
2020-10-02 10:48:27 +02:00
Ozkan Sezer
883509fc84 ran gendynapi.pl after new (android-only) api additions. 2020-10-01 17:01:00 +03:00
Sylvain Becker
dd55bfe89c Android: add helper function to open an URL/URI (see bug 2783) 2020-10-01 14:41:09 +02:00
Sam Lantinga
45c644cc99 Added support for the MOGA XP5-X Plus 2020-09-28 21:19:45 -07:00
Manuel Alfayate Corchete
78c274cb5d kmsdrm: merge patches from Ozkan Sezer for removing c-99'isms and raising libgbm version reqeriments. 2020-09-26 19:18:09 +02:00
Sylvain Becker
955f3184f9 Fixed bug 5239 - Play audio on Android while backgrounded (Thanks Superfury)
Add hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO not to pause audio when
the app goes to background.
(It requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking")
2020-09-25 10:14:42 +02:00
Ryan C. Gordon
7ef188a1fb jack: Fixed memory leak on device close. 2020-09-19 14:01:57 -04:00
Cameron Gutman
9a769da04a X11: Remove our X11 error callback in X11_DeleteDevice()
If we don't remove it, we will infinitely recurse if X11_CreateDevice() is
called again and orig_x11_errhandler becomes X11_SafetyNetErrHandler().
2020-09-07 20:10:50 -07:00
Manuel Alfayate Corchete
9c342e76dd kmsdrm: merge heap buffer overflow and cursor creation patches from meyraud705. 2020-09-13 21:41:10 +02:00
Manuel Alfayate Corchete
0cb9bfa502 kmsdrm: less excessive error checkhing 2020-09-12 15:58:47 +02:00
Manuel Alfayate Corchete
5bed30dd61 kmsdrm: also do pending modeseting in SwapWindowDoubleBuffered(). 2020-09-12 04:56:55 +02:00
Manuel Alfayate Corchete
9e9227add3 kmsdrm: reimplement modesetting for fullscreen window scaling and AR-correction. 2020-09-12 04:52:56 +02:00
Manuel Alfayate Corchete
4575c6942a kmsdrm: delete ununsed variable. 2020-09-12 02:36:02 +02:00
Manuel Alfayate Corchete
01b0cf1c90 Backed out changeset 4a45d1a30d25
kmsdrm: Fake KMSDRM_SetDisplayMode() is needed for some programs after all.
2020-09-12 00:47:00 +02:00
Manuel Alfayate Corchete
7b67654872 kmsdrm: don't fool SDL into thinking that changing the physical videomode is done. 2020-09-12 00:16:08 +02:00
Manuel Alfayate Corchete
a6d182d326 kmsdrm: no need to reconnect/reactivate things in SwapWindowDoubleBuffered(). 2020-09-11 23:47:26 +02:00
Manuel Alfayate Corchete
47e2d0304e kmsdrm: greatly improve comments in SwapBuffersFenced() for future reference. 2020-09-10 23:26:02 +02:00
Ryan C. Gordon
3c6004feb7 kmsdrm: Choose how to swap buffers based on EGL extension availability. 2020-09-10 15:07:23 -04:00
Ryan C. Gordon
c7e761f872 kmsdrm: Patched to compile if EGL headers lack EGL_ANDROID_native_fence_sync. 2020-09-10 15:05:55 -04:00
Ryan C. Gordon
224aa45b59 kmsdrm: Implement GL_DefaultProfileConfig for Raspberry Pi compatibility.
If we think this might be a Raspberry Pi device, default to ES2. Otherwise,
accept SDL's higher-level defaults.
2020-09-10 15:04:35 -04:00
Ryan C. Gordon
092162ede7 video: Set up default before calling GL_DefaultProfileConfig().
This way, the implementation can opt to do nothing to accept SDL's defaults.
2020-09-10 15:02:51 -04:00
Ryan C. Gordon
e758dd53dc egl: Make SDL_EGL_HasExtension() available outside of SDL_egl.c. 2020-09-10 15:02:00 -04:00
Manuel Alfayate Corchete
055cad49b6 kmsdrm: no need to re-connect/reactivate things in SwapWindow() anymore because we use a dumb buffer on KMS buffers destruction now. 2020-09-10 02:15:53 +02:00
Manuel Alfayate Corchete
351219bfd8 kmsdrm: On VideoQuit(), only destroy dumb buffer if it exists. 2020-09-09 03:18:26 +02:00
Sam Lantinga
8709f67ebc Fixed bug 5215 - Fixing filenames passed to dlopen for OpenBSD
Brad Smith

Attached is a patch to use the proper filenames when trying to dlopen the respective shared libraries on OpenBSD.
2020-09-08 08:42:30 -07:00
Cameron Gutman
1b6de9a987 Fix SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH=1 on Metal windows
SDL_cocoametalview was consuming the first click rather than passing it
through to the SDLView underneath which overrides [NSView acceptsFirstMouse]
based on the user's SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH preference.
2020-09-05 15:01:45 -07:00
Manuel Alfayate Corchete
244d0ad854 kmsdrm: Tell SDL that mouse has entered the window via artificial event. Fixes sticky mouse in Scummvm. 2020-09-08 15:30:45 +02:00
Manuel Alfayate Corchete
550e153365 kmsdrm: No need to test for display driverdata when freeing a plane. 2020-09-08 02:42:32 +02:00
Manuel Alfayate Corchete
6e03fab982 kmsdrm: add temporary RPI4_COMPAT define to try RPI4+current Rasbian compatibility. 2020-09-07 23:15:33 +02:00
Manuel Alfayate Corchete
0f807fd607 kmsdrm: use a black dumb buffer for keeping the PRIMARY PLANE occupied when we destroy the KMS buffers, instead of using the TTY buffer, to avoid flickering. 2020-09-07 22:54:15 +02:00
Sylvain Becker
4d1c2a1857 Fix false compiler warning: initialize the variable 'memdiff' 2020-09-07 19:00:21 +02:00
Sylvain Becker
ebc12a2fd2 SDL_Surface refcount: destination surface keep track of surfaces
that are mapped to it and automatically invalidate them when it is freed

- refcount is kept so that an external application can still create a reference
to SDL_Surface.

- lock_data was un-used and is now renamed and used as a list keep track of the blitmap
2020-09-07 18:50:30 +02:00
Manuel Alfayate Corchete
cce6c60518 kmsdrm: fix errors when trying to free up videomode driverdata pointers on quit. 2020-09-07 01:33:04 +02:00
Manuel Alfayate Corchete
9501b1c698 kmsdrm: fix scaling for SDL_WINDOW_FULLSCREEN windows. 2020-09-07 00:18:13 +02:00
Manuel Alfayate Corchete
daa752b10e kmsdrm: fix first frame display: no need to wait for SwapWindow() for EGL surface creation. 2020-09-06 23:19:54 +02:00
Manuel Alfayate Corchete
68ac9349aa kmsdrm: more coherent returns for SwapWindow. 2020-09-06 12:48:39 +02:00
Manuel Alfayate Corchete
d3d9d432ac kmsdrm: Remove debug printfs in SwapWindow. 2020-09-06 12:17:27 +02:00
Manuel Alfayate Corchete
d7aebbd58f kmsdrm: Don't create surfaces until EGL context is available. 2020-09-06 12:08:22 +02:00
Sylvain Becker
97fad04551 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!) 2020-09-02 19:38:03 +02:00
Manuel Alfayate Corchete
f4e02a5c1b kmsdrm: Do NOT modify window size manually from the backend: doing so caused renderer scaling params miscalculation. 2020-08-31 19:17:17 +02:00
Manuel Alfayate Corchete
c09d1cee95 kmsdrm: Apply window reconfiguration in SetWindowSize(), too. 2020-08-28 23:04:00 +02:00
Manuel Alfayate Corchete
31b1794534 kmsdrm: use PLANE and CRTC to do hardware-driven window scaling and AR-correction. 2020-08-28 22:38:26 +02:00
Manuel Alfayate Corchete
fe3f97961b kmsdrm: unload EGL and GL lib only if using them. 2020-08-26 01:37:30 +02:00
Manuel Alfayate Corchete
9b43464d81 kmsdrm: Add programmer credits to the Atomic KMSDRM driver. 2020-08-25 16:30:23 +02:00
Manuel Alfayate Corchete
9316a8d979 kmsdrm: move FENCE FD props setting to SwapWindow(), where it belongs. 2020-08-25 16:18:49 +02:00
Manuel Alfayate Corchete
3f38009b2f kmsdrm: comment out atomic commit fast-debugging printf. 2020-08-25 15:40:36 +02:00
Manuel Alfayate Corchete
0d16761cbe kmsdrm: fix segfault on quit beacuse of freed _this->egl_data. 2020-08-25 05:53:13 +02:00
Manuel Alfayate Corchete
d43e666eed kmsdrm: Buffer management refactoring. Fixes for compatibility with more video drivers. 2020-08-25 04:05:36 +02:00
Manuel Alfayate Corchete
eade05ca03 kmsdrm: Finetune integer type usage. Add some comments. 2020-08-24 12:51:20 +02:00
Manuel Alfayate Corchete
a76f176361 kmsdrm: Move cursor plane setup and freeing to MouseInit() and MouseQuit(), for better consistency. 2020-08-24 01:10:11 +02:00
Manuel Alfayate Corchete
0d593d7ead kmsdrm: Add error control to plane prop setting function. Do most plane prop setting with a single function. 2020-08-23 23:44:07 +02:00
Manuel Alfayate Corchete
e06e9c35c8 kmsdrm: move cursor-related atomic helper functions and related struct typedefs to the SDL_kmsdrmmouse unit. 2020-08-23 11:26:55 +02:00
Manuel Alfayate Corchete
0b7b7721b9 kmsdrm: remove redundant function, use drm_atomic_setbuffers() for disconnecting planes instead. 2020-08-23 03:13:50 +02:00
Manuel Alfayate Corchete
16c04f266a kmsdrm: Init cursor surface on SetCursor() ONLY. Removal of dynamic modeset because it causes A LOT of problems with some kernel video drivers. Some refactoring and cleanups. 2020-08-23 02:58:57 +02:00
Manuel Alfayate Corchete
0d0ba111ae kmsdrm: correct parameter name. 2020-08-19 01:34:56 +02:00
Manuel Alfayate Corchete
5d32eda956 kmsdrm: implement smarter surface recreation function to be used in videomode changes. Other minor arrangements. 2020-08-19 01:31:22 +02:00
Manuel Alfayate Corchete
f79da81721 kmsdrm: free all connector, crtc and plane memory on KMSDRM_VideoQuit(). 2020-08-18 01:52:15 +02:00
Sylvain Becker
965b466ee8 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support
"In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play"
(see https://developer.android.com/guide/app-bundle)
And "Android App Bundles don't support APK expansion (*.obb) files".
2020-08-17 19:50:20 +02:00
Manuel Alfayate Corchete
92cb9192e3 kmsdrm: move hardware cursor functionality to the ATOMIC interface. Disconnect the display plane from the GBM surface buffers before destroying the GBM surface. 2020-08-17 18:35:04 +02:00
Kai Krakow
c3ecf18cc4 Linux: Add hint for disabling deadzones 2020-07-21 23:38:42 +02:00
Tudor Brindus
c094332825 wayland: defer pointer confine creation until pointer unlock
It is a protocol error to attempt to create a pointer confine (i.e.
`SDL_SetWindowGrab`) while a locked pointer is active, and vice-versa.
Instead of aborting due to a protocol error, this commit makes SDL
gracefully downgrade locked pointers to confines when appropriate.
2020-07-21 13:14:24 -04:00
Ryan C. Gordon
a720d1a294 render: fixes to how we convert touch events for logical scaling.
We now handle HiDPI correctly, and touches are clamped to the viewport. So
if you are rendering to a logical 640x480 in a 720p window, and touch the
letterboxing at point (640,700), it will report the touch at (0.5,1.0) instead
of outside the documented range.
2020-08-09 00:55:39 -04:00
Manuel Alfayate Corchete
c437729b21 kmsdrm: separate requests in different functions so we only need one atomic commit for everything, as expected by atomic design. 2020-08-08 14:27:55 +02:00
Manuel Alfayate Corchete
3b9f1073c6 kmsdrm: wait for possible pending atomic commits before destroying surfaces, and before restoring video on quit. Move messages to the SDL_Log* functions. 2020-08-07 11:53:04 +02:00
Manuel Alfayate Corchete
96c99693a2 kmsdrm: wait for pending atomic commits before restoring videomode and crtc->buffer on VideoQuit, and simplify double-buffer SwapWindow() implementation. 2020-08-06 01:36:56 +02:00
Manuel Alfayate Corchete
09692b6170 kmsdrm: move videomode restoration on VideoQuit() to using the atomic interface instead of the legacy drmModeSetCrtc() function. Refactoring of get_plane_id(). 2020-08-05 18:55:22 +02:00
Manuel Alfayate Corchete
fc722b2d21 kmsdrm: free memory for plane, crtc and connector property tables on VideoQuit. 2020-08-05 15:28:51 +02:00
Manuel Alfayate Corchete
2d69ce08ba kmsdrm: double and triple buffered versions of SwapWindow() are now both reimplemented in atomic pageflipping versions, and can be selected via SDL_VIDEO_DOUBLE_BUFFER env variable. 2020-08-05 02:06:59 +02:00
Manuel Alfayate Corchete
8996ee1786 kmsdrm: update SwapWindow fn, moving it to triple-buffer. 2020-08-03 22:24:49 +02:00
Ryan C. Gordon
ea171c0564 winrt: Another attempt at getting this to compile.
IntPtr isn't a POD type like I thought, so hopefully we can just construct
one that works out? C++/CX is so weird.
2020-08-01 18:58:42 -04:00
Manuel Alfayate Corchete
b131661c6d kmsdrm: rewrite the new SwapWindow() fn to avoid tearing. Double-buffer only for now. 2020-08-01 18:23:34 +02:00
Ryan C. Gordon
282e4c65bf winrt: Patched to compile...?
Microsoft's C++/CX is weird, no idea if this will actually fix it.  :/
2020-07-31 19:42:23 -04:00
Manuel Alfayate Corchete
1a5503ce9f kmsdrm: Moved to the ATOMIC KMS/DRM interface for buffer swapping, leaving DRM-legacy behind. 2020-07-28 21:11:25 +02:00
Ryan C. Gordon
e410b34f92 stdlib: Corrected implementation of SDL_wcsncmp.
It was a copy/paste of SDL_strcmp, apparently, not SDL_strncmp, so it ignored
the maxlen parameter.

Thanks to Jack Powell for pointing this out!
2020-07-24 22:24:03 -04:00
RALOVICH, Kristof
c7eb557d89 kmsdrm: do not leak drmModeConnector
Previously conn was leaked on the success path (when available was
set to SDL_TRUE).
2020-07-20 10:09:07 -07:00
Manuel Alfayate Corchete
412b21b0e8 Rename the gbm device struct from gbm to gbm_dev for better readabilty. 2020-07-20 11:42:23 +02:00
RALOVICH, Kristof
155fdc7ac0 kmsdrm: settle with first card that has a connected connector
Previously the first card with non-empty connectors, encoders
and crtcs would be selected, however KMSDRM_VideoInit could still reject
it if the connector was not connected. This allow finding the first card
(in a multi GPU setup) that is actually connected to a display.
2020-07-19 21:48:17 -04:00
RALOVICH, Kristof
b78b88f7fb kmsdrm: fix typo 2020-07-19 21:46:41 -04:00
Manuel Alfayate Corchete
75fe4b14e3 Added comment about window creation behaviour in KMSDRM. 2020-07-19 19:53:57 +02:00
Manuel Alfayate Corchete
2f660c4fdd Delete windata variable no longer needed in KMSDR_SetDisplayMode(). 2020-07-19 19:11:02 +02:00
Manuel Alfayate Corchete
3a1d7d9c9a Surfaces have to be recreated immediately from KMSDRM_SetDisplayMode(). 2020-07-19 19:09:15 +02:00
Manuel Alfayate Corchete
b6a818b6a2 Fix SDL_Window recreation: drmModeSetCrtc() has to be called everytime the EGL and GBM surfaces are recreated. 2020-07-19 18:45:29 +02:00
Sam Lantinga
71e9df99c7 Fixed bug 5231 - Fix for hardware cursor: size and alpha-premultiplication.
Manuel Alfayate Corchete

I noticed pt2-clone had problems with it's optional hardware mouse on the KMSDRM backend: cursor had a transparent block around it.
So I was investigating and it seems that a GBM cursor needs it's pixels to be alpha-premultiplied instead of straight-alpha.
A
lso, I was previously relying on "manual testing" for the cursor size, but it's far better to use whatever the DRM driver recommends via drmGetCap(): any working driver should make a size recommendation via drmGetCap(), so that's what we use now. I took this decision because I found out that the AMDGPU driver reported working cursor sizes that would appear garbled on screen, and only the recommended cursor size works.
2020-07-19 08:55:01 -07:00
Ryan C. Gordon
b7a4fdd318 metal: Make sure we have a command buffer available before trying to present.
This fixes a case where you render to the backbuffer, then render to a render
target, set the current target back to the backbuffer, and then present
without drawing anything else; in this circumstance, the Present command
would never happen.

Fixes Bugzilla #5011.
2020-07-17 11:16:35 -04:00
Ryan C. Gordon
b5affd12e6 Patched to compile. 2020-07-16 13:28:59 -04:00
Ryan C. Gordon
3b38e61a7d winrt: Fix casting a pointer to int.
Fixes Bugzilla #5202.
2020-07-16 13:25:50 -04:00
Ryan C. Gordon
8babda2c20 egl: SDL_EGL_LoadLibaryOnly() shouldn't set _this->gl_config.driver_loaded = 1
This is handled in in the higher-level SDL_GL_LoadLibrary().

All uses of SDL_EGL_LoadLibrary (which calls the Only version) are just
target-specific wrappers for their own GL_LoadLibrary hook, with two
exceptions which now handle driver_loaded correctly (although it's
questionable if these init-if-no-one-did-it-correctly-already code blocks
should exist at all, fwiw).

Fixes Bugzilla #5190.
2020-07-16 13:18:19 -04:00
Sam Lantinga
cab1a715f5 Fixed bug 5233 - PS3 Gamepad Motion Control not correctly ignored on Linux
Igor Morgado

PS3 Controller motion sensor string is being reported as

`Gasia Co.,Ltd PS(R) Gamepad Motion Sensors`

But `src/joystick/SDL_gamecontroller.c` line1690 only ignores if matches the string  `Controller Motion Sensors`.

```
#if defined(__LINUX__)
    if (name && SDL_strstr(name, "Controller Motion Sensors")) {
        /* Don't treat the PS3 and PS4 motion controls as a separate game controller */
        return SDL_TRUE;
    }
#endif
```

Therefore, SDL is mapping 2 Game controllers instead one.

Maybe reduce the substring to match `Motion Sensors` instead.


A simple log from my application is shown below:

INFO: Game controller device 0 - PS3 Controller:PS3 Controller found.
INFO: Controller 0: Player 0: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad
INFO: Game controller device 1 - PS3 Controller:PS3 Controller found.
INFO: Controller 1: Player 1: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad Motion Sensors
2020-07-15 10:15:52 -07:00
M Stoeckl
a78b9763f1 Reuse Wayland connection from availability check 2020-07-14 19:18:16 -04:00
M Stoeckl
8669a87f05 Reuse X11 connection from availability check
Instead of creating an X11 connection to test that X11 is available,
closing the connection, and then reconnecting for real, use the same
connection to handle both cases.

The X11 connection retry delay mechanism in the case where X11 is
dynamically loaded has been removed. It was only necessary to avoid
authetnication token reuse from the XOpenDisplay call that used to
exist in X11_Available. Now that this call is only made once, it
is no longer needed.

Also drop unused and inapplicable code from a comment.
***
2020-07-14 21:13:27 -04:00
M Stoeckl
052a13738d Merge VideoBootStrap::available into VideoBootStrap::create
The two are only ever called together, and combining them makes it possible
to eliminate redundant symbol loading and redundant attempts to connect
to a display server.
2020-07-12 19:11:15 -04:00
Ozkan Sezer
49ec65587a fix bug #5228 -- Add AltiVec detection for FreeBSD.
thanks Piotr Kubaj.
2020-07-11 08:10:02 +03:00
stfx
b162629546 cmake: Fix building with -DSDL_HAPTIC=Off 2020-07-08 17:28:34 +02:00
Ryan C. Gordon
0e98040d43 joystick: Linux joysticks now recover better from dropped events.
Fixes Bugzilla #4830.
2020-06-28 16:23:05 -04:00
Sylvain Beucler
e594a6738a emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY
See https://github.com/emscripten-core/emscripten/issues/10746

and

https://github.com/emscripten-ports/SDL2/pull/112

Fixes Bugzilla #4997.
2020-06-27 16:25:47 -04:00
Sylvain Beucler
01af7b0254 emscripten: support pseudo-synchronous screen refresh and events update using asyncify 2020-06-27 16:22:50 -04:00
Ryan C. Gordon
694fea8ad8 video: Make SDL_CreateWindow use SDL_Init(SDL_INIT_VIDEO), not SDL_VideoInit.
Otherwise, the video subsystem won't deinitialize during SDL_Quit().

Fixes Bugzilla #5067.
2020-06-26 21:37:29 -04:00
Ryan C. Gordon
1947ca7028 video: Changed SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS to default to FALSE.
Fixes Bugzilla #5106.  (and probably many others, too!)
2020-06-26 20:16:43 -04:00
Sam Lantinga
ce293eed8d Fixed bug 5208 - Fix libGL loading on OpenBSD 2020-06-23 10:12:24 -07:00
Sam Lantinga
c2b8530591 Fixed bug 5209 - cpuinfo recognize OpenBSD ARM
Brad Smith

OpenBSD/arm only supports ARMv7 and and not any CPUs that do not support NEON.
2020-06-23 10:09:29 -07:00
Ozkan Sezer
4ba0a84718 core/linux/SDL_threadprio.c: fix build against older glibc versions 2020-06-22 23:24:02 +03:00
Sam Lantinga
b9f55b6d80 Fixed bug 5199 - Fix KMSDRM_CreateWindow() segfault when starting L?VE2D engine.
Manuel Alfayate Corchete

This small patch fixes the KMSDRM_CreateSurfaces() call in KMSDRM_CreateWindow(), that was segfaulting deeper into SDL internals because the windata->viddata pointer wasn't set before the KMSDRM_CreateSurfaces() call.
So that's what this small patch does.

Now, L?VE2D works perfectly well on the Raspberry Pi 3, instead of just segfaulting.
2020-06-19 10:37:14 -07:00
Sam Lantinga
56622f9c92 Fixed bug 5126 - MinGW compile error SDL_windowssensor.c
Martin Gerhardy

SDL_windowssensor.c includes InitGuid.h - but it should be initguid.h
2020-06-17 10:09:07 -07:00
James Legg
f1d5ced167 x11: Fix spurious keyboard focus events 2020-06-17 12:48:40 +01:00
Sam Lantinga
48989e2a87 Reverted comment change in previous commit 2020-06-17 08:47:27 -07:00
Sam Lantinga
a7ff6e9615 Fixed overflow in surface pitch calculation 2020-06-17 08:44:45 -07:00
stfx
efe0935904 Fix compile without DIRECTX 2020-06-15 10:31:16 +02:00
Ozkan Sezer
163896543f fix watcom build of SDL_test_common.c 2020-06-14 12:05:56 +03:00
Ethan Lee
2aa8974f97 Add SDL_SIMDRealloc 2020-06-11 12:03:33 -04:00
Sam Lantinga
20aada0efc Fixed bug 5170 - Build fails when using Visual Studio 2017 with Windows 10 SDK 10.0.19041.0 in uwp
JackBoosY

In src/video/winrt/SDL_winrtgamebar.cpp line 55:

    virtual HRESULT STDMETHODCALLTYPE add_VisibilityChanged(
        __FIEventHandler_1_IInspectable *handler,
        Windows::Foundation::EventRegistrationToken *token) = 0;

The macro __FIEventHandler_1_IInspectable defined in windows.fondation.h(Windows10 SDK 10.0.17763.0) line 3576:
#define __FIVector_1_Windows__CFoundation__CPoint ABI::Windows::Foundation::Collections::__FIVector_1_Windows__CFoundation__CPoint_t

but no longer exists in Windows 10 SDK 10.0.19041.0.
After searching this macro in the sdk include path, I found that it was defined in many header files. But it should be replaced in windows.system.h .
2020-06-10 09:38:43 -07:00
Sam Lantinga
44f50c647e Fixed bug 5171 - PollEvent impacts performance in 2.0.12
On some systems, GetClipCursor() impacts performance when called frequently, so only call it every once in a while to make sure we haven't lost our capture.
2020-06-09 21:47:41 -07:00
Sam Lantinga
511a9702fc Fixed whitespace 2020-06-09 21:43:00 -07:00
Sam Lantinga
aefe19ff08 Added support for the NACON Revolution Pro Controller 3 and the GameStop PS4 Fun Controller 2020-06-09 11:31:39 -07:00
Sam Lantinga
6f241bd520 Fixed build 2020-06-09 10:47:29 -07:00
Sam Lantinga
086be21e7a ControllerList: add support for NACON asymetric controller and Revolution 3, Hori mini wireless ps4 controller, and 2 PDP switch controllers 2020-06-09 10:47:27 -07:00
Sam Lantinga
3b76109f64 ControllerList: remove giotek controller from list - vid/pid appears to be reused in bunch of devies including ones with different fw/protocol and treating as ps4 controller breaks them. 2020-06-09 10:47:25 -07:00
Sam Lantinga
a9cfac3835 Controller: Deadzone improvements 2020-06-09 10:47:23 -07:00
Sam Lantinga
9fa8d6d0be Define constants not available on older kernels 2020-06-08 17:07:55 -07:00
Sam Lantinga
3ac24bfc1a Fixed mouse drag with an external mouse on iOS 2020-06-08 17:01:50 -07:00
Sam Lantinga
ff53521bc6 Fixed Bluetooth audio output on Apple TV 2020-06-04 12:26:57 -07:00
Sam Lantinga
cced5eb937 Fixed bug 5169 - Can not build current sources because of recent thread management changes
Manuel Alfayate Corchete

I'm trying to build SDL2 with threads support here in GNU/Linux, both X86 and ARM, and it does not seem to be possible ATM:


/home/manuel/src/SDLLLL/src/core/linux/SDL_threadprio.c:233:26: error: 'rtkit_max_realtime_priority' undeclared (first use in this function)
2020-06-04 09:23:18 -07:00
Sam Lantinga
958c42827c Fixed build warning 2020-06-04 09:13:49 -07:00
Ryan C. Gordon
60435712f2 video: Set window->surface NULL after freeing it.
Otherwise, when SDL_CreateWindowFramebuffer() is called again, it will return
the free'd surface instead of creating a new one.
2020-06-03 16:42:19 -04:00
Sam Lantinga
eea0b0e088 Fixed bug 5168 - Memory leak in RAWINPUT_JoystickOpen
meyraud705

Variable 'hwdata' is not freed in RAWINPUT_JoystickOpen if device->driver->OpenJoystick() fails.
2020-06-02 17:08:31 -07:00
Cameron Gutman
134362e745 Enable Xbox One HIDAPI driver on macOS
The Xbox One HIDAPI driver is required on macOS for Xbox One S Bluetooth
support since https://hg.libsdl.org/SDL/rev/10c3a10908e9
2020-04-25 19:15:51 -07:00
Sam Lantinga
ac1f174ad5 Fixed bug 5167 - Memory leak in GuessXInputDevice
meyraud705

Variable 'devices' is not freed if function GuessXInputDevice, in SDL_xinputjoystick.c, return early.
2020-06-02 17:02:37 -07:00
Sam Lantinga
d48c97c4a4 Fixed bug 5147 - KMSDRM: SetWindowFullscreen() failing with SDL_WINDOW_FULLSCREEN_DESKTOP
Manuel Alfayate Corchete

This patch is needed so programs that do this work as expected:
1) Start in a different video mode than the mode used by the system and then...
2) Try to go fullscreen with the mode originally used by the system via SetWindowFullScreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag.

An example would be pt2-clone in https://github.com/8bitbubsy/pt2-clone.
This program does this:

Starts with:

video.window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED,
    SDL_WINDOWPOS_CENTERED, screenW, screenH, windowFlags);


and then, *IF* the user has configured it in fullscreen mode in its .ini, it tries to go fullscreen with the desktop mode:

SDL_SetWindowFullscreen(video.window, SDL_WINDOW_FULLSCREEN_DESKTOP);


This sequence of operations is currently failing because SDL_SetDisplayModeForDisplay() in SDL_video.c fails because display->desktop_mode is not being initialized with its correct value: SetDisplayMode() in SDL_kmsdrmvideo.c will not be able to set the mode because it detects the mode to have a driverdata of 0x0 ("if (!modedata)") and rightfully returns an error.

So, the included patch fixes this small problem, and programs that first change the video mode and then try to go fullscreen with the system video mode will now work.
The patch simply fixes an small omission, but its really needed now that dynamic video mode changing was implemented on the KMSDRM backend.
2020-06-02 16:57:20 -07:00
Sam Lantinga
9325b22ef0 Fixed bug 5113 - SDL_UpdateWindowSurfaceRects BitBlt the entire surface on Win32
Ryan C. Gordon

As discussed here:
https://discourse.libsdl.org/t/question-about-implementation-of-sdl-updatewindowsurfacerects/27561

"As you can see this function [WIN_UpdateWindowFramebuffer, in src/video/windows/SDL_windowsframebuffer.c] calls BitBlt on entire screen, even though it accepts the rects. Rects variable is not even used in this function at all. Now my question is why is that the case?"
2020-05-29 21:26:32 -07:00
Sam Lantinga
d000c1cd6d Fixed bug 5155 - HIDAPI_JoystickDisconnected incorrect array shift
Anthony Pesch

I was looking into my own input bug and noticed an issue in the HIDAPI code while looking over it. I don't have a controller that goes down this path to test and try to provoke the issue, but it looks pretty straight forward.

The memmove to shift the joystick id array on disconnect isn't scaling the size by sizeof(SDL_JoystickID), likely corrupting the ids on disconnect.
2020-05-29 21:22:11 -07:00
Cameron Gutman
77b0dad271 cocoa: Change Caps Lock behavior to toggle instead of locking
It currently behaves like a locking key which is pressed
when Caps Lock is enabled and released when disabled. This
means that apps that trigger events on Caps Lock key down will
only fire these events every other time Caps Lock is pressed.
2020-05-25 20:55:29 -07:00
Sam Lantinga
bdfd1b68ba Fixed bug 5146 - SDL_RenderFillRect doesn't work in DirectFB
Lacky

It looks like refactoring of SDL2 internal API has broken SDL_RenderFillRect for DirectFB. In new version function SDL_RenderFillRect returns 0, but rectangle is not visible.

Replacing "count" with "len" in the argument list for SDL_memcpy in DirectFB_QueueFillRects fixes problem.
2020-05-29 16:02:49 -07:00
Tudor Brindus
a6ca61d732 wayland: update pointer position on initial enter event 2020-05-21 00:06:09 -04:00
Sam Lantinga
ae9ff11bae The zero happens at a higher level now 2020-05-29 14:54:07 -07:00
Sam Lantinga
39c958bbaa Initialize the raw_map before getting controller mappings from the driver 2020-05-29 14:48:39 -07:00
Sam Lantinga
2db049473b Fixed variable names to be consistent across functions 2020-05-29 14:48:05 -07:00
Sam Lantinga
345b4d7e14 Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification
Jan Bujak

I wrote a new driver for my gamepad on Linux. I'd like SDL to support it out-of-box, as currently it just treats it as a generic joystick instead of a gamepad. From what I can see the only way to do that is to either 1) pick one of the already supported controllers' PID, VID and button layouts and have my driver send that (effectively lying that it's something else), or 2) submit a preconfigured, hardcoded mapping to SDL.

Both of those, in my opinion, are silly when we already have the Linux Gamepad Specification which standarizes this:

https://www.kernel.org/doc/html/v4.15/input/gamepad.html

Unfortunately SDL doesn't make use of it currently. So I've took it upon myself to add it; patch is in the attachments.

Basically what the patch does is that if SDL finds no built-it controller mappings for a given joystick it then asks the joystick backend to autodetect it, and that uses the relevant evdev bits to figure out which button/axis is which. (See the specs for more details.)

With this patch applied my own driver for my controller works out-of-box with SDL with no extra configuration and is correctly recognized as a gamepad; this is also going to be the case for any other driver which follows the Linux Gamepad Specification.
2020-05-29 13:37:21 -07:00
James Legg
e2dbed9cfe SDL_blit: Fix undefined bitshift operations
Arithmatic operations promote Uint8 to signed int. If the top bit of a
Uint8 is set, and it is left shifted 24 places, then the result is not
representable in a signed 32 bit int. This would be undefined behaviour
on systems where int is 32 bits.
2020-05-29 13:05:37 +01:00
Brendan Shanks
032fa681a8 Add Logitech G29 to steering wheel list 2020-04-24 14:03:30 -07:00
Ryan C. Gordon
aa259ed52d wayland: Changed output removal in handle_surface_leave()
No longer needs an extra malloc, handles unexpected cases like the same
output being listed twice.
2020-05-28 15:18:41 -04:00
Ryan C. Gordon
ce7ae4ec8d wayland: Move buffer copy into mime_data_list_add()
It makes it clearer who owns the memory, and more reasonable to free it on
failure in the creating function.

(and, of course, pacifies static analysis.)
2020-05-28 14:57:10 -04:00
Ryan C. Gordon
22da9d4d77 wayland: assert that mmap() didn't return NULL.
In practice, it never _would_, but in theory it _might_, so this assertion
tells the static analyzer not to worry about it.
2020-05-28 14:47:55 -04:00
Sam Lantinga
1a1f1704a2 Don't include the iOS joystick driver if joysticks are disabled 2020-05-27 10:35:43 -07:00
Sam Lantinga
57149c2410 Fixed building with --disable-joystick on iOS 2020-05-27 10:27:20 -07:00
Sam Lantinga
cf01ee1694 Fixed building with --disable-joystick on Linux 2020-05-27 10:27:04 -07:00
Sam Lantinga
e9f567c707 Fixed building on iOS with MFI controllers disabled 2020-05-27 10:14:08 -07:00
Sam Lantinga
97ca96bdee Use nil instead of NULL for Objective-C objects 2020-05-27 10:13:01 -07:00
Sam Lantinga
03a7abf80c Fixed building with --disable-joystick on macOS 2020-05-27 09:57:26 -07:00
Sam Lantinga
af5eb56c76 Fixed uninitialized variable warning 2020-05-27 09:28:03 -07:00
Sam Lantinga
31916f11aa Fixed compiler warning building on FreeBSD 2020-05-27 09:22:12 -07:00
Sam Lantinga
bcbaa4ec1f If there isn't a GetGlobalMouseState() implementation, fall back to the normal one. 2020-05-26 16:34:50 -07:00
Sam Lantinga
437577f91e Fixed bug 5141 - KMSDRM: manage SDL_GetGlobalMouseState()
Manuel Alfayate Corchete

On the KMSDRM backend, there is no such thing as a desktop, yet some programs could (and DO) use SDL_GetGlobalMouseState().
So I think its good idea that, in KMSDRM, it returns the same mouse coordinates anyway as SDL_GetMouseState() would return. There is nothing else it could return, as far as I can understand, since there is no desktop anyway.
This small patch does precisely that.
2020-05-26 16:29:26 -07:00
Sam Lantinga
1df0a1e497 Fixed bug 5140 - KMSDRM: Dynamic vsync toggle does not work
Manuel Alfayate Corchete

The KMSDRM backend was doing things wrong because of some small (but important) misconceptions on how KMS/DRM works: to implement a largely broken non-vsync refresh mechanism, the SwapWindow() function was issuing new pageflips before previous ones had completed, thus causing EBUSY returns, buffer mismanagement, etc... resulting in general breakage on vsync disabling from apps, that would not allow vsync to work again without KMSDRM video re-initialization.
To further clarify, on most DRM drivers async pageflips are NOT working nowadays, so all issued pageflips will complete on next VBLANK, NOT ASAP (calling drmModePageFlip() with the DRM_MODE_PAGE_FLIP_ASYNC flag will return error).

The old code was assuming that can just issue a synchronous (=on VBLANK) pageflip and then pass a 0 timeout to the pull() function so we do not wait for the pageflip event, thinking that this will lead to correct non-vsynced screen updates from the program: That is plain wrong.
Each pageflip has to be waite before issuing a new one, ALWAYS. And if we do not support ASYNC pageflips on the DRM driver level, then we are forced to wait for the next VBLANK. There is no way around it.

I have also added many comments on the KMSDRM code. This is needed for future reference for me or others who may need to look at this code: KMS/DRM terminology regarding what SYNC and ASYNC mean in pageflip terms, and where to do certain things and why, is not trivial. It is not desirable or possible to invest time on researching the same concepts every time there is need to dive into this code. So please leave all these comments in the patch.
2020-05-26 16:27:00 -07:00
Sam Lantinga
15294e2121 Fixed iOS build 2020-05-26 13:54:47 -07:00
Sam Lantinga
cc2fe84d73 Getting closer. 2020-05-26 13:19:48 -07:00
Sam Lantinga
0713c5790d More Linux fixes. 2020-05-26 13:19:44 -07:00
Sam Lantinga
c7d1dab1fe Rename Linux-only variable. 2020-05-26 13:19:41 -07:00
Sam Lantinga
b820a81ffb Include SDL_hints.h. 2020-05-26 13:19:35 -07:00
Sam Lantinga
de866e6606 Include SDL_hint.h. 2020-05-26 13:19:29 -07:00
Sam Lantinga
abd5841850 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work.
1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority.
2. Add a hint to override SDL's default behavior for scheduler policy.
3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority.
4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired.
5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API.
6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires.  Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
2020-05-26 13:19:19 -07:00
Sam Lantinga
f16e6bfa8e Fixed creating a metal renderer without specifying a metal window 2020-05-25 14:10:51 -07:00
Sam Lantinga
f176d7fda0 Added a note not to use XinputUap.dll for XInput support 2020-05-22 16:45:02 -07:00
Ryan C. Gordon
600a2fc7c3 locale: Removed unused variable. 2020-05-21 04:01:37 -04:00
Ryan C. Gordon
a299fdd789 sensor: Fixed compiler warnings on mingw64. 2020-05-21 03:52:48 -04:00
Ryan C. Gordon
ba11122ea0 locale: Fixed compiler warning on Visual Studio. 2020-05-21 03:48:56 -04:00
Ryan C. Gordon
b4e76b58e7 sensor: Fix overaggressive search/replace. :) 2020-05-20 17:32:23 -04:00
Ryan C. Gordon
27c38eb22e sensor: Correct fix for redefinition of various symbols. 2020-05-20 17:22:52 -04:00
Ryan C. Gordon
5fe34a4079 hidapi: Fix compiler warning. 2020-05-20 17:01:25 -04:00
Ryan C. Gordon
c9d358bce9 sensor: Fix build on various Windows compilers with various predefinitions. 2020-05-20 16:59:35 -04:00
Ryan C. Gordon
68777406e5 windows: Fix calls to CoCreateInstance() so last parameter is a LPVOID *. 2020-05-20 16:58:33 -04:00
Ryan C. Gordon
539125b895 locale: Fixed compiler warning on WinRT. 2020-05-20 16:43:02 -04:00
Ryan C. Gordon
d66b73666d locale: Patched to compile on Windows Phone. 2020-05-20 16:15:14 -04:00
Ryan C. Gordon
3808b120dc locale: Make sure C++ implementations (Haiku!) use C linkage. 2020-05-19 03:14:46 -04:00
Ryan C. Gordon
863776f8dd haiku: Another attempt at fixing build. 2020-05-19 01:19:52 -04:00
Ryan C. Gordon
e53d39cf35 haiku: Patched to compile. 2020-05-19 00:09:59 -04:00
Sylvain Becker
db4246f695 Only set colorkey, if converted surface has no alpha channel (2979) 2020-05-17 21:23:17 +02:00
Sylvain Becker
f6197aec85 Fix issue with colorkey, palette and format conversion
Set the colorkey information on the converted surface.
Test-case in bug 3826/2979, conflicting with bug 4798
2020-05-17 20:45:55 +02:00
Sylvain Becker
39690a0478 Fix static analysis warning in SDL_render.c 2020-05-15 21:33:47 +02:00
Ryan C. Gordon
daf360e040 emscripten: Fix crash in SDL_SetWindowTitle().
This patch came from emscripten-ports, thanks!

Fixes Bugzilla #5133.
2020-05-13 16:48:42 -04:00
Tudor Brindus
1a291ab118 wayland: add support for SDL_SetWindowGrab 2020-04-17 13:55:44 -04:00
Sam Lantinga
b47f577a9d Fixed bug 5098 - macOS CreateWindowFrom doesn't work with high-dpi displays
michaeljosephmaltese

Display ends up taking only 1/4 of the screen area. It needs to call "setWantsBestResolutionOpenGLSurface:highdpi", like when creating a window the normal way.
2020-05-11 14:36:23 -07:00
Sam Lantinga
eadc8693dd Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5
wengxt

Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.

The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
2020-05-11 14:31:04 -07:00
Sylvain Becker
2491f16f85 Android: send SDL_LOCALECHANGED when locale changes 2020-05-08 21:40:28 +02:00
Sylvain Becker
2a4ddeeea9 Android: fix missing prototype warning 2020-05-08 11:15:38 +02:00
Sylvain Becker
0059ace0b4 Android: factorize asset manager code (bug 2131 and 4297) 2020-05-08 11:00:51 +02:00
Ryan C. Gordon
fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga
1e5dd06f83 Added support for the HORI Real Arcade Pro on Mac OSX and Linux 2020-05-06 12:19:58 -07:00
Sam Lantinga
cd2bdaef1c ControllerList: add PDP Faceoff Deluxe Audio Switch Controller and HORI Real Arcade Pro V Switch Edition 2020-05-06 11:19:52 -07:00
Sam Lantinga
0e5b48d2d8 ControllerList: add NACON Revolution Unlimited (and it's dongle) and NACON Daija fight stick. 2020-05-06 11:19:47 -07:00
Ryan C. Gordon
b3a34c94e0 hid: Add Microsoft Precision Mouse to the joystick blacklist.
Same deal as the Razer keyboards, it hangs the enumeration.
2020-05-06 03:18:25 -04:00
Ryan C. Gordon
85d97410d4 hid: Cleanup Windows joystick blacklist code, to make additions easier. 2020-05-06 03:13:44 -04:00
Ryan C. Gordon
b0a20a153c stdlib: Fixed compiler warnings about int vs size_t. 2020-05-05 12:48:55 -04:00
Sam Lantinga
0eb6512b53 Fixed bug 5121 - Use SDL_calloc instead of calloc in Wayland_CreateWindow
meyraud705

'SDL_Windows::driverdata' of a Wayland window is allocated by calloc in 'Wayland_CreateWindow' but freed by SDL_free in 'Wayland_DestroyWindow'.
2020-05-04 13:19:26 -07:00
Sam Lantinga
65ad45340d Improvement for bug 3446 - The haptic API does not allow to select the direction axes
meyraud705

I see how the documentation is confusing. I think that the choice of the axis is an implementation detail. The documentation should state the goal of this value, so I propose this wording:

    "Use this value to play an effect on the steering wheel axis. This provides
     better compatibility across platforms and devices as SDL will guess the
     correct axis."

Value could even be renamed 'SDL_HAPTIC_STEERING_AXIS'.

For Linux, sending an effect on the X axis with a Logitech wheel works. Others brands don't have driver for Linux as far as I know.
2020-05-04 13:17:43 -07:00
Sam Lantinga
11723411ab Added support for the Razer Kishi 2020-05-04 10:16:10 -07:00
Ryan C. Gordon
8601996fbc hints: Allow specifying audio device metadata.
This is only supported on PulseAudio. You can set a description when opening
your audio device that will show up in pauvcontrol, which lets you set
per-stream volume levels.

Fixes Bugzilla #4801.
2020-05-03 22:13:48 -04:00
Sam Lantinga
8b60d39cb0 Fixed bug 5112 - CMake won't compile in VS2019
dark_sylinc

Trying to build SDL with VS2019 using CMake will encounter a linking error

More specifically:

    1>SDL_string.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_vsnprintf_REAL
2020-05-02 14:43:17 -07:00
Sam Lantinga
b0b12e46ba Fixed running on older versions of iOS 2020-04-27 13:31:10 -07:00
Sam Lantinga
01fd8130fd Fixed compiler warning 2020-04-23 11:13:02 -07:00
Sam Lantinga
c6b24b4b7c Added support for the following controllers:
* 8BitDo N30 Pro 2
* 8BitDo SN30 Gamepad
* 8BitDo SN30 Pro+
* 8BitDo Zero 2
* SZMY-POWER PC Gamepad
* ThrustMaster eSwap PRO Controller
* ZEROPLUS P4 Wired Gamepad

In additional, all 8BitDo controllers use SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to have the correct mapping based on user preferences.
2020-04-23 11:07:07 -07:00
Sam Lantinga
4727f79416 Don't use the WGI driver if another driver is already handling the joystick 2020-04-23 10:13:17 -07:00
Sam Lantinga
6ca7f510ae Fixed crash trying to get battery status on some devices 2020-04-23 09:35:32 -07:00
Sam Lantinga
0f374b069b Fixed build on older Visual Studio, enable new features on newer Visual Studio 2020-04-22 15:42:32 -07:00
Sam Lantinga
589d636bb9 Fixed rare crash when creating an X11 window 2020-04-22 14:57:06 -07:00
Sam Lantinga
d12ea89c1e Added support for the following controllers:
* PDP Afterglow Switch Controller
* Thrustmaster ESwap Pro PS4 controller
* Giotek VX4
* Generic PS4 controller vid/pid that several knock offs use
2020-04-22 10:50:50 -07:00
Ryan C. Gordon
3625b83c63 hid: Add Razer Arctosa keyboard to hid enumeration blacklist.
Hangs SDL, same as the Razer Lycosa.

Fixes Bugzilla #5101.
2020-04-21 01:32:48 -04:00
Ryan C. Gordon
09ca66bf66 SDL_error: simplified error string management.
This patch removes deferred error string formatting: now we do it during
SDL_SetError(), so there's no limit on printf-style arguments used.

Also removes stub for managing error string translations; we don't have the
facilities to maintain that and the way we set arbitrary error strings
doesn't really make this practical anyhow.

Since the final error string is set right away and unique to the thread,
we no longer need a static buffer for legacy SDL_GetError(), and we don't
have to allocate 5x 128-byte argument fields per-thread. Also, since we now
use SDL_vsnprintf instead of parsing the format string ourselves, there's a
lot of code deleted and we have access to more robust formatting powers now.

This does mean the final error strings can't be more than 128 bytes, down
from the theoretical maximum of around 768, but I think this is probably okay.
They might truncate but they will always be null-terminated!

Fixes Bugzilla #5092.
2020-04-21 01:30:36 -04:00
Ryan C. Gordon
67760f0ed7 joystick: Don't report duplicate recentering events for game controllers. 2020-04-20 18:58:18 -04:00
Ryan C. Gordon
c5f2a1ce4e joystick: On disconnect, recenter all game controller inputs.
The joystick layer can't necessarily give us perfect centering, but we know
that the game controller level has logical absolute idle positions that have
nothing to do with the physical device.

So send game controller events to make it look like the device is completely
untouched before sending the final removal event.
2020-04-20 16:01:36 -04:00
Sam Lantinga
aba2792896 Added a Windows Gaming Input joystick driver
This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
2020-04-18 21:41:37 -07:00
Sam Lantinga
b90b59279e Added support for the Razer Atrox Arcade Stick 2020-04-17 21:30:58 -07:00
Sam Lantinga
dbcda0b212 Added support for the Razer Wolverine Ultimate 2020-04-17 21:30:56 -07:00
Sam Lantinga
2b32385502 Don't send rumble packets too quickly to Nintendo Switch Pro controllers over Bluetooth 2020-04-17 15:08:48 -07:00
Sam Lantinga
c02f54a0ed Fixed the default face button mapping for Nintendo Switch Pro controllers 2020-04-17 15:08:46 -07:00
Ryan C. Gordon
eaaa809e40 hidapi: Blacklist the Razer Lycosa keyboard from enumeration.
It's not a joystick and it hangs device enumeration.
2020-04-15 13:33:09 -04:00
Ryan C. Gordon
a7a4e16b5b haiku: Patched to compile. 2020-04-15 13:31:54 -04:00
Sam Lantinga
a990a34ac4 Cleanly switch between audio recording, playback, and both, on iOS 2020-04-14 22:26:02 -07:00
Sam Lantinga
14661d3f30 Added support for mousewheel on iOS 2020-04-14 17:31:31 -07:00
Sam Lantinga
50b1c19549 Fixed bug 5091 - Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput
meyraud705

On line 220 of SDL_hidapi_xbox360.c https://hg.libsdl.org/SDL/file/4608f0e6e8e3/src/joystick/hidapi/SDL_hidapi_xbox360.c#l220

if (!XINPUTGETSTATE(user_index, &xinput_state[user_index].state) == ERROR_SUCCESS) {

logical not is only applied to the left hand side of this comparison.

I think you mean:
if (XINPUTGETSTATE(user_index, &xinput_state[user_index].state) != ERROR_SUCCESS) {
2020-04-14 09:55:33 -07:00
Sam Lantinga
2ae1c0f5d0 Allow Bluetooth headphones for iOS playandrecord mode 2020-04-14 09:52:27 -07:00
Sam Lantinga
f34d2c60cc Added zlib license for Steam Controller headers 2020-04-14 07:35:35 -07:00
Sam Lantinga
3e4856c97f Fixed mouse button mapping on iOS 2020-04-13 23:07:54 -07:00
Sam Lantinga
e1215e857f Fixed mouse button mapping on iOS 2020-04-13 22:50:46 -07:00
Sam Lantinga
dbf7f84fd9 Implemented left/right mouse click detection on iOS 2020-04-13 22:29:10 -07:00
Sam Lantinga
171ba00a6a Hide the mouse cursor appropriately on iOS 2020-04-13 19:44:26 -07:00
Ryan C. Gordon
132f87c3a1 opengl: Don't try to do Desktop OpenGL stuff if support isn't available. 2020-04-13 22:06:12 -04:00
Ryan C. Gordon
a96d8a4355 render: Fixed compiler warning about implicit cast. 2020-04-13 22:05:36 -04:00
Sam Lantinga
6f3fa02e27 Make sure we're using the bounds of the view for our mouse region 2020-04-13 18:25:38 -07:00
Sam Lantinga
cab1ee9cbc Don't build iOS mouse support on Apple TV 2020-04-13 15:57:04 -07:00
Sam Lantinga
e5d3629931 Added support for new mouse APIs in iOS 13.4 2020-04-13 15:46:12 -07:00
Ryan C. Gordon
e96b05c395 egl: Attempt to make this compile on WinRT, etc. 2020-04-13 18:21:28 -04:00
Sam Lantinga
1d8797876a Fixed implicit linkage to ftol2() on Windows 2020-04-13 13:24:56 -07:00
Sam Lantinga
c302c1abb8 Fixed build 2020-04-13 13:24:19 -07:00
Sam Lantinga
bf87604ef1 Fixed rare crash when unplugging Xbox controller on Windows 2020-04-13 12:33:29 -07:00
Conn O'Griofa
c0a875faff SDL_EGL_ChooseConfig: don't fall through if no matching format exists
On Raspberry Pi 3 via the VC4 driver in firmware KMS mode, none of the
found configs match the desired format, causing the function to fall through
without any config being selected.

Fix by first iterating over the found configs, and if no match exists,
don't exclude the non-matching configs. This should fix RPI3 and possibly other
targets without breaking targets that have a matching native format (such as RPI4).
2020-04-13 14:48:38 -04:00
Ryan C. Gordon
64617d259a opengl: Convert an int to an SDL_bool. 2020-04-13 14:45:40 -04:00
Ryan C. Gordon
389c8995d2 opengl: Allow SDL_GL_MakeCurrent() to accept a NULL window (thanks, Martin!).
This allows you to bind surfaceless contexts on a background thread to, for
example, load assets in a separate context, for platforms that have different
requirements about sharing surfaces, etc.

Martin's notes on the matter:

"Here's a patch that enables passing NULL windows to SDL_GL_MakeCurrent, if
the involved APIs allow it. Currently, this is only the case for EGL, and
even then only if some specific extensions are present (which they usually
are).

If "surfaceless" contexts are not supported, SDL_GL_MakeCurrent continues to
generate an error (albeit with a more specific error message than it used to),
so this should not break anything that wasn't broken before."

(Please see https://bugzilla.libsdl.org/show_bug.cgi?id=3695 for more
discussion.)

Fixes Bugzilla #3695.
2020-04-13 14:44:21 -04:00
Jay Petacat
8a5ee3faf9 video: NULL out pointer to freed window surface
This behavior matches SDL_RecreateWindow and makes it less likely that
another piece of code (e.g. a DestroyWindowFramebuffer implementation)
will attempt to use or free the stale surface pointer.
2020-04-12 00:55:52 -04:00
hmk
0918903f3c render: add a hint for toggling relative scaling
Fixes Bugzilla #4811.
2019-09-30 22:54:16 +03:00
hmk
aa188048f1 render: Scale relative mouse motion better for logical sizing
From hmk:

"When scaling is enabled (e.g. via SDL_RenderSetLogicalSize, size not equal
to window size), mouse motion events are also scaled.  Small motions are
rounded up (SDL_max() when the value after scaling is less than 1), while
larger motions are truncated by the floating point -> integer conversion.

https://hg.libsdl.org/SDL/file/b18197f9bf9d/src/render/SDL_render.c#l658

The end result feels something like mouse reverse mouse acceleration + angle
snapping at low speeds, but less consistent (amount of truncation & rounding
depends on how fast the mouse is moved) and potentially much worse if the
scaling factor is large.  This pretty much makes it useless for anything
where you need precise mouse aiming (think of games).  I suspect this is why
aiming gets so terrible in some games that let you use scaling to reduce the
render resolution (e.g. Ion Fury).

With 4x4 scaling, I can reproduce a situation where it takes three fast flicks
of the mouse across the pad to undo one slow sweep across the pad.  In other
words, extreme reverse acceleration.  This does not happen when scaling is
disabled.

Furthermore, any game that uses relative mouse motion events for 3D camera
rotation probably wants the raw mouse deltas and not a value that depends on
scaling and resolution and rounding and truncation.  Ideal camera rotation
just takes mouse input, multiplies it by sensitivity, and adds it to the
angle-in-radians or whatever measure is used for yaw & pitch.  Pixels and
screen resolution or window dimensions should not be a part of the equation
at all, even if it could be implemented without rounding errors.

[...]

This [patch] completely eliminates angle snapping for me, and makes
sensitivity consistent.  In other words, it's completely usable for, say,
aiming in a first person shooter."

Partially fixes Bugzilla #4811.
2020-04-10 12:23:08 -04:00
Ryan C. Gordon
d292f6bd4f stdlib: Add SDL_trunc and SDL_truncf 2020-04-10 12:17:14 -04:00
Ryan C. Gordon
a791689086 metal: Added some support interfaces to Apple's Metal API (thanks, Caleb!).
Caleb Cornett's comments:

"A few weeks ago, Alex added a partial Metal API to SDL2:

https://hg.libsdl.org/SDL/rev/22c8e7cd8d38

I noticed it was missing a few features that would help Metal become a
first-class citizen in SDL, so I went ahead and wrote them! Here are the new
APIs:

1. SDL_WINDOW_METAL flag for SDL_CreateWindow(). This allows the programmer
to specify that they intend to create a window for use with SDL_MetalView.
The flag is used to ensure correct usage of the API and to prevent
accidentally defaulting to OpenGL on iOS.

2. SDL_Metal_GetLayer(). This function takes a SDL_MetalView and returns a
pointer to the view's backing CAMetalLayer. This simplifies things
considerably, since in the current version of the SDL_Metal API the
programmer is required to bridge-cast a SDL_MetalView handle to an NSView or
UIView (depending on the platform) and then extract the layer from there.
SDL_Metal_GetLayer automatically handles all of that, making the operation
simple and cross-platform.

3. SDL_Metal_GetDrawableSize(). This function already exists in the current
SDL_Metal API (and is used behind-the-scenes for SDL_Vulkan_GetDrawableSize
on Apple platforms) but was not publicly exposed. My patch exposes this
function for public use. It works just like you'd expect.

Tested on macOS 10.14 and iOS 12.4."

Fixes Bugzilla #4796.
2020-04-10 00:37:35 -04:00
Charlie Birks
258d410653 emscripten: Add a few keyCode mappings for German keyboards
From @sy2002 in https://github.com/emscripten-ports/SDL2/issues/108
2020-04-09 15:57:12 +01:00
Charlie Birks
babf010c60 emscripten: Pass canvas id to request_pointer_lock
Fixes pointer lock with DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
2020-04-09 15:01:47 +01:00
Daid
287772f5e9 emscripten: Let SDL_GetDisplayUsableBounds return the size of the window
This does not account for scrollbars nor margins. But is much better then returning the full display size when not running fullscreen, but for example in an iframe.
2020-04-09 15:01:45 +01:00
Daid
fb3df3a18d emscripten: Fix the reported keys for the numpad. See https://github.com/emscripten-ports/SDL2/issues/94 2020-04-09 15:01:41 +01:00
Sylvain Beucler
44716b0236 emscripten: Send SDL_APP_TERMINATING before unload (#88) 2020-04-09 15:01:37 +01:00
Beuc
0380cbd792 emscripten: Typo 2020-04-09 15:01:32 +01:00
Sam Lantinga
d4f1b520c9 Added support for press/release hardware keyboard events in iOS 13.4 2020-04-08 19:16:31 -07:00
Sam Lantinga
e9c94ac0b3 Fixed Windows accelerometer data units 2020-04-08 10:27:30 -07:00
Sam Lantinga
09f552639a Fixed memory leak and removed debug code from Windows sensor implementation 2020-04-08 09:00:10 -07:00
Sam Lantinga
55515a8c25 SDL: ps4 controller trigger bits on other controllers just mean that there's some activity, not saturation - only force it on if the analog value is 0. 2020-04-08 08:42:15 -07:00
Sam Lantinga
ba95fa6152 Revert "Fix incorrectly terminated MakeThreadHighPriority dbus message"
The first terminator is for input parameters. The second terminator was for the
output parameters.

If an error occurs when calling MakeThreadHighPriority(), e.g. a bad thread id,
then the reply from connection_send_with_reply_and_block() will be null.
2020-04-08 08:42:09 -07:00
Sam Lantinga
3180ba81af First pass at Windows sensor implementation 2020-04-08 08:34:27 -07:00
Ryan C. Gordon
6e6b517789 cocoa: Patched to compile. 2020-04-07 23:34:41 -04:00
Ryan C. Gordon
8c165adde7 joystick: Remove force_centering flag; we handle this on disconnect now. 2020-04-07 23:17:27 -04:00
Ryan C. Gordon
fba081e489 wasapi: Patched to compile on C89 systems, and use SDL_ceilf instead of ceilf. 2020-04-07 14:51:08 -04:00
Ryan C. Gordon
4c2be47207 wasapi: Improve WASAPI audio backend latency (thanks, Anthony!).
Anthony Pesch's notes on his patch:

"Currently, the WASAPI backend creates a stream in shared mode and sets the
device's callback size to be half of the shared stream's total buffer size.

This works, but doesn't coordinate will with the actual hardware. The hardware
will raise an interrupt after every period which in turn will signal the
object being waited on inside of WaitDevice. From my empirical testing, the
callback size was often larger than the period size and not a multiple of it,
which resulted in poor latency when trying to time an application based on the
audio callback. The reason for this looked something like:

* The device's callback would be called and and the audio buffer was filled.
* WaitDevice would be called.
* The hardware would raise an interrupt after one period.
* WaitDevice would resume, see that a a full callback had not been played and
  then wait again.
* The hardware would raise an interrupt after another period.
* WaitDevice would resume, see that a full callback + some extra amount had
  been played and then it would again call our callback and this process would
  repeat.

The effect of this is that the pacing between subsequent callbacks is poor -
sometimes it's called very quickly, sometimes it's called very late.

By matching the callback's size to the stream's period size, the pacing of
calls to the user callback is improved substantially. I didn't write an actual
test for this, but my use case for this was my Dreamcast emulator
(https://redream.io) which uses the audio callback to help drive the emulation
speed. Without this change and with the default shared stream buffer (which
has a period of ~10ms) I would get frame times that were between ~3-30
milliseconds; after this change I get frame times of ~11-22 milliseconds.

Note, this patch also has a change that removes passing a duration to the
Initialize call. It seems that the default duration used (when 0 is passed)
does typically match up with the duration returned by GetDevicePeriod, however
the Initialize docs say:

> To set the buffer to the minimum size required by the engine thread, the
> client should call Initialize with the hnsBufferDuration parameter set to 0.
> Following the Initialize call, the client can get the size of the resulting
> buffer by calling IAudioClient::GetBufferSize.

This change isn't strictly required, but I made it to hopefully rule out
another source of unexpected latency."

Fixes Bugzilla #4592.
2020-04-07 14:37:24 -04:00
Michael Maltese
361417c0a4 cocoa: allow calling CreateWindowFrom on an NSView
This lets applications embed SDL with other widgets surrounding it.
Already possible on Windows and X11.

Fixes Bugzilla #5060.
2020-03-25 16:40:43 -07:00
Ryan C. Gordon
8641f6e99d emscripten: support KaiOS's Left Soft Key and Right Soft Key (thanks, pelya!).
Fixes Bugzilla #5027.
2020-04-07 14:03:13 -04:00
Ryan C. Gordon
309d6137ae cocoa: OpenGL setView and update must be used on main thread (thanks, Tim!).
If called from background threads, use Grand Central Dispatch to use the
main thread instead. On the main thread, just call them directly.

Fixes Bugzilla #4932.
2020-04-07 14:01:25 -04:00
Ryan C. Gordon
024698779b wayland: Support wayland compositors with wl_seat version < 5 (thanks, Nia!).
Fixes Bugzilla #5074.
2020-04-07 13:30:46 -04:00
Sam Lantinga
3cb62d5265 Fixed setting the controller name for the RAWINPUT driver 2020-04-07 11:17:52 -07:00
Sam Lantinga
e62c25b693 The 0x02ff product ID shows up for new firmware Xbox One controllers using the RAWINPUT driver 2020-04-07 11:17:22 -07:00
Sam Lantinga
88cecee495 Fixed build warning 2020-04-07 10:14:12 -07:00
Sam Lantinga
50cb8e0f04 Fixed deadlock in new raw input joystick code
The appropriate locking is done elsewhere, this prevents inverted lock acquisition
2020-04-07 10:13:08 -07:00
Sam Lantinga
b6afbe6317 Added SDL_log.h to SDL_internal.h so logging is available everywhere 2020-04-07 09:38:57 -07:00
Sam Lantinga
488b94cb40 Don't interpret raw input messages with no mouse position
This happens occasionally on touch devices when raw input is enabled
2020-04-07 09:18:19 -07:00
Sam Lantinga
0721931f5b Avoid sending regular mouse messages for touch input 2020-04-06 19:21:56 -07:00
Jay Petacat
c760c02c6c Fix some format specifier warnings
The warnings were produced by GCC 9.2.x for x86_64-linux-gnu or
i386-pc-msdosdjgpp targets.

Most of the fixes involve changing the type of a variable rather than
the format specifier. For many of the affected test conuter variables,
a basic int seems sufficient.

Some format specifier warnings still remain for cases where changing
type or casting seemed inappropriate. Those warnings will probably
require some new format specifier macros (e.g. SDL_PRIu32).
2020-03-25 01:34:15 -04:00
Sam Lantinga
dad73b1f0c Fixed bug 5073 - SDL does not handle URL Schemes in MacOS
Jason

In iOS, URL Events trigger the DropFile event. I would also expect the same event to be fired on the macOS platform but this is not implemented at all in the AppDelegate.
2020-04-05 10:47:58 -07:00
Sam Lantinga
9525f9729a Fixed bug 5076 - SDL_netbsdaudio: Add support for 32-bit LPCM
Nia Alarie

The kernel supports this, make SDL expose it so it can be used.
2020-04-05 10:44:51 -07:00
Sam Lantinga
e05d92a17d Fixed bug 5075 - Don't assume a GL library version number on NetBSD.
Nia Alarie

If you install X as part of NetBSD, the GL library is libGL.so.3, but if you install the GL library later as a package, it's libGL.so.1.
2020-04-05 09:01:33 -07:00
Sam Lantinga
d4b561f472 Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken
Konrad

It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine.

It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer.

Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
2020-04-05 08:58:47 -07:00
Sam Lantinga
f3e609679d Fixed setting the "playandrecord" audio hint on Apple TV
The Apple TV doesn't have record capability by default, so activating the audio session with AVAudioSessionCategoryPlayAndRecord fails.
2020-04-02 12:27:29 -07:00
Sam Lantinga
378a5cfb61 Updated thread priorities for Apple operating systems 2020-04-01 16:39:05 -07:00
Sam Lantinga
3154d92473 SDL: plumb previously unused digital trigger bits for PS4 controllers. Victrix fight stick only sets these bits and doesn't send the analog values
CR: SamL
2020-03-30 14:26:21 -07:00
Sam Lantinga
f4a56d7e61 Enable thread-safety features in libdbus
There are multiple SDL APIs that internally sink into dbus calls, e.g. battery
status, thread priority. If those calls happen in different threads simultaneously
it can result in dbus crashes.

To abide by dbus's multithreading guidelines we must call dbus_threads_init_default()
to enable dbus's internal locking mechanisms:
https://dbus.freedesktop.org/doc/api/html/group__DBusThreads.html#gac7b8a7001befc3eaa8c6b043151008dc

Additionally, access to a DBusMessage must be synchronized between threads.
SDL was already abiding that guideline as the DBusMessage structs aren't shared.

The following email from the dbus mailing list hints that arbitrating access to
the DBusConnection on the SDL may also be required:
https://lists.freedesktop.org/archives/dbus/2017-September/017306.html
2020-03-30 14:26:15 -07:00
Sam Lantinga
2e667a8be9 Fix incorrectly terminated MakeThreadHighPriority dbus message
Currently the message is double terminated, which results in SDL_DBus_CallMethodInternal()
incorrectly assuming that the other party is always returning true.

I'm not super familiar with dbus, so I'm not sure if this could also be the cause of this bug:
https://github.com/ValveSoftware/steam-for-linux/issues/6901
2020-03-30 14:26:10 -07:00
David Ludwig
6e7465bd60 Fixed Bug 4883, redux - connect SDL_GetDisplayDPI to UIKit_GetDisplayDPI
SDL_GetDisplayDPI was failing on iOS, as UIKit_GetDisplayDPI was
not getting assigned to SDL's internal field in SDL_VideoDevice:
GetDisplayDPI.
2020-03-28 15:43:55 -04:00
Ryan C. Gordon
55b4f18e1a coreaudio: The default SDL audio device now tracks the system output default.
So if you go into System Preferences on a MacBook and toggle between a pair of
connected bluetooth headphones and built-in internal speakers, SDL will
switch the device it is playing sound through, to match this setting, on the
fly.

Likewise if the default output device is a USB thing and is unplugged; as the
default device changes at the system level, SDL will pick this up and carry
on with the new default. This is different from our unplug detection for
specific devices, as in those cases we want to send the app a disconnect
notification, instead of migrating transparently as we now do for default
devices.

Note that this should also work for capture devices; if the device changes,
SDL will start recording from the new default.

Fixes Bugzilla #4851.
2020-03-29 01:54:00 -04:00
Ryan C. Gordon
46bb47cf04 thread: Put all important SDL_CreateThread internal data into SDL_Thread.
This avoids the need to malloc something extra, use a semaphore, etc, and
fixes Emscripten with pthreads support, which might not spin up a web worker
until after SDL_CreateThread returns and thus can't wait on a semaphore at
this point in any case.

Fixes Bugzilla #5064.
2020-03-26 22:14:59 -04:00
Sam Lantinga
abdc5cbf24 Allow background music to play in the "play and record" case on iOS 2020-03-26 19:30:17 -07:00
Ryan C. Gordon
369e5f33fb dbus: System bus is optional, we only need a session bus (thanks, tamo!).
Fixes Bugzilla #4795.
2020-03-26 20:28:04 -04:00
Ryan C. Gordon
07f231eeae joystick: Make sure recentering events happen before disconnect events.
Fixes Bugzilla #5063.
2020-03-26 18:47:04 -04:00
Ryan C. Gordon
f2ff953ef7 cocoa: Just update the OpenGL context directly if on the main thread. 2020-03-26 13:42:56 -04:00
Fabrice Fontaine
9354aea198 src/video/kmsdrm/SDL_kmsdrmvideo.c: fix build
Build is broken without EGL since version 2.0.12 and
https://hg.libsdl.org/SDL/rev/72cc4740dec2:

/home/giuliobenetti/autobuild/run/instance-1/output-1/build/sdl2-2.0.12/src/video/kmsdrm/SDL_kmsdrmvideo.c: In function 'KMSDRM_CreateSurfaces':
/home/giuliobenetti/autobuild/run/instance-1/output-1/build/sdl2-2.0.12/src/video/kmsdrm/SDL_kmsdrmvideo.c:394:5: error: unknown type name 'EGLContext'
     EGLContext egl_context;
     ^

Fixes:
 - http://autobuild.buildroot.org/results/fafd20a01591032662f9ca025fcea3478239cf3c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-03-25 09:38:45 -07:00
Fabrice Fontaine
a4b0204b1a src/video/directfb/SDL_DirectFB_render.c: fix build
Build with directfb is broken due to a spurious '}' and a missing 'E'
since version 2.0.12 and https://hg.libsdl.org/SDL/rev/4c2dcf490cba:

/home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c: In function 'SetBlendMode':
/home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c:202:9: error: case label not within a switch statement
  202 |         case SDL_BLENDMODE_MUL:
      |         ^~~~

/home/buildroot/autobuild/run/instance-2/output-1/build/sdl2-2.0.12/src/video/directfb/SDL_DirectFB_render.c:205:67: error: 'DSBF_DSTCOLOR' undeclared (first use in this function); did you mean 'DSBF_DESTCOLOR'?
  205 |             SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_DSTCOLOR));
      |                                                                   ^~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/83ccefee68c2800c0544e6f40fa8bc8ee6b67b77

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-03-24 10:05:51 -07:00
Sam Lantinga
885b3f6948 Don't check the HIDAPI driver for the virtual device created by xow 2020-03-23 14:10:25 -07:00
Sam Lantinga
2c02b7410c Fixed bug 5052 - Interval between SDL_SENSORUPDATE events for gyroscopes is too high
Andrei Kortunov

Hello. I try to implement an application for Android, which uses a new sensors API from 2.0.9 to control a camera rotation via built-in gyroscope, using the code from the test/testsensor.c as an example.

Gyroscope input itself works well, but an interval between SDL_SENSORUPDATE events is about 200ms (the SENSOR_DELAY_NORMAL, I believe), when I need the interval about 20-40ms (the SENSOR_DELAY_GAME or SENSOR_DELAY_FASTEST).
2020-03-23 12:10:05 -07:00
Jay Petacat
e0a270561f Do not overwrite window surface created by driver
If a driver's implementation of CreateWindowFramebuffer sets the window
surface, use that rather than overwriting it. A driver may set the window
surface if data cannot be passed via the CreateWindowFramebuffer output
parameters (e.g. surface palette colors).
2020-03-22 20:09:14 -04:00