Commit graph

6845 commits

Author SHA1 Message Date
Ryan C. Gordon
88bdcd6a28 Better attempt to detect available X11 XInput2 features.
Fixes Bugzilla #2306.
2014-03-02 02:00:40 -05:00
Ryan C. Gordon
a5a1ae956b Fixed X11 XInput2 multitouch test to work in configure script.
configure wraps this C code in a main() function, so you can't declare a
function body in there. Besides, I'm not sure why we declared a function
that's part of the multitouch API anyhow.

Now we just reference a type that only exists if the headers have multitouch
support and call it a day.
2014-03-02 01:59:25 -05:00
Ryan C. Gordon
5f11f71362 Windows: Fixed crash if quitting without closing an XInput haptic device.
--HG--
extra : histedit_source : ddde0349ad87c7b525efb7e0b01ee45fef9170af
2014-03-02 00:02:56 -05:00
Ryan C. Gordon
ae216dde6c Added a FIXME. 2014-03-01 22:27:21 -05:00
Ryan C. Gordon
8135173e3f Fixed a typo in a comment. 2014-03-01 22:27:13 -05:00
Ryan C. Gordon
f0cc3c2e56 Dynamically load glGetString(), to avoid direct dependency on OpenGL. 2014-03-01 21:33:48 -05:00
Ryan C. Gordon
81801cb940 Added some FIXMEs. 2014-03-01 20:59:43 -05:00
Ryan C. Gordon
d954bb23ac Mac OS X: Make OpenGL context selection more robust, avoid software fallback.
Fixes Bugzilla #2197.
2014-03-01 20:46:45 -05:00
Ryan C. Gordon
267f8fb155 Force Windows version of SDL_GetPrefPath() to Unicode, create missing dirs.
Fixes Bugzilla #2273.
2014-03-01 20:28:40 -05:00
Sam Lantinga
b2c4391ab7 Changed SDL_HINT_ACCEL_AS_JOY to SDL_HINT_ACCELEROMETER_AS_JOYSTICK to be more clear. 2014-03-01 12:21:15 -08:00
Sam Lantinga
5378997447 Fixed compiler warning 2014-03-01 11:42:12 -08:00
Sam Lantinga
4835900bcd Fixed compiler warning 2014-03-01 11:40:41 -08:00
Sam Lantinga
986b5a39b2 Fixed test for libuuid.a 2014-03-01 11:39:39 -08:00
Sam Lantinga
8bb2f07439 Updated with the latest 2.0.2 API changes 2014-03-01 11:05:58 -08:00
Sam Lantinga
651b638ea3 Fixed bug 2368 - Security Software is blocking RegisterRawInputDevices()
Yamagi

A customer of mine had the strange problem, that SDL_SetRelativeMouseMode() was failing for him on Windows 7. Luckily he was willing to provide some debug informations. We could track this problem down to RegisterRawInputDevices() failing due to security software running on his system (Norton Internet Security to be precise, but there are reports of similar problems with other products. For example [1]). Working around this issue with SDL_WarpMouseInWindow() is easy, and while I don't think that SDL2 can provide an internal workaround it would be really nice and helpfull if this could be documentated somewhere.

1: http://forums.codeguru.com/showthread.php?498374-How-to-run-a-very-long-SQL-statement
2014-03-01 09:59:06 -08:00
Sam Lantinga
b7435a3ad3 Fixed bug 2423 - timeBeginPeriod & timeEndPeriod mismatch
Coriiander

In src\timer\windows\SDL_systimer.c there is an error with regards to timeBeginPeriod and timeEndPeriod. These functions typically get called when no high resolution timer is available, and GetTickCount is not used.

According to MSDN (link: dd757624(v=vs.85).aspx), for every call to timeBeginPeriod a subsequent call to timeEndPeriod is required. While SDL is currently doing this, it fails to call timeEndPeriod when cleaning up/shutting down SDL. Please note that these functions affect things on a system level. Failing to call timeEndPeriod, disables applications for using WINMM-timers after usage&shutdown of SDL, as effectively they the mechanism is now broken.

Solution:
Ensure this code gets called when shutting down the timer subsystem:

#ifndef USE_GETTICKCOUNT
if (!hires_timer_available)
{
    timeSetPeriod(0);
}
#endif
2014-03-01 09:50:52 -08:00
Sam Lantinga
cff6eb5155 Null termnate the pUserMappings variable to prevent memory corruption. 2014-02-28 16:24:41 -08:00
Sam Lantinga
3dfda84048 Added a hint to enable the screensaver by default 2014-02-28 14:23:41 -08:00
Ryan C. Gordon
c5162134d2 Disable the screensaver by default.
Fixes Bugzilla #2218.

--HG--
extra : rebase_source : 839adf21025b06637f25ff2d2756c05a00d0d87a
extra : histedit_source : da99e2c6f35926cfc13b83e5557ffec57e2b1b78
2014-02-27 22:06:41 -05:00
Gabriel Jacobo
2e034c2a74 Improve window recreation logic in OpenGL* renderers 2014-02-27 20:21:46 -03:00
Jørgen P. Tjernø
28741acca1 Mac: Forgot return value in last commit. 2014-02-26 16:27:03 -08:00
Jørgen P. Tjernø
bd9b49b64c Mac: Don't disassociate cursor if window is moving / doesn't have focus.
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396
2014-02-26 16:10:52 -08:00
Jørgen P. Tjernø
b8fae2ab0b Mac: Redo cursor warp handling.
This fixes bugs related to getting unnaturally large xrel/yrel for
SDL_MOUSEMOTION after warps and enabling / disabling relative mode.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=1836
2014-02-26 11:35:02 -08:00
Jørgen P. Tjernø
dae431ed0e Mac: Improve moving relative mode windows.
This makes it possible to move windows by their title bar, even if they're in
relative mode, if you click the title bar when the window does not have focus.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2396

--HG--
extra : amend_source : 01cfe87acac88dd75b2f074d3833129605c46ed2
2014-02-25 17:27:41 -08:00
Jørgen P. Tjernø
ca29983393 Mac: Fix error message for haptic subsystem.
We were calling SDL_Error instead of SDL_SetError when the haptic subsystem
wasn't initialized.
2014-02-25 17:25:49 -08:00
Jørgen P. Tjernø
7316ed4a8f Mac: Immediately update current OpenGL context's shape.
Previously we were postponing our -[NSOpenGLContext update] call to the next
SDL_GL_SwapWindow, even if the context was current on the current thread. This
changes it so that we will do the update immediately if it's the current
context.

If you're rendering on another thread, you need to call SDL_GL_SwapWindow once
after a resize event to ensure your drawable will produce non-garbage data.

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2339

--HG--
extra : rebase_source : 3316bbdbaf00cbbec9bcdcc5ef3dd11b814b1dc9
extra : amend_source : 15988f6bf499cd6d4ffa914988805ab298ee7661
2014-02-25 15:28:12 -08:00
Gabriel Jacobo
83efc7045c Fixes #2308, recreate window if GL requirements for the renderer are not met
If the window has been created with values for SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION not matching those
required by the renderer, attempt to recreate the window.
This is needed on platforms where both GL and GLES 1/2 surfaces are supported
by the video backend, requiring that the window be recreated when switching
between context types.
2014-02-25 17:42:34 -03: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