Commit Graph

6028 Commits

Author SHA1 Message Date
Jørgen P. Tjernø
46e6bc483d Fix #1445: Use xcrun to find CpMac
This should make the DMG building step more reliable on all current and future
Xcodes, by using xcrun to find the path to CpMac.
2013-07-14 15:55:34 -07:00
Jørgen P. Tjernø
c96b5c574e Fix #1667: Docs about SDL_CreateWindow and flags.
Updates the docs to say you can use SDL_WINDOW_HIDDEN, instead of (the ignored)
SDL_WINDOW_SHOWN.
2013-07-14 15:46:43 -07:00
Sam Lantinga
9f8cddc1ba Re-enabled other messagebox tests, moved the SDL_Init() call as late as possible to show the circumstances where it's needed. 2013-07-14 12:16:10 -07:00
Sam Lantinga
d1adb0a986 Fixed bug 1970 - Cocoa message boxes ignore parent window requests
Ryan C. Gordon

Cocoa_ShowMessageBox() ignores the "window" field of SDL_MessageBoxData, which means you can't assign a parent window to a message box. This is particularly egregious on Mac OS X, because it'll actually make the NSAlert visually part of the parent window instead of just concerning itself with window focus.
2013-07-14 11:58:57 -07:00
Sam Lantinga
c1de40a848 Added testing of messagebox with a parent window 2013-07-14 11:57:45 -07:00
Sam Lantinga
8ab710e751 Fixed code example for SDL_GetWindowWMInfo() 2013-07-14 11:57:01 -07:00
Sam Lantinga
ef2e62274f Removed obsolete assertion code 2013-07-14 11:43:25 -07:00
Sam Lantinga
b950abe129 Make sure a window is valid for a subsystem before using it in a messagebox 2013-07-14 11:41:57 -07:00
Sam Lantinga
c8b8665f43 If the video system has been initialized, only use that message box system.
Don't pass a window from one video driver to the messagebox function of another video driver.  This makes bad things happen. :)
2013-07-14 11:11:42 -07:00
Philipp Wiesemann
9b5b5539ee Fixed compiler warnings in test program by using wrapped functions. 2013-07-14 19:56:22 +02:00
Philipp Wiesemann
2f8b666051 Changed use of isspace() to SDL_isspace(). 2013-07-14 19:53:50 +02:00
Ryan C. Gordon
26b21dc5ff Implement float32 support for winmm and directsound targets (Thanks, John!).
Fixes Bugzilla #1657.
2013-07-14 13:27:54 -04:00
Ryan C. Gordon
c88d5e0b60 Fixed compiler warning in testtimer.c 2013-07-14 13:25:49 -04:00
Ryan C. Gordon
f6250318c6 Protect SDL_PauseAudio*() with the audio callback lock.
Otherwise, you can pause audio and still have the callback running, or run
 one more time. This makes sure the callback is definitely stopped by the
 time you return from SDL_PauseAudio().
2013-07-14 12:42:12 -04:00
Ryan C. Gordon
10513105ac Fixed off-by-one error in SDL_AudioQuit() (thanks, Rainer!).
Audio Devices IDs are offset by one.

Fixes Bugzilla #1971.
2013-07-14 11:28:18 -04:00
Philipp Wiesemann
c672d321c2 Removed unused internal function.
Found by Cppcheck.
2013-07-14 14:32:26 +02:00
Philipp Wiesemann
8f0765a932 Fixed compiler warnings in test program by using wrapped functions. 2013-07-14 13:33:54 +02:00
Philipp Wiesemann
642825d6f6 Fixed compiler warnings in test programs by adding return statements. 2013-07-14 13:30:26 +02:00
Philipp Wiesemann
27e8a1013d Fixed compiler warnings in test programs by adding includes directives. 2013-07-14 13:27:19 +02:00
Ryan C. Gordon
7a76c4f7f7 Changed some for-loops to be a bit more clear. 2013-07-13 21:56:31 -04:00
Ryan C. Gordon
6061eacb9c Don't copy structs to stack in cmpmodes(), use const pointers instead.
(and return 0 immediately if the pointers are the same.)
2013-07-13 21:50:40 -04:00
Ryan C. Gordon
cb36800d33 Don't use SDL_memcmp() on modes to check if they've already been added.
They might have different driverdata values and thus not match.

Fixes Bugzilla #1407.
2013-07-13 21:42:57 -04:00
Ryan C. Gordon
02f1966126 Explicitly check for Xext.h in the CMake project, fail if missing.
Added to match configure script change in hg changeset 8f118396264b.
2013-07-13 20:24:09 -04:00
Philipp Wiesemann
843aed5449 Fixed compiler warnings in test programs. 2013-07-13 21:13:09 +02:00
Philipp Wiesemann
72b5424518 Added missing fclose() in test program.
Found by Cppcheck.
2013-07-13 21:06:56 +02:00
Philipp Wiesemann
80d2811c3f Removed unused variable and not needed assignment in test program.
Found by Cppcheck.
2013-07-13 21:05:13 +02:00
Philipp Wiesemann
2b52b168c3 Fixed printf() usage in test program.
Found by Cppcheck.
2013-07-13 21:02:23 +02:00
Sam Lantinga
2eb2901197 Added a configure check for Xext.h 2013-07-13 10:41:57 -07:00
Sam Lantinga
8f2f5f59d2 Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION
Added an API to watch hint changes: SDL_AddHintCallback(), SDL_DelHintCallback()
You can now dynamically set the joystick background event hint.
2013-07-13 03:13:41 -07:00
David Gow
124aecc92c Only get desktop modes from Xinerama if we can't use XRandR (fix #1956) 2013-07-13 11:06:34 +08:00
Sam Lantinga
4aae6e7d86 Fixed bug 1938 - Buffer overflows in the Windows IME code
norfanin

