Commit Graph

61 Commits

Author SHA1 Message Date
Steven Noonan
f1ad942a11 SDL_windows_main: use HeapAlloc/HeapFree for command line arguments
If a developer uses SDL_SetMemoryFunctions, we can't rely on SDL_free()
working when SDL_main() returns.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 17:26:13 -07:00
Ozkan Sezer
8cb421b26d SDL_windows_main.c: use new WIN_StringToUTF8W macro 2021-01-04 10:20:10 +03:00
Sam Lantinga
9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga
350f1b0d16 Updated SDL to version 2.0.15 for development 2020-12-22 10:36:15 -08:00
Sam Lantinga
a2098a47b6 Updated SDL to 2.0.14 in preparation for release candidate 2020-12-08 18:56:06 -08:00
Ryan C. Gordon
940419b0a6 uikit: Fixed a typo in a comment. 2020-11-10 13:09:59 -05:00
Ryan C. Gordon
fa23e3d00b locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.

Fixes Bugzilla #2131.
2020-05-04 02:27:29 -04:00
Sam Lantinga
93ed3c8baf Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga
983bbf9ef3 Backed out changeset 51622f74dc85 2020-03-10 18:35:31 -07:00
Sam Lantinga
4fb06a2a38 Updated SDL to version 2.0.13 for development builds 2020-03-10 18:25:47 -07:00
Sam Lantinga
74ed215618 Updated version to 2.0.12 for release candidate build 2020-03-01 14:58:16 -08:00
Sam Lantinga
a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Peter Kosyh
33ae5e5e99 haiku: mouse_relative fix
Partially fixes Bugzilla #4442.
2019-11-11 22:23:33 -05:00
Peter Kosyh
79510b7569 haiku: mouse->ShowMouse method added
Partially fixes Bugzilla #4442.
2019-11-11 22:22:40 -05:00
Gerasim Troeglazov
95a402d745 haiku: Add support for relative mouse mode.
Partially fixes Bugzilla #4442.
2019-11-11 22:21:17 -05:00
Gerasim Troeglazov
bd648bd5a3 haiku: Add simple relative mode for mouse.
Partially fixes Bugzilla #4442.
2019-11-11 22:18:21 -05:00
Peter Kosyh
55b5d8dce6 haiku: Invert mouse wheel values to match what SDL expects.
Partially fixes Bugzilla #4442.
2019-11-11 21:59:39 -05:00
EXL
b22fb9e2ba haiku: Implement message box for Haiku
Add implementation for functions:

SDL_ShowSimpleMessageBox()
SDL_ShowMessageBox()

Add simple customization support also.
Fix build for x86_gcc2.

Partially fixes Bugzilla #4442.
2019-11-11 16:44:40 -05:00
Sam Lantinga
3fe2d8368c Updated SDL development builds to version 2.0.11 2019-09-22 10:37:16 -07:00
Ozkan Sezer
1b7fc81e3f minor whitespace tidy-up. 2019-07-31 19:40:50 +03:00
Sam Lantinga
f8400cbba9 Fixed bug 4692 - Command line parsing
Galadrim

As I have seen, SDL implements its own command line parser for Windows in SDL_windows_main.c. Unfortunately, it doesn't seem to allow command line arguments with trailing backslashes if quoting is required.

Usually, when you write an application that gets command line arguments passed as argc and argv, the parsing is done by parse_cmdline. The Windows API also provides the function CommandLineToArgvW, so an application can parse itself if only the command line string is provided. Both functions behave almost identically according to their documentation. If the argument "\\" (including the quotes) is passed, they both turn it into a single backslash.

The SDL command line parser on the other hand doesn't recognize the second quote character as the closing character in this example and therefore includes it in the parsed argument. The parser does not count the number of backslashes preceding a quote. It always treats a quote as escaped if a backslash is in front of it. Therefore, it should be impossible to quote and escape an argument correctly, if it has a trailing backslash and contains characters that require quoting.

Of course, each application is allowed to implement its own parsing rules, so SDL is free to do so. But the problem I see is that there are arguments, that are impossible to be passed to the parser correctly, as I described above. Is there a reason, why SDL does not simply use CommandLineToArgvW instead of implementing its own parser?

Here are some links that show that correct argument parsing, as it is usually done in Windows, is quite complicated:

https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-commandlinetoargvw

http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
2019-07-31 09:11:20 -07:00
Ozkan Sezer
4953e050f5 use SDL_zeroa at more places where the argument is an array. 2019-07-31 05:11:40 +03:00
Sam Lantinga
67c67f3a6b Updated version to 2.0.10 2019-06-17 10:13:28 -07:00
Sam Lantinga
de82759c84 Added support for building SDL as a dynamic library on iOS 2019-03-19 07:53:33 -07:00
Sam Lantinga
5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon
e542d1a36d winmain: Patched to compile on C89 compilers. 2018-10-29 20:18:50 -04:00
Ryan C. Gordon
f434a98c26 winmain: Don't use SDL_malloc (or SDL_stack_alloc, which might be malloc).
Otherwise, we are using the allocator before the app can set up its own hooks.

Now we use VirtualAlloc, and WideCharToMultiByte (because SDL_iconv uses
SDL_malloc, too!) to get ready to call into SDL_main.

