Commit Graph

1226 Commits

Author SHA1 Message Date
Ryan C. Gordon
846526767d test: Makefile should copy .dat files for testoverlay2. 2018-09-02 00:35:11 -04:00
Jeremy Ong
1bb7162872 vulkan: SDL_Vulkan_GetInstanceExtensions should accept a NULL window.
Fixes Bugzilla #4235.
2018-08-24 09:49:48 -04:00
Sam Lantinga
6a6db94f54 First pass on the new SDL sensor API 2018-08-21 12:11:34 -07:00
Sam Lantinga
a7f26f9e6c Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00
Ryan C. Gordon
0df9d798c0 Some drag'and'drop improvements.
First: disable d'n'd events by default; most apps don't need these at all, and
if an app doesn't explicitly handle these, each drop on the window will cause
a memory leak if the events are enabled. This follows the guidelines we have
for SDL_TEXTINPUT events already.

Second: when events are enabled or disabled, signal the video layer, as it
might be able to inform the OS, causing UI changes or optimizations (for
example, dropping a file icon on a Cocoa app that isn't accepting drops will
cause macOS to show a rejection animation instead of the drop operation just
vanishing into the ether, X11 might show a different cursor when dragging
onto an accepting window, etc).

Third: fill in the drop event details in the test library and enable the
events in testwm.c for making sure this all works as expected.
2018-08-02 16:03:47 -04:00
Ryan C. Gordon
10d7249589 testresample: correctly output .wav files that have floating point audio. 2018-05-15 00:04:02 -04:00
Ryan C. Gordon
cc16ae0ff1 cpuinfo: Added SDL_HasAVX512F().
This checks for the "foundation" AVX-512 instructions (that all AVX-512
compatible CPUs support).
2018-05-21 11:35:42 -04:00
Sam Lantinga
d1956793bb Added SDL_THREAD_PRIORITY_TIME_CRITICAL 2018-04-23 22:07:56 -07:00
Sam Lantinga
383a65ef51 Added support for adjusting thread priorities using Linux RealtimeKit
Michael Sartain

This is a quick pass at adding Linux RealtimeKit thread priority support to SDL.

It allows me to bump the thread priority to high without root privileges or setting any caps, etc.

rtkit readme here:
    http://git.0pointer.net/rtkit.git/tree/README
2018-04-23 17:10:36 -07:00
Sam Lantinga
e99c0c8b98 Added Android custom cursor implementation
This is commented out in SDLActivity.java, with the note #CURSORIMPLEENTATION because it requires API 24, which is higher than the minimum required SDK
2018-03-15 18:22:48 -07:00
Sam Lantinga
09681aa6bd Fixed bug 4092 - CMake support for building everything in the "test" directory
Eric Wasylishen

Patch to support building the tests with cmake.
Disabled by default, use: "cmake .. -DSDL_TEST=YES" to enable the tests.

Tested on macOS 10.13 with the ninja, makefile, and Xcode generators, and Windows 10 with the Visual Studio 2017 generator.
2018-02-24 08:59:58 -08:00
Ryan C. Gordon
002d771dc4 testoverlay2: use SDL_atoi, not atoi. 2018-01-22 09:46:48 -05:00
Sam Lantinga
a9072159b2 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
d20102e9e1 Fixed building YUV test programs (thanks Ozkan!) 2017-11-17 10:54:46 -08:00
Sam Lantinga
44087f9b2f Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga
0bf446b21a Added min/max macros for the sized SDL datatypes 2017-10-16 14:39:56 -07:00
Brandon Schaefer
ceae5eed47 revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
Brandon Schaefer
fe922885a4 wayland: Fix bug 3814 -Wmissing-field-initializers 2017-09-29 10:07:37 -07:00
Ryan C. Gordon
733508262b test: forgot to change a variable.
Fixes Bugzilla #3787.
2017-08-29 18:25:55 -04:00
Ryan C. Gordon
7b45c3d812 test: Fix for negative int that was now a size_t (thanks, Ozkan!).
Fixes Bugzilla #3787.
2017-08-29 18:16:38 -04:00
Ryan C. Gordon
70d05c8bc5 A few more compiler warnings fixed. 2017-08-29 16:05:03 -04:00
Ryan C. Gordon
99577816ec Fixed a bunch of compiler warnings. 2017-08-29 15:52:49 -04:00
Sam Lantinga
248b190b77 Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga
ad2289fc49 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Sam Lantinga
63b99cde01 We use the SDL Vulkan headers 2017-08-27 20:41:48 -07:00
Ryan C. Gordon
26903882fb vulkan: Include a copy of vulkan.h and vk_platform.h.
Now we can provide Vulkan support in the build even if the build box doesn't
have a Vulkan SDK, since we dynamically link to the library anyhow.
2017-08-27 23:25:12 -04:00
Sam Lantinga
7a285640e5 Use SDL_Vulkan_GetDrawableSize() instead of SDL_GL_GetDrawableSize() 2017-08-27 19:32:08 -07:00
Ryan C. Gordon
10d552ae31 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00
Sam Lantinga
8cc12fb82f Fixed bug 3740 - atexit() in test/testime.c 2017-08-27 19:00:03 -07:00
Sam Lantinga
df0ee407ab Implemented more flexible blending modes for accelerated renderers
This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD,
	                                       SDL_BLENDFACTOR_ZERO,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_ADD);

This fixes bug 2828 - Subtractive Blending

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_SUBTRACT,
	                                       SDL_BLENDFACTOR_ZERO,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_SUBTRACT);


