src/main/windows


Log

Author Commit Date CI Message
Sam Lantinga 983bbf9e 2020-03-10T18:35:31 Backed out changeset 51622f74dc85
Sam Lantinga 93ed3c8b 2020-03-10T18:25:47 Updated SDL to version 2.0.13 for development builds
Sam Lantinga 4fb06a2a 2020-03-10T18:25:47 Updated SDL to version 2.0.13 for development builds
Sam Lantinga 74ed2156 2020-03-01T14:58:16 Updated version to 2.0.12 for release candidate build
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 3fe2d836 2019-09-22T10:37:16 Updated SDL development builds to version 2.0.11
Ozkan Sezer 1b7fc81e 2019-07-31T19:40:50 minor whitespace tidy-up.
Sam Lantinga f8400cbb 2019-07-31T09:11:20 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/
Sam Lantinga 67c67f3a 2019-06-17T10:13:28 Updated version to 2.0.10
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon e542d1a3 2018-10-29T20:18:50 winmain: Patched to compile on C89 compilers.
Ryan C. Gordon f434a98c 2018-10-29T20:00:03 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.
Ryan C. Gordon b262b0eb 2018-10-22T20:50:32 Small stack allocations fall back to malloc if they're unexpectedly large.
Sam Lantinga bc6c1997 2018-09-26T10:08:14 Updated version to 2.0.9
Sam Lantinga 1143857d 2018-02-10T12:43:11 Fixed bug 4073 - Unquoted Unicode argument parsing broken on Windows due to incorrect usage of SDL_isspace()
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 2c5724ef 2017-11-04T21:58:48 Updated version to 2.0.8 since SDL_image depends on it
Sam Lantinga 0ce23a54 2017-10-12T08:08:04 Updated version to 2.0.7
Sam Lantinga 2dc5d32f 2017-08-18T18:16:37 Updated version to 2.0.6
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 8aab39cb 2016-10-14T08:27:44 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.
Sam Lantinga 14e7da75 2016-10-12T19:50:16 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.
Sam Lantinga d870f271 2016-10-01T12:31:31 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.
Sam Lantinga 708def87 2016-10-01T11:48:15 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.
Sam Lantinga e45698d2 2016-09-28T22:24:01 Updated version to 2.0.5 in preparation for release
Sam Lantinga 68a32728 2016-01-02T10:38:51 Fixed sed error on Mac OS X and updated copyright on a few last files
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Ryan C. Gordon 33b9d9ad 2015-02-19T21:51:13 Windows: Added a FIXME.
Ryan C. Gordon 674eb556 2015-02-19T21:50:40 Windows: Free the argv we allocated for console_wmain().
Ryan C. Gordon e974ccf8 2015-02-19T21:49:30 Windows: Added a FIXME.
Ryan C. Gordon f7c4c3d0 2015-02-19T21:49:15 Windows: Make a distinction between ANSI mainline and UTF-8 mainline.
Ryan C. Gordon e93ee5d7 2015-02-19T21:44:41 Windows: Support unicode arguments for console applications (thanks, Jorgen!). Fixes Bugzilla #2864.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Sam Lantinga 4dab32a2 2014-11-28T04:51:33 Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead Jonas Kulla src/main/windows/SDL_windows_main.c:137: cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR)); I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null. From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified. Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 7242e814 2014-09-02T06:55:47 Updated version to 2.0.4
Ryan C. Gordon 2230df55 2014-07-27T19:52:52 Remove dependency on C runtime from Windows SDLmain.
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga f9a58968 2014-03-13T21:21:26 Added missing copyright notices
Sam Lantinga c167d1f6 2014-03-09T10:38:30 Updated SDL to version 2.0.3
Sam Lantinga 853334af 2014-02-09T03:09:56 Updated SDL to version 2.0.2
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon d1bde399 2013-10-20T20:24:00 Backed out changeset 737771c47c6f, done testing Buildbot changes.
Ryan C. Gordon df368084 2013-10-20T20:02:02 Intentionally breaking Windows and Raspberry Pi builds to test Buildbot change.
Sam Lantinga 12ca3ce3 2013-10-17T23:02:29 Fixed building using MinGW Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
Sam Lantinga a7e1fddd 2013-10-10T21:50:25 Updated SDL to version 2.0.1
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.