Commit graph

6036 commits

Author SHA1 Message Date
Ryan C. Gordon
5256d2e392 Made PND_setwindowgrab() a no-op. It was a cut/paste of PND_destroywindow().
This looks like the rest of the code doesn't deal with windows, and probably
 just deals with a single fullscreen GLES context, like a console would, so
 making setwindowgrab a no-op makes sense in this case; it's already "grabbed."

Fixes Bugzilla #1850.

--HG--
extra : rebase_source : 29b07b9c8378f69fb8b5f201584befd8d7f005dd
2013-07-15 20:30:04 -04:00
Philipp Wiesemann
74e1355637 Changed strdup() to SDL_strdup(). 2013-07-15 23:00:47 +02:00
Jørgen P. Tjernø
074edba0c1 Mac: Bring back FS windows when appropriate
This automatically restores FS windows when the application is made
active (Cmd-Tab, you click the Dock icon, or you launch the .app again).
2013-07-15 11:58:49 -07:00
Jørgen P. Tjernø
7aa0cf9eaa Mac: CGMakePoint -> CGPointMake in previous change. 2013-07-15 11:58:45 -07:00
Jørgen P. Tjernø
2bfb402659 Mac: Fix SDL_WarpMouseInWindow in fullscreen.
If you switched from a window to fullscreen, your SDL_WarpMouseInWindow
calls would be offset by the x and y coordinates of the original window.
2013-07-15 11:57:18 -07:00
Ryan C. Gordon
5772df05d2 Turn the system mouse cursor back on before VideoQuit().
This is good policy, so it doesn't have a chance to leave it hidden on targets
 that wouldn't necessarily reset it by default, but it also fixes a crash if
 you try to use a message box after SDL_Quit() is called.

Fixes Bugzilla #1969.
2013-07-15 14:38:19 -04:00
Ryan C. Gordon
52b4a55049 Minor indentation clean up. 2013-07-15 01:12:15 -04:00
Ryan C. Gordon
8f4fb24e2d Make winmm and directsound audio targets robust against unsupported formats.
It now tries to make sure the hardware can support a given format, and if it
 can't, it carries on to the next best format instead of failing completely.

--HG--
extra : rebase_source : 7b4e61c8030d1e1ce4c926bc0abc9b4d4af11dd9
2013-07-14 21:30:16 -04:00
Jørgen P. Tjernø
901d874a2b 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ø
e5ffe6b633 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
87baf66d18 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
7bc74ebaa4 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
26c456e4ff Added testing of messagebox with a parent window 2013-07-14 11:57:45 -07:00
Sam Lantinga
c43e19485b Fixed code example for SDL_GetWindowWMInfo() 2013-07-14 11:57:01 -07:00
Sam Lantinga
3d97a0a1bb Removed obsolete assertion code 2013-07-14 11:43:25 -07:00
Sam Lantinga
284b7113ad 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
73cb183fdb 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
991e2fb26c Fixed compiler warnings in test program by using wrapped functions. 2013-07-14 19:56:22 +02:00
Philipp Wiesemann
1603534707 Changed use of isspace() to SDL_isspace(). 2013-07-14 19:53:50 +02:00
Ryan C. Gordon
c944a4fdf9 Implement float32 support for winmm and directsound targets (Thanks, John!).
Fixes Bugzilla #1657.
2013-07-14 13:27:54 -04:00
Ryan C. Gordon
4e5bd8491f Fixed compiler warning in testtimer.c 2013-07-14 13:25:49 -04:00
Ryan C. Gordon
37bb3c5354 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
e5c1f21fae 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
a05aecab3b Removed unused internal function.
Found by Cppcheck.
2013-07-14 14:32:26 +02:00
Philipp Wiesemann
4405163127 Fixed compiler warnings in test program by using wrapped functions. 2013-07-14 13:33:54 +02:00
Philipp Wiesemann
5aeed40282 Fixed compiler warnings in test programs by adding return statements. 2013-07-14 13:30:26 +02:00
Philipp Wiesemann
7ca8149a59 Fixed compiler warnings in test programs by adding includes directives. 2013-07-14 13:27:19 +02:00
Ryan C. Gordon
dbb91faaf9 Changed some for-loops to be a bit more clear. 2013-07-13 21:56:31 -04:00
Ryan C. Gordon
3137c0fc68 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
0df5b7f912 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
7f4744bf03 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
59401ae635 Fixed compiler warnings in test programs. 2013-07-13 21:13:09 +02:00
Philipp Wiesemann
f158b5f47e Added missing fclose() in test program.
Found by Cppcheck.
2013-07-13 21:06:56 +02:00
Philipp Wiesemann
884898cbfc Removed unused variable and not needed assignment in test program.
Found by Cppcheck.
2013-07-13 21:05:13 +02:00
Philipp Wiesemann
396bc93955 Fixed printf() usage in test program.
Found by Cppcheck.
2013-07-13 21:02:23 +02:00
Sam Lantinga
0eb5308b0f Added a configure check for Xext.h 2013-07-13 10:41:57 -07:00
Sam Lantinga
6956070880 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
9102ff84ca Only get desktop modes from Xinerama if we can't use XRandR (fix #1956) 2013-07-13 11:06:34 +08:00
Sam Lantinga
228bafa134 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
2468df6e5a Don't set the current OpenGL window if the context creation fails. 2013-07-12 23:28:34 -07:00
Sam Lantinga
7b620e00ac Updated supported iOS version. 2013-07-12 23:16:11 -07:00
Ryan C. Gordon
7b6a381369 CMake project should install sdl2.m4.
Fixes Bugzilla #1809.
2013-07-13 00:10:25 -04:00
Ryan C. Gordon
b2849474ac CMake project should enable pthreads for Mac OS X by default. 2013-07-13 00:07:34 -04:00
Ryan C. Gordon
f8be9c4907 Fixed iOS context sharing again.
I suck at Objective-C.
2013-07-12 23:38:44 -04:00
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