Commit graph

6092 commits

Author SHA1 Message Date
Ryan C. Gordon
ae7a409acf Patched to compile. 2013-07-12 23:32:54 -04:00
Ryan C. Gordon
3d9b82d9f8 Implement SDL_GL_SHARE_WITH_CURRENT_CONTEXT for iOS.
Fixes Bugzilla #1947.
2013-07-12 23:30:26 -04:00
Sam Lantinga
06741a5761 Moved the game controller database to a separate file and added a script to sort the entries so we can easily check for duplicates 2013-07-12 10:44:55 -07:00
Sam Lantinga
22aec9f625 Oops, that was supposed to be in the Linux section. 2013-07-12 08:21:28 -07:00
Sam Lantinga
ee12cc8585 Fixed bug 1810 - xxx_RenderReadPixels - incorrect behaviour in certain conditions
PoopiSan

GLES2_RenderReadPixels, GLES_RenderReadPixels, GL_RenderReadPixels and possibly other backends is incorrectly implemented.

If the current target viewport is different than window size the function is reading garbage and according to the function documentation should work with any rendering target "Read pixels from the current rendering target.".

this seems to be caused by this line:

...
SDL_GetWindowSize(window, &w, &h);
2013-07-12 00:55:04 -07:00
Sam Lantinga
1bcb90ff25 Don't crash if the current render target is destroyed. 2013-07-12 00:43:16 -07:00
Dimitris Zenios
852321d7a2 Fixed gcc warnings for apps using SDL headers with -Wstrict-prototypes flag. 2013-07-12 09:55:58 +03:00
Sam Lantinga
8522bf8e38 Fixed name of the Logitech F710 controller 2013-07-11 23:21:09 -07:00
Sam Lantinga
0b2d15eb61 Fixed bug 1853 - Gamecontroller patch to add support for Logitech F510 (Linux)
Gerry JJ

Same mapping as for F710. Xinput mode only since I couldn't get Dinput mode to work at all.
2013-07-11 23:20:29 -07:00
Sam Lantinga
1e21e522e1 Fixed Azamat's patch for SIZEOF_VOIDP in SDL_config.h.in 2013-07-11 23:16:47 -07:00
Azamat H. Hackimov
8e19a2982d Define universal answer of SIZEOF_VOIDP for 32/64-bit architectures.
This commit makes SDL_config.h universal, so it can be used with mixed
32 and 64 enviroment simultaneously.
2013-06-05 12:28:53 +06:00
Sam Lantinga
db4086463f Fixed cast of the OpenGL context type 2013-07-11 23:05:02 -07:00
Sam Lantinga
35275fc714 Fixed bug 1946 - OpenGL contexts in threads
The SDL OpenGL context code is now properly thread aware.  There are two new functions which return the current OpenGL window and context for the current thread.

There are still places in the cocoa driver where the OpenGL context needs to be updated when the view changes.  These will need a different solution and still use the last globally set context to avoid changing behavior.
2013-07-11 22:59:20 -07:00
Ryan C. Gordon
de2ec2b443 Fixed off-by-one error in SDL_ConvertStereo().
Fixes Bugzilla #561.

--HG--
extra : rebase_source : a21159567a0a8a9485c46d4c67e57224948952a0
2013-07-12 01:26:43 -04:00
Sam Lantinga
22b55373e7 Check the parameters to SDL_UpdateTexture() 2013-07-11 22:04:16 -07:00
Sam Lantinga
b5145bcf7f Fixed bug 1958 - Cocoa SwapWindow doesn't swap the specified window
Ryan C. Gordon

We have this in Cocoa_GL_SwapWindow()...

    /* FIXME: Do we need to get the context for the window? */
    [[NSOpenGLContext currentContext] flushBuffer];

...which means if the current GL context is not the one in (window), we swap a different one than requested.

Right now, we don't store information about which context is assigned to which window, and the OS doesn't give you a way to retrieve it from an NSView. We would have to track this per-window during SDL_GL_MakeCurrent() (and SDL_GL_CreateContext) calls.
2013-07-11 21:51:09 -07:00
Ryan C. Gordon
ca37b8fd83 Whoops, missed a part of that last commit.
Actually fixes Bugzilla #1857.
2013-07-11 23:59:09 -04:00
Ryan C. Gordon
37c7e9ad24 Explicitly write silence to the audio device while it is paused.
This is what SDL 1.2 did; we'll do this properly (add a method for the target
 driver to pause) when I rewrite all this code after the official 2.0 release.

