Commit Graph

2012 Commits

Author SHA1 Message Date
Sam Lantinga
4d4e18c4bb Added vi style for the Emscripten joystick code 2018-10-25 12:54:39 -07:00
Sam Lantinga
c4918db580 Add exception handling to Android hidapi. 2018-10-22 14:55:42 -07:00
Ryan C. Gordon
4a50a04213 wasapi/win32: Sort initial device lists by device GUID.
This makes an unchanged set of hardware always report devices in the same
order on each run.
2018-10-21 22:40:17 -04:00
Ryan C. Gordon
1ec56f7302 x11: Fixed incorrect function signature for XkbSetDetectableAutoRepeat.
It needs to use Bool (which is an int) and not BOOL (which is CARD8), which
causes problems on platforms with different byte order and alignment, etc.

Fixes Bugzilla #4326.
2018-10-20 21:35:48 -04:00
Ryan C. Gordon
1fb20f0ab9 cocoa: Put a mutex around GL_SwapBuffers.
Prevents deadlock when swapping two different GL contexts on two different
threads at the same time on macOS 10.14 ("Mojave").

Fixes Bugzilla #4278.
2018-10-18 23:38:27 -04:00
Thomas Perl
84e7832018 Fix "unresponsible application" issues in Wayland
Polling without wl_display_flush() never responds to ping requests.
In that case ping-pong works only on other events, such as user input
or on frame swapped.

From https://git.merproject.org/mer-core/libsdl/merge_requests/3
Original author: Alexander Akulich <a.akulich@omprussia.ru>
2018-08-23 14:47:38 +02:00
Ryan C. Gordon
f677377339 cocoa: Fix OpenGL rendering on macOS 10.14 ("Mojave").
Fixes Bugzilla #4272.
2018-10-18 12:05:05 -04:00
Ryan C. Gordon
eac3fd28d8 cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] for highDPI.
On Mojave, this will report large numbers for retina displays in fullscreen
mode, which isn't how it works on previous versions.
2018-10-18 11:59:48 -04:00
Sam Lantinga
708ad1fd8d Fixed updating the rumble parameters on Linux 2018-10-16 14:58:07 -07:00
Sam Lantinga
b0c48dd9dd Support vibration magnitude on Android 8.0 (thanks Rachel!) 2018-10-16 08:29:27 -07:00
Ozkan Sezer
7be4fca62c SDL_power.c: Adjust SDL_POWER_DISABLED ifdefs to avoid zero-size array
Otherwise if SDL_POWER_DISABLED is disabled (eg with --disable-power):