This also makes console_wmain() call into the same routines as everything
else, so we don't have to deal with those allocations, too. Hopefully we
end up with the same results from GetCommandLine() as we do in wargv.

Fixes Bugzilla #4340.
2018-10-29 20:00:03 -04:00
Sam Lantinga
bc6c199790 Updated version to 2.0.9 2018-09-26 10:08:14 -07:00
Sam Lantinga
5febdfcece Fixed whitespace 2018-09-24 11:49:25 -07:00
Ryan C. Gordon
941c5b4760 haiku: Rename internal functions from BE_* to HAIKU_*
Fixes Bugzilla #2349.
2018-08-07 18:07:11 -04:00
Sam Lantinga
1143857d76 Fixed bug 4073 - Unquoted Unicode argument parsing broken on Windows due to incorrect usage of SDL_isspace() 2018-02-10 12:43:11 -08:00
Sam Lantinga
e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
2c5724ef5d Updated version to 2.0.8 since SDL_image depends on it 2017-11-04 21:58:48 -07:00
David Ludwig
0e032d5860 WinRT: Move Windows::Foundation::Initialize to SDL2.dll, from SDL_main.
This allows C# UWP applications to use SDL2's SDL_WinRTRunApp function.

Kudos to Ethan Lee (flibitijibibo@flibitijibibo.com) for the patch.  Thanks!
2017-10-24 13:21:11 -04:00
Sam Lantinga
0ce23a5498 Updated version to 2.0.7 2017-10-12 08:08:04 -07:00
Sam Lantinga
dbb0a2aa74 Removed the need for libSDL2main.a on Android, and separated JNI initialization out for other integrations 2017-08-28 14:34:15 -07:00
Sam Lantinga
2dc5d32fab Updated version to 2.0.6 2017-08-18 18:16:37 -07:00
Sam Lantinga
df2d299447 Fixed bug 2812 - Make libSDL2main.a usable on Android via a dummy symbol
Jonas Kulla

This eliminates the need to manually compile in SDL_main_android.c.
Instead, add "-lSDL2main -Wl,-u,SDL_main_dummy" when linking.

I don't know how the nkd-build process works, but unless it was
for some reason linking libSDL2main.a it should be unaffected.
2017-08-13 18:12:06 -07:00
Philipp Wiesemann
c3bf69ca4b haiku: Fixed compiling without OpenGL support. 2017-07-07 23:00:22 +02:00
Olli Kallioinen
11289b766f Android cmake build fixed to work with the official android gradle plugin 2017-06-04 21:25:57 +03:00
Philipp Wiesemann
4b47fa38c3 Removed duplicate includes. 2017-06-04 23:15:47 +02:00
Philipp Wiesemann
07b0df0a22 haiku: Changed internal variable to be static. 2017-06-02 22:15:37 +02:00
Ryan C. Gordon
619ab7a22d haiku: Various fixes from haikuports.
Based on patch here:

https://github.com/haikuports/haikuports/blob/master/media-libs/libsdl2/patches/libsdl2-2.0.5.patchset
2017-05-01 18:39:05 -04:00
Philipp Wiesemann
63e83a3127 Haiku: Removed unused variable.
Found by Cppcheck.
2017-01-21 22:01:17 +01:00
Sam Lantinga
45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
8a73f7e893 Fixed bug 3461 - Implement TEXTINPUT events for Haiku
Kai Sterker

Apparently, SDL2 on Haiku does not generate SDL_TEXTINPUT events.
Attached is a patch that adds this functionality.

Tested with SDLs own checkkeys program and different keymaps as well as my own SDL application and German keyboard layout to verify it generates the expected input.
2016-10-19 20:42:22 -07:00
Sam Lantinga
8aab39cb7d Fixed bug 3452 - Getting unicode arguments for the main entry point on Windows
Simon Hug

There are currently three entry points in the SDL2_main code for windows: main, wmain and WinMain. Only the latter two properly convert the arguments to UTF-8.

Console applications linked with MSVC will always link with the main entry point (wmain has to be selected by manually setting the entry point). This makes it likely that such programs will not have proper unicode arguments.
2016-10-14 08:27:44 -07:00
Sam Lantinga
14e7da75b2 Backed out change 7d3df1df4e91 which was: Fixed bug 3320 - SDL_windows_main.c defines both console application entry points
With that change only the wmain() entry point was defined, and applications that linked with main() would no longer build.
2016-10-12 19:50:16 -07:00
Sam Lantinga
d870f2719b Fixed bug 3320 - SDL_windows_main.c defines both console application entry points
Simon Hug

The SDLmain file src/main/windows/SDL_windows_main.c defines both entry points for console applications, main and wmain. This seems to confuse MSVC. It outputs a LNK4067 warning and then chooses main, which is a shame because only wmain has the unicode handling. Using SDLmain.lib provided on libsdl.org, the linker also goes for main.

I'm proposing to not define the main entry point at all. wmain should be supported well enough with MSVC.
2016-10-01 12:31:31 -07:00
Sam Lantinga
708def87f3 Fixed bug 3338 - console_wmain doesn't null terminate the argv array
Simon Hug

The function console_wmain in src/main/windows/SDL_windows_main.c does not null terminate the argument list it is creating. As specified by the C standard, "argv[argc] shall be a null pointer."

The SDLTest framework makes use of that null pointer and some test programs can cause an access violation because it's missing.
2016-10-01 11:48:15 -07:00