Commit Graph

6124 Commits

Author SHA1 Message Date
Sam Lantinga
c7dfdbb52f Fixed bug 1569 - Android volume keys not honoured inside SDL
Joseba García Echebarria

The current version of SDL HG in Android doesn't do anything when volume keys are pressed.
The change makes SDL ignore volume keys so that they're handled by the OS and the sound volume can be changed within an app.
2013-07-31 21:08:22 -07:00
Ryan C. Gordon
5c921db1f1 Windows: Don't lose the existing current GL context in SDL_CreateWindow().
Fixes Bugzilla #1395.
2013-08-01 00:01:57 -04:00
Gabriel Jacobo
53cf4bf3c6 Set mAudioTrack to null when AudioTrack initialization fails
Prevents potential problems when stopping the app.
2013-07-31 16:25:50 -03:00
Edward Rudd
fb8455ec81 Further fix SIZEOF_VOIDP in SDL_config.h.in
The configure script was still overwriting SIZEOF_VOIDP so both ended up as either 4 or 8 depending on the arch.  This simply removes the check from configure.in
2013-07-31 12:13:26 -04:00
Ryan C. Gordon
6bcb92b468 Workaround some Windows OpenGL drivers mishandling wglMakeCurrent().
You should be able to do wglMakeCurrent(NULL, NULL), according to MSDN, since
the first parameter is ignored if the second is NULL, but this causes problems
on some drivers, so make sure we always have a valid HDC in the first
parameter (and exit early if we already have no current context in the
NULL, NULL case).
2013-07-31 11:00:23 -04:00
Gabriel Jacobo
b5b67aacf8 Fix for bug 2001, verify that the AudioTrack is properly initialized
...and fail to initialize the audio backend if it's not!
2013-07-31 10:04:59 -03:00
Sam Lantinga
ccdd2f87a3 Fixed bug 2000 - The framework INSTALL_PATH still uses @executable_path
dak180

Since the MACOSX_DEPLOYMENT_TARGET is 10.5; INSTALL_PATH should use @rpath.

See http://www.dribin.org/dave/blog/archives/2009/11/15/rpath/ for the details on why this is a good idea.
2013-07-30 23:33:32 -07:00
Sam Lantinga
1a3a905aa9 Added code signature step to Framework build process 2013-07-30 21:39:38 -07:00
Sam Lantinga
94c6b39a04 Check for negative source rectangle in SDL_SoftBlit() (thanks John!) 2013-07-30 20:57:26 -07:00
Philipp Wiesemann
0f4de98390 Added support for the two new key codes from Android 4.3. 2013-07-30 23:24:23 +02:00
Sam Lantinga
ff814534d2 Fixed compiler warning with gcc 2013-07-30 00:02:45 -07:00
Sam Lantinga
a804c33317 Fixed stack smashing crash when using the GCC compiled DLL with Visual Studio. 2013-07-29 23:28:25 -07:00
Ryan C. Gordon
a164f89158 Workaround older libpulse that fails in pa_context_new() with a NULL appname.
Newer libpulses do sane defaults if you pass a NULL there. In lieu of a
proper way to specify this in SDL at the moment, this will do.