... with clang -pedantic:
src/power/SDL_power.c:48:50: warning: use of GNU empty initializer extension [-Wgnu-empty-initializer]
static SDL_GetPowerInfo_Impl implementations[] = {
                                                 ^
src/power/SDL_power.c:48:50: warning: zero size arrays are an extension [-Wzero-length-array]
2 warnings generated.

... with gcc -pedantic:
src/power/SDL_power.c:48:50: warning: ISO C forbids empty initializer braces [-Wpedantic]
src/power/SDL_power.c:48:50: warning: ISO C forbids empty initializer braces [-Wpedantic]
 static SDL_GetPowerInfo_Impl implementations[] = {
                                                  ^
src/power/SDL_power.c:48:30: error: zero or negative size array ?implementations?
 static SDL_GetPowerInfo_Impl implementations[] = {
                              ^~~~~~~~~~~~~~~

... with Watcom:
./src/power/SDL_power.c(85): Error! E1112: Initializer list cannot be empty
2018-10-15 11:01:00 +03:00
Ryan C. Gordon
dae4a01361 x11: Don't hardcode limit on lines of text in message boxes.
Plus other text parsing fixes.

Fixes Bugzilla #4306.
2018-10-15 00:46:43 -04:00
Ozkan Sezer
703361e47d SDL_GetPowerInfo_Hardwired is static in SDL_power.c
.. therefore, comment out its extern declaration in SDL_syspower.h.
2018-10-14 23:55:02 +03:00
Ozkan Sezer
cbacb0f1ea add missing include. 2018-10-14 23:50:50 +03:00
Alex Szpakowski
e2ad654f2e iOS: Don't ignore the requested alpha bit size when determining whether to use an RGBA8 backbuffer. 2018-10-14 17:26:10 -03:00
Charlie Birks
cd63709ed8 Emscripten: Load eglQueryString and eglGetError
This prevents an assertion on context creation failure (calling a null
function pointer).
2018-10-13 17:18:59 +01:00
Alex Szpakowski
8c41e2624e metal: Fix SDL_RenderReadPixels to wait for the GPU to finish rendering to the active texture before reading its pixels. 2018-10-13 03:36:42 -03:00
Alex Szpakowski
d8022d19b4 macOS: Fixed MoltenVK dynamic library loading code. 2018-10-12 23:23:52 -03:00
Alex Szpakowski
d9094421e1 metal: Fix high dpi and resizing on macOS, and clean up iOS code. Fixes bug #4250. 2018-10-12 17:55:42 -03:00
Sam Lantinga
9a98e4b647 Allow Android haptics to work when SDL is reinitialized (thanks Rachel!) 2018-10-11 15:14:48 -07:00
Ryan C. Gordon
acb05f50d8 thread: make SDL_CreateThreadWithStackSize() a public API. 2018-10-11 16:40:01 -04:00
Cameron Gutman
eff5f65096 Implement SuspendScreenSaver for Win32
Creating a full-screen SDL renderer on Windows will keep the screensaver
suspended by DirectX, as is default for full-screen DX applications. However,
for applications that render in windowed-mode, the screensaver will
still kick in, even if SDL_DisableScreenSaver() is called or
SDL_HINT_VIDEO_ALLOW_SCREENSAVER is set to 0 (default). Implementing
a SuspendScreenSaver() function for Win32 fixes this behavior.
2018-10-09 23:01:43 -07:00
Ryan C. Gordon
04cbf13261 audio: All device names reported by SDL must be unique.
This means that if you have two devices named "Soundblaster Pro" in your
machine, one will be reported as "Soundblaster Pro" and the other as
"Soundblaster Pro (2)".

This makes it so you can't into a position where one of your devices can't
be opened because another is sitting on the same name.
2018-10-10 15:20:56 -04:00
Ryan C. Gordon
0378529e1e audio: clean_out_device_list() already sets this flag to false for us. 2018-10-10 14:55:24 -04:00
Sam Lantinga
f5a21ebf0c Added support for surround sound and float audio on Android 2018-10-09 20:12:43 -07:00
Sam Lantinga
82c2f04e61 Fixed bug 4188 - Software renderer SDL_RenderCopyEx blits corrupt image under certain cases
duckgrease

SDL_RenderCopyEx blits wrong image (in some cases it's bunch of alternating horizontal lines, some cases it's image from the wrong coordinate, and in some cases it's just a bunch of garbled pixels), when the following conditions are met:
- Use software renderer.
- Enable either horizontal or vertical flip.
- source and destination rectangles must have same width and height, and must be smaller than the size of the texture.
- source rectangle's X and Y coordinates must be 0.
2018-10-09 17:41:40 -07:00
Ryan C. Gordon
88b3252555 kmsdrm: find available card if called without index.
This work was done by Michael Grzeschik, I just cleaned up the patch a little.

Fixes Bugzilla #4241.
2018-10-09 00:27:55 -04:00
Sam Lantinga
62f806ed6c This device gets Xinput driver loaded on windows. 2018-10-08 19:46:01 -07:00
Sam Lantinga
337cea4411 Fixed life-cycle issues with two activities sharing HIDDeviceManager 2018-10-08 12:49:30 -07:00
Sam Lantinga
4d771c598a Don't flash the navigation bar when destroying a fullscreen SDL window 2018-10-08 12:49:25 -07:00
Sam Lantinga
53260b31b5 There are legitimate reasons to skip full cleanup at shutdown, don't assert in that case. 2018-10-08 12:49:23 -07:00
Sam Lantinga
3ac9e2aa4e Fixed bug 4296 - kmsdrm video driver leaks 1 bo in KMSDRM_GLES_SetupCrtc()
Icenowy Zheng

One front buffer is locked in GLES_SetupCrtc() and overrides the next_bo just locked in KMSDRM_GLES_SwapWindow, then the next_bo gets lost and is not released even when quitting the video.

It may leads to problems with GLES drivers that doesn't clean up GBM correctly if there's any bo left (e.g. the Mali Utgard r6p2 blob). In the case of Mali Utgard r6p2 blob, the DRM device file is still hold by the blob, and if you try to SDL_Quit to let another program to run (this is done by EmulationStation), the new program will fail to open DRM device.
2018-10-05 17:06:05 -07:00
Ryan C. Gordon
367f9b915c wayland: Fixed missing window sizing events.
Fixes Bugzilla #4242.
2018-10-05 17:24:03 -04:00
Sam Lantinga
f01cdcedbc It turns out HIDAPI for Xbox controllers doesn't allow background input, so we won't enable it by default on Windows. 2018-10-05 01:41:59 -07:00
Sam Lantinga
41ee51b9a8 Fixed updating bindings for controllers using the wildcard mappings 2018-10-04 15:23:42 -07:00
Ryan C. Gordon
93fb710a46 evdev: Don't initialize struct sigaction with "{ 0 }".
It causes warnings on some platforms, depending on the actual definition of
sigaction, and since this is static data, it'll be zero'd out anyhow.
2018-10-03 16:54:24 -04:00
Sam Lantinga
1944556171 Make sure we don't read and write to HIDAPI at the same time, it's not thread-safe on Windows 2018-10-02 20:51:33 -07:00
Sam Lantinga
6e35e42145 Working on bug 3921 - Add some Fastpath to BlitNtoNKey and BlitNtoNKeyCopyAlpha
Sylvain

I did various benches. with clang 6.0.0 on linux, and ndk-r16b on android (NDK_TOOLCHAIN_VERSION=clang).

- still see a x10 speed factor.
- with duff_loops, it does not use vectorisation (but doesn't seem to be a problem).

on linux my patch is already at full speed on -O2, whereas the duff_loops need -O3 (200 ms at -03, and 300ms at -02).

I realized that on Android, I had a slight variation which fits best.
both on linux with -O2 and -O3, and on android with 02/03 and armeabi-v7a/arm64.

Here's the patch.
2018-10-01 14:43:03 -07:00
Ozkan Sezer
922623e1b6 SDL_blit_N.c (BlitNtoNKeyCopyAlpha): fix -Wshadow warnings by adding _
suffix to the temp Pixel local in the DUFFS_LOOP.
SDL_blit.h (ASSEMBLE_RGB):  add _ prefix to temp Pixel locals to avoid
  any possible shadowings.


The warnings were like the following:

In file included from src/video/SDL_blit_N.c:26:0:
src/video/SDL_blit_N.c: In function 'BlitNtoNKeyCopyAlpha':
src/video/SDL_blit_N.c:2421:24: warning: declaration of 'Pixel' shadows a previous local [-Wshadow]
                 Uint32 Pixel = ((*src32 & rgbmask) == ckey) ? *dst32 : *src32;
                        ^
src/video/SDL_blit.h:475:21: note: in definition of macro 'DUFFS_LOOP8'
     case 0: do {    pixel_copy_increment; /* fallthrough */             \
                     ^
src/video/SDL_blit_N.c:2419:13: note: in expansion of macro 'DUFFS_LOOP'
             DUFFS_LOOP(
             ^
src/video/SDL_blit_N.c:2399:12: warning: shadowed declaration is here [-Wshadow]
     Uint32 Pixel;
            ^
2018-10-01 21:29:11 +03:00
Sam Lantinga
b251876126 commit c6b28f46b8116552ec2b38d1d3c8535df28ba7a1
Author: Anthony Pesch <inolen@gmail.com>
Date:   Fri May 4 20:21:21 2018 -0400

    Added SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag enabling users of SDL_OpenAudioDevice to get
    the sample size of the actual hardware buffer vs having a stream created to handle the
    delta
2018-10-01 09:47:10 -07:00
Ethan Lee
0a7faa4ae5 Fix Linux haptic scaling, add 2.1 FIXME 2018-05-04 21:58:39 -04:00
Ethan Lee
de9f5415b3 Filter both SIZE_CHANGED and RESIZED on any SIZE_CHANGED 2018-08-13 12:52:52 -04:00
Sam Lantinga
95579f5f19 Fixed bug 4220 - SDL_GL_CONTEXT_DEBUG_FLAG can fail silently on some Android devices 2018-10-01 09:40:58 -07:00
Sam Lantinga
48f7e7f34d Corrected PS4 controller entry 2018-09-30 22:43:12 -07:00
Sam Lantinga
f8b4cd410b Re-enable drag-and-drop events by default 2018-09-30 19:53:26 -07:00
Alex Szpakowski
fb485986eb macOS: Fix a crash when the video subsystem quits, if SDL_MAC_NO_SANDBOX was defined when SDL was compiled. 2018-09-30 11:26:41 -03:00
Ryan C. Gordon
56ec349d2a audio: disable NEON converters for now.
To be revisited after 2.0.9 ships!

(doesn't fix Bugzilla #4186, but stops the regression for the time being.)
2018-09-29 16:48:15 -04:00
Sam Lantinga
9e8e0fb7b1 Fixed bug 4283 - SDL's version of memset is different from libc's
janisozaur

memset's documentation reads:

* The memset() function shall copy c (converted to an unsigned char) into each of the first n bytes of the object pointed to by s. (http://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html)
* Sets the first count characters of dest to the character c. (https://msdn.microsoft.com/en-us/library/1fdeehz6.aspx)
* write a byte to a byte string (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/memset.3.html)

The highlight here is they all mean a single _byte_, even though memset receives a parameter of type int, which can hold more data than a single byte. SDL's implementation of memset, however, does not clear any of the higher bits, causing an erroneous behaviour when passed an argument bigger than 0xff.
2018-09-28 20:48:18 -07:00
Sam Lantinga
74638ea3c5 Ensure we wait on the surface resize before returning from setting fullscreen mode. 2018-09-28 20:39:57 -07:00
Ozkan Sezer
31596f23ce SDL_vsnprintf: implemented '+' flag for signed integers printing.
it is, of course, ignored for %u, %x, %o and %p.
2018-09-29 01:24:10 +03:00