This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD);
2017-08-14 05:51:44 -07:00
Sam Lantinga
ba0b0ffd61 Fixed bug 3743 - make testautomation_sdltest.c to compile
Ozkan Sezer

The attached patch makes testautomation_sdltest.c more compatible wrt
LLONG_{MIN|MAX} macros and makes it to compile on older systems  (e.g.
glibc-2.8) too, by replacing LLONG_{MIN|MAX} with INT64_{MIN|MAX}.

c.f.: bug #3494, where the same issue was described for SDL_test_fuzzer.c
2017-08-13 21:18:59 -07:00
Sam Lantinga
38f098ce6d Fixed bug 3741 - more compatible initializers for arrays
Ozkan Sezer

An array defined like  int xPositions[] = {-1, 0, 1, w-1, w, w+1 };
errors with Open Watcom: it strictly wants constants.  Small patch
like below makes things more compatible.
2017-08-13 21:15:44 -07:00
Sam Lantinga
868f6e95b8 Fixed bug 3605 - Software renderer no longer renders after Android screen orientation change
Sylvain

This still happens with the current trunk version.  (software renderer of testdrawchessboard.c)

When there is a rotation, the window size changed and the internal surface is marked as "surface_valid == SDL_FALSE".
And all further call fails.

SDL_video.c :

2478 void
2479 SDL_OnWindowResized(SDL_Window * window)
2480 {
2481     window->surface_valid = SDL_FALSE;
2482     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
2483 }

some error set to :
2233         return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");


So, this seems to be the behavior of the API ...


In the loop() function of testdrawchessboard.c, we can recreate the surface/renderer :

 65        if (e.type == SDL_WINDOWEVENT)
 66        {
 67             if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
 68             {
 69                surface = SDL_GetWindowSurface(window);
 70                renderer = SDL_CreateSoftwareRenderer(surface);
 71             }
 72             /* Clear the rendering surface with the specified color */
 73             SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
 74             SDL_RenderClear(renderer);
 75        }

And it displays correctly.
2017-08-13 21:12:14 -07:00
Sam Lantinga
3412c450d0 Fixed bug 3744 - missing SDLCALL in several functions
Ozkan Sezer

The attached patch adds missing SDLCALL to several functions, so that
they properly match the headers as intended.
2017-08-13 21:06:52 -07:00
Sam Lantinga
6ec1321e60 Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted
Fabian Greffrath

we use SDL_GetPrefPath() in Chocolate Doom to get a reasonable directory to save and restore config files and savegames:

https://github.com/chocolate-doom/chocolate-doom/blob/sdl2-branch/src/m_config.c#L2162

However, since there is no "organization" behind Chocolate Doom and there is really only one "product" called Chocolate Doom, we pass an empty string for the org parameter and the package string for app.

This leads to two consecutive slashes in the path returned by SDL_GetPrefPath() like this:

/home/user/.local/share//chocolate-doom/

While this is harmless, it sure looks bad.

I believe that it should be possible to either pass a NULL pointer for the org parameter or at least have the function detect an empty string as a means to express "there is no origanization, just a single product". The generation of the path string to be returned by the function will have to get adapted accordingly.
2017-08-11 11:32:00 -07:00
Sam Lantinga
a194b8a078 Fixed bug 3682 - Toggle text input in checkkeys when the mouse is clicked
Eric Wasylishen

Small change to checkkeys so you can toggle text input mode with a mouse click.
This is needed for testing how dead keys react to toggling mouse input, i.e. these bugs:
2017-08-11 10:32:47 -07:00
Philipp Wiesemann
a20ee5a6bb Fixed typo in log message in testime program. 2017-07-09 23:00:35 +02:00
Philipp Wiesemann
a60ec8961c Fixed handling only one event per frame in testshape program. 2017-06-24 23:45:19 +02:00
Philipp Wiesemann
8169c59a78 Fixed ignoring first event in testshape program.
Found by Cppcheck.
2017-06-08 22:40:35 +02:00
Philipp Wiesemann
f8dc17bacd Fixed crash if creating textures failed in testshape program. 2017-06-02 22:15:23 +02:00
Ryan C. Gordon
8fad524409 test: Makefile.in should copy bitmap and wave files to build directory.
I've lost count of the times I've forgotten to do this manually and wondered
why loopwave can't open sample.wav.  :)
2017-05-29 18:24:06 -04:00
Philipp Wiesemann
7fe081e5c4 Removed unnecessary call to free() in testoverlay2 program. 2017-05-20 23:30:47 +02:00
Philipp Wiesemann
ec86349dd8 Removed unused signal includes and handler in test programs. 2017-05-20 23:30:32 +02:00
Philipp Wiesemann
9eb08f5ba0 Removed unused field in loopwavequeue program.
Found by Cppcheck.
2017-04-29 22:50:23 +02:00
Philipp Wiesemann
63db7e414d Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
Philipp Wiesemann
6142a07e06 Removed unused constant in testgesture program. 2017-03-19 22:16:37 +01:00
Sam Lantinga
d66f238377 Backed out changeset 90e5cb81c483 - testaudiocapture.c already does what we want 2017-03-16 16:45:12 -07:00
Sam Lantinga
71dad8a81e Added an audio recording test program 2017-03-15 11:39:54 -07:00
Sam Lantinga
abd8f65ba3 Fixed tabs to spaces 2017-03-09 15:12:19 -08:00
Sam Lantinga
5aa5988090 Added support to loopwave for hotplugging audio devices 2017-03-09 14:50:23 -08:00