There are a few potential buffer overflows in the Windows IME code located in the SDL_windowskeyboard.c file. [1] They mainly happen because the code passes the number of bytes instead of the number of characters to the wide-character string functions wcslcpy and wcslcat. In another place, the code assumes that the composition cursor position can never go beyond the size of the composition string buffer.

Some of these overflows and overruns can occur with the Japanese IME on Vista and simplified Chinese IME on XP. I don't actually speak those languages and it's my first time using the IMEs, so I probably pushed them to the limit where nobody would still be compositing proper words. They don't cause any immediate access violation, although the possibility of trashing the SDL_VideoData structure is never good.

I've attached a patch that fixes those I found, but because I'm very new to the code it may be worthwhile if someone else also has a look over the code.

I'll go over the changes in my patch and explain what, why and how.

In the function IME_GetReadingString, there is a wcslcpy to copy the reading string from the IMC memory to the SDL reading string buffer. [2] This assumes that the length of the reading string never exceeds the SDL buffer size. I guess that is possible and I wasn't able to get a long reading string in my tests, but the patch adds a simple check anyway.

In the function IME_GetCompositionString, the first line calls ImmGetCompositionStringW to get the composition string. [3] The Microsoft documentation states that the fourth argument is for the destination buffer size in bytes (even with unicode) and the code correctly passes the value of sizeof. However, at the end of IME_GetCompositionString, the string is terminated by setting the element at index 'length' to 0. 'length' is calculated by dividing the number of bytes (those written by ImmGetCompositionStringW) by 2. If it managed to write 64 bytes, the code sets element 32 to 0, which would be the beginning of the reading string if the alignment places it there. My patch adds a subtraction to the fourth argument, essentially making it always pass 62 instead.

In the same function, the code assumes that the composition cursor position doesn't go beyond the buffer size. [4] My patch adds a simple range check in front of the indirection.

In the function IME_SendEditingEvent, the size for the wide-character string functions is passed in bytes instead of characters. [5] Oddly, the current code subtracts 'len' from the size in one function call. This results in truncation in certain situations as the third argument is the number of characters available in the destination buffer. If I'm understanding it correctly, this is supposed to copy x characters of the composition buffer, then concatenate the whole reading string buffer, and then the rest of the composition buffer (where x is the composition cursor position). I don't see how a truncation of the rest would be helpful here. Perhaps this is just an error? My patch removes the subtraction.

In the function UIElementSink_UpdateUIElement, bytes instead of characters is used again for a wcslcpy call. [6]
2013-07-12 23:45:12 -07:00
Sam Lantinga
afeb38f404 Don't set the current OpenGL window if the context creation fails. 2013-07-12 23:28:34 -07:00
Sam Lantinga
6d20034027 Updated supported iOS version. 2013-07-12 23:16:11 -07:00
Ryan C. Gordon
eae760a8ed CMake project should install sdl2.m4.
Fixes Bugzilla #1809.
2013-07-13 00:10:25 -04:00
Ryan C. Gordon
398dc15e51 CMake project should enable pthreads for Mac OS X by default. 2013-07-13 00:07:34 -04:00
Ryan C. Gordon
1d2330e56c Fixed iOS context sharing again.
I suck at Objective-C.
2013-07-12 23:38:44 -04:00
Ryan C. Gordon
ad5ab01ee3 Patched to compile. 2013-07-12 23:32:54 -04:00
Ryan C. Gordon
394b84163f Implement SDL_GL_SHARE_WITH_CURRENT_CONTEXT for iOS.
Fixes Bugzilla #1947.
2013-07-12 23:30:26 -04:00
Sam Lantinga
2ea8002cec 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
f1c05e8f1b Oops, that was supposed to be in the Linux section. 2013-07-12 08:21:28 -07:00
Sam Lantinga
c0d6bf12b0 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
824e95758a Don't crash if the current render target is destroyed. 2013-07-12 00:43:16 -07:00
Dimitris Zenios
9637ceba41 Fixed gcc warnings for apps using SDL headers with -Wstrict-prototypes flag. 2013-07-12 09:55:58 +03:00
Sam Lantinga
b831828d7a Fixed name of the Logitech F710 controller 2013-07-11 23:21:09 -07:00
Sam Lantinga
777f618789 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
88d269ecd7 Fixed Azamat's patch for SIZEOF_VOIDP in SDL_config.h.in 2013-07-11 23:16:47 -07:00
Azamat H. Hackimov
214b051e50 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
603b10c38f Fixed cast of the OpenGL context type 2013-07-11 23:05:02 -07:00
Sam Lantinga
2172f538cc 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
81d61485aa Fixed off-by-one error in SDL_ConvertStereo().
Fixes Bugzilla #561.
2013-07-12 01:26:43 -04:00