Fixes Bugzilla #1119.
2013-07-30 01:32:26 -04:00
Ryan C. Gordon
ff56141020 These should be __inline__, not inline. 2013-07-30 01:30:32 -04:00
Ryan C. Gordon
ece38070df Attempt to fix compiler warning.
Fixes Bugzilla #1784. (or at least the only part of it that was a real bug.)
2013-07-30 00:17:44 -04:00
Sam Lantinga
1d3d9d10fb Added documentation saying the render API isn't for multi-threading. 2013-07-28 11:24:16 -07:00
Philipp Wiesemann
1de7a622ab Changed test program to be more compatible C. 2013-07-27 21:11:12 +02:00
Philipp Wiesemann
719f8227e0 Removed unused variable from test program. 2013-07-27 21:07:07 +02:00
Philipp Wiesemann
af2f530b05 Removed unused parameter in test program. 2013-07-27 21:05:04 +02:00
Philipp Wiesemann
81450906db Corrected words in comments of test programs. 2013-07-27 21:02:50 +02:00
Ryan C. Gordon
8ee90e400d Fixed return value documentation for SDL_HapticUpdateEffect().
It was a cut-and-paste error from SDL_HapticNewEffect(), right above it.
2013-07-27 13:18:54 -04:00
Ryan C. Gordon
ce89bf2ea5 Backed out hg changeset 7f26fd1df927; docs were wrong, not the code. 2013-07-27 13:13:57 -04:00
Ryan C. Gordon
f5d7428a9e Added a FIXME discussion to last commit. 2013-07-27 13:09:15 -04:00
Ryan C. Gordon
a5c322ecb7 Cocoa: Make the next-highest window gain focus when a window is closing.
(if the closed window wasn't the foreground, this is effectively a no-op.)
2013-07-22 20:55:07 -04:00
Philipp Wiesemann
2f2a724332 Fixed SDL_HapticOpened() returning -1 instead of 0.
According to header file it should only return 0 or 1.
2013-07-27 14:22:52 +02:00
Philipp Wiesemann
4f10b00b2b Removed C++ macro setup in internal header for Android port which is only C now. 2013-07-27 14:06:06 +02:00
Philipp Wiesemann
68c09645a0 Fixed SDL_HapticRumblePlay() maybe working because of SDL_HapticUpdateEffect(). 2013-07-27 13:52:16 +02:00
Philipp Wiesemann
10df5ccc6d Corrected SDL_HapticUpdateEffect() returning 0 instead of index of effect.
According to documentation in header and wiki the index should be returned.
This change may break existing programs which assume only 0 means a success.
2013-07-27 13:39:43 +02:00
Sam Lantinga
aab0048d87 Added example of using the software renderer and window surface API, contributed by Nitin Jain. 2013-07-27 03:48:23 -07:00
Sam Lantinga
7fcffeefe0 Fixed bug 1983 - SDL_thread.h broken under MinGW crosscompiling environment
q66

after updating SDL2 to the latest RC I'm unable to build my game engine under mingw crosscompiling environment for Windows (32bit, hosted on freebsd 64bit).

The error is in SDL_thread.h with messages like this: http://codepad.org/jEQXd3Yq

The problem is, while _beginthreadex return type is correctly mapped to uintptr_t (as specified by Microsoft), the return type under mingw is unsigned long int (same size, different signature), resulting in the error above.

The reason it didn't error before is this: http://codepad.org/8FAbKAxz

You can see the _beginthreadex case is only used without HAVE_LIBC defined; at one point though, SDL_config_windows.h was changed like this:

-/* Enabled for SDL 1.2 (binary compatibility) */
-#define HAVE_LIBC     1
+/* This is disabled by default to avoid C runtime dependencies and manifest requirements */

resulting in these errors.
2013-07-27 03:44:03 -07:00
Sam Lantinga
1e7eb916c9 Fixed variable scoping for Windows build 2013-07-27 03:22:37 -07:00
Sam Lantinga
ddb703566e Fixed bug 1272 - Bogus numlock key up/down events being reported on MacOS X
Vern Jensen

The problem is that in certain situations I'm getting THREE keyUp/keyDown events when I push certain keys.

In my event code I added:

case SDL_KEYUP:

printf("SDL KeyScanCode for KEYUP event: %d\n", event->key.keysym.scancode );
…

and

case SDL_KEYDOWN:

printf("SDL KeyScanCode for KEYDOWN event: %d\n", event->key.keysym.scancode );
…

The result of one test run where I push 2 keys and then release them is this:

SDL KeyScanCode for KEYDOWN event: 92   // Pushed keypad 4
SDL KeyScanCode for KEYDOWN event: 83   // Pushed left shift
SDL KeyScanCode for KEYUP event: 83
SDL KeyScanCode for KEYDOWN event: 225
SDL KeyScanCode for KEYUP event: 92     // Released keypad 4
SDL KeyScanCode for KEYDOWN event: 83
SDL KeyScanCode for KEYUP event: 83
SDL KeyScanCode for KEYUP event: 225    // Released left shift

There *should* be only a total of 4 events above… 2 for each key being pushed, and 2 for each being released. But instead some bogus events for numlock being pushed/released are sent from SDL. These events did not occur. I did not push numlock. The value above for numlock is 83. Comments above show when I pushed each key. As you can see, when I push left shift, THREE events are instantly sent to my application, keyDown and then keyUp for numlock, and then the valid event for left shift (the key that was actually pushed).

You could replace keypad 4 with pretty much any keyPad key and it'll still happen. You can also replace it with any arrow key and it'll happen. However, when trying it with normal letter keys on the main keyboard it didn't.

It happens with other modifier keys too, not just left shift.

The order in which the keys are pressed matter. For instance, if I do:

1) keypad 4
2) left shift
3) release left shift
4) release keypad 4

Then at step 2, I get the 3 events above (when there should be only one), but steps 3 and 4 work properly… I don't get extra keyUp/keyDown events for steps 3 or 4. Thereas if the order of steps 3 and 4 are reversed, I get the bogus extra events for numlock.

Also, the problem can occur even when pushing just a single key by itself. If I push left shift, then keypad 4, then release left shift, then release keypad 4, then the following push of left shift will cause the bug. If I continue pushing and releasing left shift though, it won't happen again until I again involve keypad keys.

---

Sam Lantinga

According to the Apple documentation, NSNumericPadKeyMask is set for any arrow or numeric keypad event. Indeed this is what's happening.

I verified that we get the correct events for the numlock key and the mod state gets set correcly, so it should be safe to remove this bogus code.
2013-07-27 03:20:09 -07:00
Sam Lantinga
10aa2f9e9d Fixed bug 1743 - CMake produces libraries with wrong filename/SONAME
David Gow

As discussed on the list, the autotools build backend uses libtool's "release" option, giving us the SONAME libSDL2-2.0.so.0, whereas CMake doesn't, giving us libSDL2.so.0

