Commit graph

9136 commits

Author SHA1 Message Date
Sam Lantinga
307d753912 Added support for the PS4 Slim controller, model CUH-ZCT2U 2016-10-13 02:19:23 -07:00
Sam Lantinga
ed5b8e1246 Fixed black screen on Steam Link 2016-10-13 02:09:37 -07:00
Sam Lantinga
8cb0e92e2c Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer.
Call SDL_GL_GetDrawableSize() directly because we may be in the initialization path and SDL_GetRendererOutputSize() will fail because the renderer magic isn't set up yet.
2016-10-13 08:46:34 -07:00
Sam Lantinga
3df3289d14 Added a note on how to allow non-root applications to increase their thread priority on Linux 2016-10-12 22:34:54 -07:00
Sam Lantinga
f0a9a82149 Work-around for a hang when USB devices are unplugged, contributed by James Zipperer 2016-10-12 22:25:19 -07:00
Sam Lantinga
52fed4965c Backed out change 92dc590a7116 which was: Fixed bug 3320 - SDL_windows_main.c defines both console application entry points
With that change only the wmain() entry point was defined, and applications that linked with main() would no longer build.
2016-10-12 19:50:16 -07:00
Sam Lantinga
6ffe2a5988 Added note for David Carlier's work on OpenBSD 2016-10-12 18:57:12 -07:00
Sam Lantinga
e7598eccec Build SDL as universal binary 2016-10-12 18:46:17 -07:00
Sam Lantinga
11f5755737 Fixed build warning 2016-10-12 18:45:56 -07:00
Philipp Wiesemann
ebf3f850ae X11: Fixed compile warning about unused variable. 2016-10-12 23:38:31 +02:00
Philipp Wiesemann
c514ae0303 Removed empty statements in tests. 2016-10-12 23:36:49 +02:00
Philipp Wiesemann
fdd0e41c4b Linux: Removed redundant function call. 2016-10-12 23:36:29 +02:00
Sam Lantinga
0c687477a5 Fixed pointer signedness warning 2016-10-12 00:01:17 -07:00
Sam Lantinga
b7224663f2 Updated WhatsNew with 2.0.5 changes 2016-10-11 23:56:52 -07:00
Sam Lantinga
97ec4f1d96 Fixed comment for new pixel formats 2016-10-11 23:21:41 -07:00
Sam Lantinga
f91b4a6508 Fixed bug 2923 - Add SDL_PIXELFORMAT_RGBA32 for byte-wise 32bit RGBA data
Daniel Gibson

Ok, I followed the simple approach of just making SDL_PIXELFORMAT_RGBA32 an alias of SDL_PIXELFORMAT_RGBA8888/SDL_PIXELFORMAT_ABGR8888, depending on endianess. And I did the same for SDL_PIXELFORMAT_ARGB32, .._BGRA, .._ABGR.

SDL_GetPixelFormatName() will of course return SDL_PIXELFORMAT_RGBA8888 (or SDL_PIXELFORMAT_ABGR8888) instead of SDL_PIXELFORMAT_RGBA32, but as long as that's mentioned in the docs it shouldn't be a problem.
2016-10-11 23:19:05 -07:00
Ryan C. Gordon
4e326f37b7 cmake: Now generates Wayland protocol source bits like the configure script.
Fixes Bugzilla #3430.

--HG--
extra : rebase_source : c090e0cdcc93a622cb72306b8dea0f4ac62fb99f
2016-10-11 16:36:40 -04:00
Alex Baines
faa1225d54 Fix invalid read from poor setlocale usage. 2016-10-03 15:31:11 +01:00
Steffen Pankratz
97db1659b4 Fixed bug 3096 - SDL_BlitSurface with overlapping source and destination 2016-10-10 18:28:05 +02:00
Steffen Pankratz
50322148b7 Fixed a memory leak in function GL_RenderReadPixels 2016-10-11 17:31:29 +02:00
Sam Lantinga
63bf89cbea Use SDL C runtime strlen() 2016-10-10 23:26:26 -07:00
Ryan C. Gordon
42a861adce alsa: more tapdancing to enumerate physical hardware devices.
Apparently some systems see "hw:", some see "default:" and some see
"sysdefault:" (and maybe others!). My workstation sees both "hw:" and
"sysdefault:" ...

Try to find a prefix we like and prioritize the prefixes we (think) we want
most. If everything else fails, if there's a "default" (not a prefix) device
name, list that by itself so the user gets _something_ here.