Fixes Bugzilla #1857.
2013-07-11 23:53:00 -04:00
Ryan C. Gordon
a5362aa7e7 Attempt to fix a compiler warning on Haiku.
(if this works...Haiku generates no warnings. I know, right?!?)
2013-07-11 23:17:52 -04:00
Ryan C. Gordon
8ff1d6b620 Fixed compiler warnings on Haiku. 2013-07-11 12:44:03 -04:00
Ryan C. Gordon
e46b85c7b1 Removed some unused variables. 2013-07-11 12:27:39 -04:00
Ryan C. Gordon
09d6ed6d88 Fixed compiler warning. 2013-07-11 12:26:18 -04:00
Ryan C. Gordon
ad5f0c68a5 Cleaned up WGL_ACCELERATION_ARB usage.
We now do FULL or NO accel based on the app's preference. If the app didn't
 specify, we do FULL then fall back to NO.

(Not specifying anything--a true "don't care" scenario--breaks some ATI
 drivers, so we try to keep to the spirit of it while forcing a specific
 state.)

Previously, it would always do FULL, and try NO if it failed and the app
 had requested NO or DONTCARE.

This is a transplant of hg changesets a04171d6fa11 and d0b7c45e982e from the
 SDL-1.2 branch.

Fixes Bugzilla #1254.

--HG--
extra : rebase_source : db951d96e685e17a4d71fe2aa3d65043661ccccc
2013-07-11 12:17:13 -04:00
Ryan C. Gordon
bcef7dbe16 Added src/thread/pthread/SDL_systls.c to the CMake scripts.
--HG--
extra : rebase_source : 53362426e55c8271f8ea19d2e74997d1f01ea52b
2013-07-11 01:09:45 -04:00
Sam Lantinga
8d546288b9 Catch out of memory errors creating a window 2013-07-10 22:13:19 -07:00
Sam Lantinga
08738a32fb Fixed compile 2013-07-10 22:06:11 -07:00
Sam Lantinga
a6d24b3875 Fixed bug 1949 - Pulseaudio 32 bit audio formats support
Matt Scheirer

Pulse has supported (since version 0.8, at least) 32 bit audio formats that are now becoming available in SDL2. This patch adds those format conversions to the switch clause in the pulseaudio backend.
2013-07-10 22:01:24 -07:00
Sam Lantinga
5b03803ab3 Fixed bug 1953 - Crash at memcpy X11_DispatchEvent(_THIS) Function
Nitz

