Commit graph

7264 commits

Author SHA1 Message Date
David Ludwig
fcbc582b23 WinRT: enabled OpenGL ES 2 support by default
A copy of ANGLE/WinRT is still needed to run OpenGL content, but is not needed to compile SDL/WinRT.
2013-12-21 10:08:11 -05:00
CarniBlood
dedca211f8 fixed gles/gles2 renderer creation fail on Android when default major/minor version doesn't match 2013-12-19 06:01:18 +09:00
Sam Lantinga
0fe823b5cd Fixed crash if the input data pitch is larger than the locked texture pitch 2014-02-25 10:04:49 -08:00
Sam Lantinga
071160984a Don't warp the mouse while we're doing a modal interaction 2014-02-24 23:09:35 -08:00
Sam Lantinga
0439b46866 Make sure we don't clip the cursor while clicking on the window title bar 2014-02-24 22:49:30 -08:00
Sam Lantinga
78d6f1432e Fixed relative mouse mode with multiple windows.
The window cursor clipping will be taken care of when SDL_UpdateWindowGrab() is called.
2014-02-24 22:37:58 -08:00
Sam Lantinga
6a608bf9d8 Added a bunch of missing windows messages 2014-02-24 22:36:24 -08:00
Jørgen P. Tjernø
8397bfa2ae Mac: Fix inconsistent repeat of SDL_TEXTINPUT events on 10.7+
Due to the new "tap and hold" IME in Mountain Lion and above, we were getting
inconsistent repeat of SDL_TEXTINPUT events. Disabling that functionality (since
you can't see the popover anyway) solves this.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2387
2014-02-24 16:42:08 -08:00
Gabriel Jacobo
e8ff2a9d5b Fixes #2296 - SDL_GL_UnbindTexture segfaults (thanks Daniel Bünzli) 2014-02-24 18:57:22 -03:00
Ryan C. Gordon
d210539a55 CMake: Fixed build on Mac OS X.
--HG--
extra : rebase_source : f4cf7d23db97cdaf223be63fa93c4fa713c68276
2014-02-24 11:24:48 -05:00
Gabriel Jacobo
9faed54ab1 Zero out haptic linked list items on creation
(thanks to Turo Lamminen for the report!)
2014-02-24 10:25:02 -03:00
Gabriel Jacobo
ac487a8eec Fixes #2417, memory leak in SDL_gamecontroller.c (thanks Leonardo!) 2014-02-24 10:00:10 -03:00
Ryan C. Gordon
08107940e9 Free the correct variable. 2014-02-23 01:24:46 -05:00
Ryan C. Gordon
729201110d CMake: Just assume Apple platforms have Cocoa support.
Fixes Bugzilla #2056.
2014-02-23 01:10:33 -05:00
Ryan C. Gordon
5210e4cf9d Fixed Mac DualShock 4 gamecontroller db entry again.
--HG--
extra : rebase_source : 1eeb30a0022d817a68f91b7fad1025a7e8a8e24d
2014-02-22 21:21:33 -05:00
Ryan C. Gordon
7ecd3a6867 Mac joystick: ignore duplicate HID elements.
The DualShock 4 has all elements listed twice: once in the top-level list of
 elements, and once in an "Application Collection" element at the top-level.

Each element has a proper cookie with a unique value, so now we descend into
 each element collections, but before we add an element to the device's list,
 we make sure we don't already have one with that cookie, probably from
 another collection or a buggy device.

--HG--
extra : rebase_source : 0e5058ff3333364e680eb79d3cbcfa168ab2a068
2014-02-22 21:15:34 -05:00
Sam Lantinga
3b9df91fd6 Fixed bug 2404 - CPU detection not working with MSVC on x64
Tiemo Jung

All CPU detection functions SDL_Has* will return false, even if it is supported by the CPU, if SDL is compiled with MSVC and the target is x64.

The reason for this is that 'CPU_haveCPUID' will return 0 and macro 'cpuid' in SDL_cpuinfo.c is the fallback implementation, which sets all params to zero.

It is safe to assume that cpuid is supported on a CPU that runs windows x64, so CPU_haveCPUID can just return 1, and the empty macro can be replaced with a small wrap around the __cpuid intrinsic.
2014-02-22 19:10:45 -08:00
Sam Lantinga
1dfdcf3ef4 Fixed bug 2335 - Fails to build on Debian GNU/kFreeBSD
Felix Geyer

Starting from version 2.0.1 libsdl fails to build on Debian GNU/kFreeBSD in SDL_cpuinfo.c.

GNU/kFreeBSD defines __FreeBSD_kernel__ but not __FreeBSD__.
The #ifdef __FreeBSD__ check should be extended for __FreeBSD_kernel__, see the attached patch.

Build log:
libtool: compile:  gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DUSING_GENERATED_CONFIG_H -Iinclude -I/«BUILDDIR»/libsdl2-2.0.1+dfsg1/include -mmmx -m3dnow -msse -msse2 -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-kfreebsd-gnu/dbus-1.0/include -DHAVE_USBHID_H -DUSBHID_NEW -D_REENTRANT -Wall -c /«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c  -fPIC -DPIC -o build/.libs/SDL_cpuinfo.o
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c: In function 'SDL_GetSystemRAM':
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: error: 'HW_MEMSIZE' undeclared (first use in this function)
             int mib[2] = {CTL_HW, HW_MEMSIZE};
                                   ^
/«BUILDDIR»/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [build/SDL_cpuinfo.lo] Error 1
2014-02-22 18:01:18 -08:00
Sam Lantinga
ee413cf91e Fixed bug 2347 - On OSX, an SDL app prevents system shutdown.
Tim McDaniel

On OSX, an SDL app forces a system shutdown to be cancelled.  This happens because [SDLAppDelegate applicationShouldTerminate] returns NSTerminateCancel.  A better approach is to subclass NSApplication and override terminate to do nothing except call SDL_SendQuit.  In response to a system shutdown notification, this allows the normal SDL Quit event processing to occur, and if the app then terminates, system shutdown occurs normally.  Please see the attached patch, based on SDL 2.0.1.
2014-02-22 17:55:58 -08:00
Sam Lantinga
c505974f89 Don't fail initialization if the helper window class already exists. 2014-02-22 17:39:35 -08:00
Sam Lantinga
0438b40945 Fixed bug 2395 - OSX: App name in the menu bar is not localized.
Tim McDaniel

On OSX, the app name in the menu bar is not localized.  This can be fixed using the following implementation for GetApplicationName in SDL_cocoaevents.m:

static NSString *
GetApplicationName(void)
{
    NSDictionary *dict;
    NSString *appName = 0;

    appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
    if (!appName)
        appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];

    if (![appName length])
        appName = [[NSProcessInfo processInfo] processName];

    return appName;
}
2014-02-22 17:32:18 -08:00
Sam Lantinga
409b56b60c Fixed bug 2298 - undefined reference to `IID_IUnknown' on cygwin
Brian Minton

When building static or shared libraries on cygwin 1.7.25 on Windows 7 (32-bit), I get the following link errors:

build/.libs/SDL_windowskeyboard.o: In function `UIElementSink_QueryInterface@12':
/home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:995: undefined reference to `IID_IUnknown'
build/.libs/SDL_windowskeyboard.o: In function `IPPASink_QueryInterface@12':
/home/c-bminton/src/SDL/src/video/windows/SDL_windowskeyboard.c:1101: undefined reference to `IID_IUnknown'
collect2: error: ld returned 1 exit status
Makefile:126: recipe for target 'build/libSDL2.la' failed
make: *** [build/libSDL2.la] Error 1

--
The libuuid from e2fsprogs is completely unrelated to the w32api UUID.DLL implib. FWIW, any *NIX software that I've seen obviously wants the e2fsprogs version, but if libuuid-devel is installed (in /usr/lib) then you can't link against the w32api implib with a simple -luuid.
2014-02-22 15:34:31 -08:00
James Legg
9c3587ee5d Fix audio conversion when channel count changes
- Use the SDL_AUDIO_MASK_DATATYPE bit when selecting an implementation
  where it matters. Previously two existing AUDIO_F32 cases had been
  written, but were unreachable.
- Add AUDIO_F32 case for SDL_ConvertSurround_4.
- Fix incorrect pointer arithmetic causing the 2 to 6 channel
  conversion for 4 byte audio formats to read and write beyond the end
  of the buffer.
2014-02-21 13:57:53 +00:00
Sam Lantinga
f27c940fec Fixed bug 2414 - Execute event watchers in the order they were added
Leonardo

Event watchers are being executed on the inverse order they are added because they are added to the head of the SDL_event_watchers list.

Since watchers are allowed to change events before they are reported (they shouldn't, imo), this breaks code that rely on watcher execution order (such as distributed event handling).

An easy scenario to see this behaving weird to the user is if you add an event watcher to check mouse coordinates and check them again in your event loop. If you add the watcher after renderer's one (which always happens after you have initialized renderer), you get the same event but different coordinates.

The proposed patch adds the event watcher in the tail of the list, not in the beginning, and correctly fixes this problem.
2014-02-22 15:27:11 -08:00
Sam Lantinga
8a15985929 Fixed bug 2407 - Support for OpenGL ES 3 contexts on iOS
Alex Szpakowski

Currently the UIKit/EAGL backend for SDL's OpenGL context creation API doesn't support OpenGL ES 3, despite iOS 7+ being capable (on devices with the necessary hardware.)

I have attached a patch to add support. It's also slightly more future-proof, so eventual OpenGL ES 4+ capability on iOS should hopefully work without requiring changes to SDL's UIKit/EAGL backend.
2014-02-22 15:23:09 -08:00
Sam Lantinga
6c4e7ebabe Fixed bug 2346 - Mac: mousewheel events have flipped horizontal scroll values
Alex Szpakowski

On my Mac OS X system (10.9.1), the SDL_MOUSEWHEEL event reports negative X values when my trackpad scrolls to the right, and positive X values when my trackpad scrolls to the left. This is backwards from what I'd expect, and I don't think it matches the Windows wheel events.

The vertical scroll values are what I'd expect though, and are consistent what gets reported on Windows (positive Y for scrolling up, negative Y for scrolling down.)

This is with "scroll direction: natural" disabled in the OS X trackpad settings (i.e. my scroll direction in non-SDL OS X programs matches what happens in Windows and Linux.)

I also tested with the horizontal scroll on a real mouse (Logitech G500 without custom drivers), and the horizontal scroll values in SDL are still flipped.

I "solved" the issue for myself by changing this line in the Cocoa_HandleMouseWheel function:

    float x = [event deltaX];

to this:

    float x = -[event deltaX];

I believe it should work fine with that change - I found something similar in another codebase while looking online for my issue - but I haven't tested on anything below Mac OS 10.8.
2014-02-22 14:57:12 -08:00
Sam Lantinga
4042f4a71d Thou shalt not use more than 4k local variables in this code. 2014-02-22 10:40:12 -08:00
Ryan C. Gordon
4e89bc0a11 Reworked Mac OS X joystick code to use the 10.5+ HID Manager API.
Besides being a little more simple to use than the earlier IOKit HID API, and
 less likely to be deprecated, it also has the added benefit of working with
 the Sony DualShock 4 controller in Bluetooth mode out of the box, whereas
 the previous API has a bug that makes it report bad data for the
 controller.

Cleaned up several other things in this code, having gone over every line of
 it. The remaining deprecated calls are also gone.

--HG--
extra : rebase_source : 47e220fea5d6ab87d51b23736b12d069a9a5313f
2014-02-22 00:55:28 -05:00
Gabriel Jacobo
d6287ff195 Fixes #2326, clean up the X11 backend a bit 2014-02-21 08:37:57 -03:00
Sam Lantinga
efdbdb5ae7 Fixed infinite recursion in D3D_Reset() 2014-02-20 21:07:56 -08:00
Gabriel Jacobo
d0fff34d42 Fixes #2408, VS2013: several projects of release build are not built
Patch by Hiroyuki Iwatsuki
2014-02-20 17:03:55 -03:00
Gabriel Jacobo
42a3d5f36d Improve testgles2 exit behavior (useful on Android) 2014-02-20 16:12:11 -03:00
Gabriel Jacobo
464c9a9fc4 Fixes #2403, add SDL2 dependency to testgles2 (thanks Hiroyuki Iwatsuki) 2014-02-19 11:03:03 -03:00
Sam Lantinga
6b4444c027 Fixed resetting the current render target if the D3D device is reset while using a non-default render target. 2014-02-17 22:20:33 -08:00
Ryan C. Gordon
2d5bf23169 s/iPhoneOS/iOS 2014-02-17 11:47:54 -05:00
Ryan C. Gordon
7a997f59a9 Corrected battery percentage on iOS (thanks, Felix!).
Fixes Bugzilla #2397.
2014-02-17 11:46:23 -05:00
Philipp Wiesemann
6b77a0bcbf Fixed documentation comments in SDL_hints.h file. 2014-02-16 00:04:15 +01:00
Philipp Wiesemann
b854719834 Changed text in documentation. 2014-02-15 23:57:38 +01:00
Philipp Wiesemann
e5b870617d Corrected name of hint in README. 2014-02-15 23:52:04 +01:00
Sam Lantinga
a51fa61986 Make sure we don't stay in the windows event loop forever if there are lots of events coming in quickly. 2014-02-14 11:39:58 -08:00
Sam Lantinga
4a8a8b7d99 Fixed Mac PS4 controller entry, added Linux OUYA controller entry 2014-02-14 11:38:59 -08:00
Sam Lantinga
7922c3b3d5 Added the new function at the end so we don't break the ABI 2014-02-13 11:08:12 -08:00
Sam Lantinga
04fc41aee6 Back out changelist 1951976 2014-02-13 11:05:34 -08:00
Sam Lantinga
01ba6c5f4c Back out changelist 2026006 2014-02-13 11:05:32 -08:00
Sam Lantinga
2d76dd6a5d Added SDL_DXGIGetOutputInfo which returns the adapter and output indices that are used to create DX10 and DX11 devices and swap chains on a particular display.
CR: SamL
2014-02-13 11:05:30 -08:00
Sam Lantinga
e16a129e19 Fixed lost mouse button when in relative mouse warp mode and you click on the title bar, entering a modal move/resize loop.
Testing:
* Set the SDL_HINT_MOUSE_RELATIVE_MODE_WARP hint true, run testsprite2, press Ctrl-R to enter relative mode, alt tab away from the window, then click on the title bar of the window. Didn't get the mouse button release before, and we do now.

CR: Yahn + Alfred
2014-02-13 11:05:28 -08:00
Sam Lantinga
1e29e2e444 As part of Jorgen's code review of this function I added a call to LoadLibrary so the refcounts would be consistent between Windows and Posix. Then I forgot to include the check that the thing was actually loaded and caused it to be loaded all the time. Oops.
CR: AaronL
2014-02-13 11:05:26 -08:00
Sam Lantinga
714ed7849a Added SDL_GetLoadedModule to do the equivalent of GetModuleHandle/dlload(NOLOAD)
CR: Jorgen
2014-02-13 11:05:24 -08:00
Gabriel Jacobo
bf6a7b1a2d Try to work around Android's handling of static variables in terminated apps
Android, we want to love you, but you don't make it easy for us...
2014-02-12 18:12:14 -03:00
Sam Lantinga
9eb2cc5c7a Fixed crash if render target textures are used while the device is lost 2014-02-10 13:40:02 -08:00