If we can't find a prefix we like _and_ there's no "default" device, report
no hardware found at all.
2016-10-10 15:29:18 -04:00
Sam Lantinga
3111f9a1a5 Made #if defined(X) consistent 2016-10-10 02:58:29 -07:00
Sam Lantinga
9bc30253bd Make sure we have iconv.h before building with it 2016-10-10 02:58:12 -07:00
Philipp Wiesemann
1b0a9a82c4 Fixed compiling of three test programs with C++. 2016-10-09 20:31:32 +02:00
Philipp Wiesemann
91423b4d03 Linux: Fixed mixed up scancodes. 2016-10-09 20:31:04 +02:00
Philipp Wiesemann
de715c79c6 iOS: Updated demo README. 2016-10-09 20:30:49 +02:00
Sam Lantinga
31a036e3f3 Fixed building and using fcitx IME support on Linux 2016-10-08 11:30:07 -07:00
Sam Lantinga
1b032a0419 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Ethan Lee
98fbc3fc5d SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING 2016-09-30 09:26:57 -04:00
Sam Lantinga
a2532cd816 ALSA_snd_pcm_drop() can hang on some systems (Steam Link) so don't use that when shutting down the ALSA audio driver. 2016-10-07 19:08:22 -07:00
Sam Lantinga
de631d20e4 Fixed bug 2824 - Add Fcitx Input Method Support
Weitian Leung

Just moved ibus direct call to SDL_IME_* related functions, and adds fcitx IME support (uses DBus, too),
enable with env: SDL_IM_MODULE=fcitx (ibus still the default one)
2016-10-07 18:57:40 -07:00
Sam Lantinga
d14ce58e75 Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries 2016-10-07 18:24:34 -07:00
Alex Baines
701e14a8ef Improve X11 key handling when XKB isn't available + add xvnc scancodes.
Based on a patch by Bill Lash (see bug 3094).
2016-10-03 11:35:34 +01:00
Bill Lash
ee1f18b52d Additional patch to correct the number key assignments, and add assignments for keys that were missed 2015-08-15 00:25:52 -05:00
Sam Lantinga
b07188e5ff Fixed bug 3063 - Wayland: SDL resizes EGL surface to 0x0.
x414e54

Wayland will sometimes send empty resize events (0 width and 0 height) to the client. I have not worked out the exact conditions a client would receive these but I can assume it might be if the window is offscreen or not mapped yet.

This causes issues with some SDL clients as they receive the 0x0 event and unexpected resize event or might not request to resize back to the correct size.

As per the wl_shell Wayland spec configure events are only a suggestion and the client is free to ignore or pick a different size (this is how min/max and fixed aspect ratio is supped to be implemented).

A patch is attached but is just the first iteration and I will fix any issues such as checking for FULLSCREEN/MAXIMIZED or RESIZABLE flags unless someone else fixes this first.

I have update to take into account non resizable and fullscreen windows. Also adding in maximize/restore and title functions for Wayland.
2016-10-07 18:11:03 -07:00
Sam Lantinga
62d6856e2f Fixed bug 3061 - Selecting the dummy video driver on Mac OS X results in an error
Darren Kulp

The dummy video driver is not available on Mac OS X if SDL_VIDEO_OPENGL is set at library compilation time.

In src/video/SDL_video.c, there is a compile-time check in SDL_CreateWindow() for (SDL_VIDEO_OPENGL && __MACOSX__). When it succeeds, SDL_WINDOW_OPENGL is always requested. Since the dummy video driver does not supply an OpenGL implementation, the error "No OpenGL support in video driver" is supplied to the user, and SDL_CreateWindow() is exited early.
2016-10-07 18:09:09 -07:00
Sam Lantinga
a43ff2f155 Fixed bug 3043 - fix alsa configury and cmake checks
Ozkan Sezer

SDL's alsa uses snd_pcm_recover() which has been available only since alsa-lib-1.0.11.
2016-10-07 18:03:08 -07:00
Sam Lantinga
b5793055d2 Fixed bug 3029 - software renderer cuts off edges when rotate-blitting with a multiple of 90 degrees
Adam M.

When doing a rotated texture copy with the software renderer, where the angle is a multiple of 90 degrees, one or two edges of the image get cut off. This is because of the following line in sw_rotate.c:
    if ((unsigned)dx < (unsigned)sw && (unsigned)dy < (unsigned)sh) {
which is effectively saying:
    if (dx >= 0 && dx < src->w-1 && dy >= 0 && dy < src->h-1) {

As a result, it doesn't process pixels in the right column or bottom row of the source image (except when they're accessed as part of the bilinear filtering for nearby pixels). This causes it to look like the edges are cut off, and it's especially obvious with an exact multiple of 90 degrees.
2016-10-07 18:00:30 -07:00
Sam Lantinga
cccf6659cc Fixed bug 3022 - SDL_UnlockMutex(SDL_EventQ.lock) in SDL_PeepEvents can cause error when lock is null 2016-10-07 17:58:02 -07:00
Sam Lantinga
b33fde0338 Fixed bug 2983 - Update Android.readme to include Tegra Graphics Debugger compatibility tip
Michael Labbé

NVidia has released some pretty nice Tegra profiling tools for their Android devices. The NVidia Tegra Graphics Debugger works by providing an interposer library that intercepts ES2 and EGL calls.  You must link against these libraries.

Unfortunately, this quietly fails with SDL2 because libEGL and libGLES2 are dynamically loaded with dlopen().

NVidia offers a secondary approach to using the Tegra Graphics Debugger: root your device and install a global interposer library.  Almost no devs will try this first if they don’t have a rooted device.

I propose an update to the Android readme that explains why the static linking approach recommended by NVidia doesn’t work.
2016-10-07 17:49:33 -07:00
Sam Lantinga
c55119c110 Converted README documentation to DOS text format 2016-10-07 17:46:58 -07:00
Sam Lantinga
c54556c10e Fixed bug 2957 - De-reference rz_src without NULL check in SDLgfx_rotateSurface function
Nitz

In function SDLgfx_rotateSurface:

rz_dst =
            SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS,
            rz_src->format->Rmask, rz_src->format->Gmask,
            rz_src->format->Bmask, rz_src->format->Amask);