In Function X11_DispatchEvent(_THIS), case SelectionNotify :
static void
X11_DispatchEvent(_THIS)
{
 // Some Code
  case SelectionNotify: {
  //Some Code
  SDL_bool expect_lf = SDL_FALSE;
                    char *start = NULL; // Initialised with NULL
                    char *scan = (char*)p.data;
                    char *fn;
                    char *uri;
                    int length = 0;
                    while (p.count--) {
                        if (!expect_lf) {
                            if (*scan==0x0D) {
                                expect_lf = SDL_TRUE;
                            } else if(start == NULL) {
                                start = scan;
                                length = 0;
                            }
                            length++;
                        } else {
                            if (*scan==0x0A && length>0) {
                                uri = malloc(length--);

                                memcpy(uri, start, length); // Problem is Here, start is still NULL if control comes to else statement without initialising the start pointer, which is wrong

                                uri[length] = 0;
                                fn = X11_URIToLocal(uri);
                                if (fn) SDL_SendDropFile(fn);
                                free(uri);
                            }
                            expect_lf = SDL_FALSE;
                            start = NULL;
                        }
                        scan++;
                    }
                }
As shown above how start pointer remains NULL, Patch for this issue would be:
                            if (*scan==0x0D) {
                                expect_lf = SDL_TRUE;
                            }
                            if(start == NULL) {
                                start = scan;
                                length = 0;
                            }
Just replace else if statement with if.
2013-07-10 21:57:31 -07:00
Ryan C. Gordon
fcc6274a81 Added src/thread/windows/SDL_systls.c to CMakeLists.txt (thanks, Charles!).
Fixes Bugzilla #1955.
2013-07-10 23:43:35 -04:00
Sam Lantinga
f80a6e7ee5 Added PowerPC and ARM versions of the memory barrier functions. 2013-07-10 20:17:20 -07:00
Sam Lantinga
557bbf3fe6 Added release/acquire memory barriers to the atomic API
* Added a destructor to clean up TLS memory at thread shutdown
* Refactored the TLS code to have platform independent code and a small platform dependent core with a fallback to generic code if platform dependent functions fail.
* Fixed recursion issues with SDL_GetErrBuf()
2013-07-10 18:31:17 -07:00
Sam Lantinga
086ecc9949 Fixed Haiku build 2013-07-10 02:37:57 -07:00
Sam Lantinga
bfcb08d569 Implemented an API for thread-local storage: SDL_TLSCreate(), SDL_TLSSet(), SDL_TLSGet() 2013-07-10 02:32:04 -07:00
Jørgen P. Tjernø
ab91b4ce14 SDL_GL_MakeCurrent: Only no-op redundant calls on *same* thread.
This ensures that we only no-op redundant calls if they're made on the
same thread as the last MakeCurrent with those arguments. This should
maek SDL behave better with multithreaded environments.
2013-07-09 12:58:54 -07:00
Jørgen P. Tjernø
ea36ba4f4e Mac: Remove dead FULLSCREEN_TOGGLEABLE code.
This code was written almost 2 years ago, and the flag hasn't been
changed since. Cleaning up the code by removing the conditional blocks,
so that they behave the same way they have for the past two years.

FULLSCREEN_TOGGLEABLE used to cause us to use
-[NSOpenGLContext setFullScreen] and a pixel format with
NSOpenGLPFAFullScreen.
2013-07-09 12:57:12 -07:00
Gabriel Jacobo
4601ab6894 Removing video/uikit/*.c from configure's iOS sources
Unexplicable computer sciences phenomenon: Instead of returning an empty set,
*.c in an folder with no .c files produces the "*.c" string to be added as
a source. I'm sorry future generations, we are doing the best we can :)
2013-07-09 13:54:29 -03:00
Ryan C. Gordon
2740a12ae3 Backout hg changset 898992405fa7; lots of things still use SDL_types.h. :/
Will remove this again at some point in the future, though.
2013-07-09 11:57:32 -04:00
Sam Lantinga
9c43b29ef9 Made the SDL_memset4() comment even clearer so we don't accidentally replace it with memset() in the future. 2013-07-09 08:01:40 -07:00
Sam Lantinga
98053e8a85 Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect() 2013-07-09 07:13:58 -07:00
Gabriel Jacobo
b2d7f92773 Adds Input Focus handling on Android to improve pausing/resuming behavior
Ref: http://android-developers.blogspot.com/2011/11/making-android-games-that-play-nice.html
2013-07-09 10:25:16 -03:00
Ryan C. Gordon
7afed3e5ae Removed deprecated SDL_types.h header.
Fixes Bugzilla #1945.
2013-07-08 23:37:00 -04:00
Ryan C. Gordon
287d2529bd Replaced SDL_memset4() implementation with a call to SDL_memset().
The implementation was slower than the C runtime on Mac OS X, Linux, and
 Windows...quite a bit slower when using the C fallback instead of the inline
 asm, too.

Fixes Bugzilla #1755.
2013-07-08 23:22:36 -04:00
Edward Rudd
6f3b5c3641 change fsaa argument for testgl to accept a # of samples for FSAA 2013-07-08 17:51:17 -04:00
Ryan C. Gordon
40e8b24572 Disable OSS and BSD audio targets on OpenBSD.
--HG--
extra : rebase_source : f724ffb3927c2331c888eba6f55b71d114269bf4
2013-07-08 13:26:59 -04:00
Sam Lantinga
c6348f33e7 Make sure that srcdir has a full pathname so source indexing works. 2013-07-08 09:21:54 -07:00
Sam Lantinga
435103b3d9 Fixed bug 1943 - Wrong handling of legacy 32bpp BMP files
Kang Seonghoon

While BMP format supports alpha channel, it is enabled only when the header is at least 56 bytes long (BITMAPV3INFOHEADER and later). For very common 40-byte-long header (BITMAPINFOHEADER) 32bpp format should be interpreted as BGRX format, but currently SDL interprets them as BGRA format and causes a significant compatibility problem as many 32bpp files use a padding byte of 0 ("transparent" in BGRA interpretation).

---

I fixed this by checking to see if the alpha channel is all 0, and if so, setting it opaque.
2013-07-07 18:23:04 -07:00
Ryan C. Gordon
0ed61eba4b sndio dynamic loading fix. 2013-07-07 20:06:08 -04:00
Sam Lantinga
6255f7f9a8 Backed out changeset c8b16b3a3c9b 2013-07-07 14:08:07 -07:00
Sam Lantinga
274d4eeec2 Fixed bug 1943 - Wrong handling of legacy 32bpp BMP files
Kang Seonghoon

While BMP format supports alpha channel, it is enabled only when the header is at least 56 bytes long (BITMAPV3INFOHEADER and later). For very common 40-byte-long header (BITMAPINFOHEADER) 32bpp format should be interpreted as BGRX format, but currently SDL interprets them as BGRA format and causes a significant compatibility problem as many 32bpp files use a padding byte of 0 ("transparent" in BGRA interpretation).
2013-07-07 12:53:21 -07:00
Sam Lantinga
30553ceb5b Added automated test to validate conversion between all supported formats. 2013-07-07 12:34:26 -07:00