While libSDL2.so.0 has some small advantages (being simpler and matching the names on some other OSes better), many products have already been developed expecting libSDL2-2.0.so.0, which better matches SDL 1.2's SONAME. It seems clear, therefore, that most developers prefer this name.

This patch emulates libtool's functionality, making libSDL2-2.0.so.0 the name of the shared library, while leaving libSDL2.a as the filename of the static library. Unlike with libtool, no libSDL2.so symlink is yet made. I also haven't tested this on anything but Linux, so it might break other platforms. :/
2013-07-27 02:50:19 -07:00
Sam Lantinga
cffce6aedd Improved error checking in the haptic system, preventing crashes in some cases.
Edgar Simo 2012-05-06 02:33:39 EDT

I recall that driver being buggy back in the day, but looking over the code there's a number of things being done wrong which I've fixed and it should now properly error out instead of crashing. Also make sure you initialize the haptic subsystem before using haptic commands (which I now more explicitly try to enforce).
2013-07-27 02:45:26 -07:00
Sam Lantinga
85df5b29d7 Fixed bug 1919 - Window icon disappears as soon as a renderer is created
Sebastian

Setting a window icon works just fine until a renderer is added to the window.
After adding the renderer the icon disappears.

Reproduce by:
- Take the example code from the wiki: http://wiki.libsdl.org/moin.fcg/SDL_SetWindowIcon

- Add the following two lines after  SDL_FreeSurface(surface);
  SDL_Delay(1000);
  SDL_Renderer* ren = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

-compile and run

You will see the window icon correctly at first. After the Delay the Icon will disappear.
2013-07-14 18:17:28 -07:00
Sam Lantinga
92312a88ef Fixed bug 1526 - X11 - XUnmapWindow should not be called directly
driedfruit

In X11_HideWindow, we call XUnmapWindow to unmap. According to ICCCN2.0, this should never happen, and XWithdrawWindow should be called instead.

http://www.tronche.com/gui/x/icccm/sec-4.html#s-4.1.4

"The reason for requiring the client to send a synthetic UnmapNotify event is to ensure that the window manager gets some notification of the client's desire to change state, ***even though the window may already be unmapped when the desire is expressed***."

Additionally, this can be observed at http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/Withdraw.c#n65

Failure to comply leads to "MapNotify" event never appearing on non-reparenting WMs after subsequent show-hide-show requests. (I'm currently observing this behavior, thus my bug report).
2013-07-27 00:49:34 -07:00
Jørgen P. Tjernø
42ae5d7882 Fix cmake breakage (thanks Marcus)
My recent change broke the sdlcheck.cmake by not escaping some quotes properly.
Thanks to Marcus von Appen for pointing it out and providing the patch.
2013-07-26 13:30:24 -07:00
Gabriel Jacobo
8ebc49587f Consider the case where an attribute is set to EGL_DONT_CARE in eglChooseConfig
SDL doesn't currently use EGL_DONT_CARE, but it doesn' hurt to future proof.
2013-07-26 12:37:36 -03:00
Gabriel Jacobo
77cacb8357 [Android] Bug 1827, select the best matching config provided by eglChooseConfig 2013-07-26 12:22:40 -03:00
Sam Lantinga
a89e64a94e Fixed crash and garbled output when converting from F32 to S16 audio. 2013-07-25 18:11:09 -07:00
Sam Lantinga
7eff345ecb Updated the copyright year for the test programs 2013-07-25 09:51:21 -07:00
Philipp Wiesemann
499372f2c1 Corrected return value to be of correct type. 2013-07-24 22:25:17 +02:00
Philipp Wiesemann
1af8caa0a0 Corrected internal documentation in source.
The parameter silent is no longer optional.
2013-07-24 22:23:19 +02:00
Philipp Wiesemann
addf454fb9 Removed unreachable code. 2013-07-24 22:20:03 +02:00
Philipp Wiesemann
d139035d90 Removed unused variables to fix warnings in test program. 2013-07-24 22:19:01 +02:00
Sam Lantinga
159649b794 Fix for recent GLX error bug
Lee Salzman

I messed up in the patch I sent you regarding gobbling up the GLX error codes signaled when trying to create a context. After reading the spec I realized those error codes are relative to a base error that needs to be queried when setting up the GLX extension...

So I have made a patch that fixes it for a user I had who was still getting the bug with my old patch.

Without this patch my previous one won't work, so it is recommended to merge this...
2013-07-23 19:20:03 -07:00
Sam Lantinga
cc357a636a A little cleanup on the cleanup, just for consistency. 2013-07-23 19:18:01 -07:00
Jørgen P. Tjernø
01972a2e9d = {{0}} generates a memset() in MSVC, which isn't linked. Whoops! 2013-07-23 17:40:18 -07:00
Jørgen P. Tjernø
f87ccc3ea5 Fix build errors from last change. 2013-07-23 17:40:16 -07:00
Jørgen P. Tjernø
61b46199ac Fix some clang analyzer warnings.
This fixes some analyzer warnings and a couple of minor memory leaks.
2013-07-23 17:40:13 -07:00