Here rz_src get De-referenced without NULL check, which is risky.
2016-10-07 17:30:21 -07:00
Sam Lantinga
dd42a1c1fa Fixed bug 2956 - De-reference videodata without NULL check in X11_DispatchEvent(_THIS) function 2016-10-07 17:26:25 -07:00
Sam Lantinga
672afedacf Fixed bug 2952 - SDL_MixAudioFormat does not support audio format AUDIO_U16LSB/AUDIO_U16MSB
Simon Sandström

As stated in Summary. The switch statement will execute the default case and set a SDL error message: "SDL_MixAudio(): unknown audio format".

There are atleast two more problems here:

1. SDL_MixAudioFormat does not notify the user that an error has occured and that a SDL error message was set. It took me awhile to understand why I couldn't mix down the volume on my AUDIO_U16LSB formatted audio stream.. until I started digging in the SDL source code.

2. The error message is incorrect, it should read: "SDL_MixAudioFormat(): unknown audio format".
2016-10-07 17:23:20 -07:00
Sam Lantinga
b0f8e0b20e Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum
Daniel Gibson

Currently, SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceFrom() take Uint32 masks for RGBA to "describe" the Pixelformat of the surface.
Internally those value are only used to map to one of the SDL_PIXELFORMAT_* enum values that are used for further processing.

I think it would be both handy and more efficient to be able to specify SDL_PIXELFORMAT_* yourself without using SDL_PixelFormatEnumToMasks() to create masks first, so I implemented functions that do that:
SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() which are like the versions without "WithFormat" but instead of taking 4 Uint32s for R/G/B/A masks, they take one for a SDL_PIXELFORMAT_* enum value.

Together with https://bugzilla.libsdl.org/show_bug.cgi?id=2923 creating a SDL_Surface* from RGBA data (e.g. from stb_image)  is as easy as
  surf = SDL_SDL_CreateRGBSurfaceWithFormat(0, w, h, bppToUse*8, SDL_PIXELFORMAT_RGBA32);
2016-10-07 17:04:58 -07:00
Sam Lantinga
d53007ae0e Fixed bug 2885 - SDL_stdinc.h doesn't need to include iconv.h
Ryan C. Gordon

We still include iconv.h in SDL_stdinc.h, probably because this header might have referenced the native iconv functions and types directly. Since these are hidden behind a stable ABI now and never just a #define for the system iconv, we shouldn't need this header included from a public SDL header anymore, slowing down external apps compiles and pulling tons of stuff into the namespace.
2016-10-07 16:44:42 -07:00
Ryan C. Gordon
593954247f audio: Backed out the audio-thread detaching changes.
It added a ton of complexity. A simpler solution might arise at some
point though.

--HG--
extra : rebase_source : 954c49df5e14292b459bbd8cbb550c7c40ff7645
2016-10-07 19:39:43 -04:00
Sam Lantinga
6e0f9b570b Fixed bug 2833 - Access Violation on SDL_PollEvent after init, delay and quit of joystick subsystem
Jan Klass

Not sure if this is limited to the joystick subsystem,
but I created a minimal program for reproducibility,
which is attached.

The issue occurs with my gamepad Razer Onza (an xbox-style gamepad) plugged in.
On initialization, the gamepad is being recognized.
After quitting the subsystem, the poll will receive the joystick added event,
which it instantly handles itself, calling SDL_SYS_JoystickDetect again,
which this time calls IDirectInput8_EnumDevices with dinput = NULL (after it was released on quit).
This seems to lead to an access violation within said function, which I have no source for.
2016-10-07 16:32:58 -07:00
Sam Lantinga
d3e667887a Fixed bug 2832 - Inverted arrow-key navigation in MessageBox
Jan Hellwig

On Windows, you are able to navigate between the buttons on a MessageBox that was created using SDL_ShowMessageBox using the arrow keys. However, if you press the left arrow key, the selection jumps to the button on the right of the currently selected one (and vice versa).

This can be fixed by reversing the order in which the buttons are added to the dialog.

The attached patch files fixes this problem. However the first press of an arrow key leads to the selection of the leftmost or rightmost button on the MessageBox, not to the selection of the button left/right of the one that is selected by default.
2016-10-07 16:19:50 -07:00