diff options
Diffstat (limited to 'Source/3rdParty/SDL2/src/main')
-rw-r--r-- | Source/3rdParty/SDL2/src/main/haiku/SDL_BApp.h | 10 | ||||
-rw-r--r-- | Source/3rdParty/SDL2/src/main/haiku/SDL_BeApp.cc | 50 | ||||
-rw-r--r-- | Source/3rdParty/SDL2/src/main/windows/SDL_windows_main.c | 82 | ||||
-rw-r--r-- | Source/3rdParty/SDL2/src/main/windows/version.rc | 8 |
4 files changed, 76 insertions, 74 deletions
diff --git a/Source/3rdParty/SDL2/src/main/haiku/SDL_BApp.h b/Source/3rdParty/SDL2/src/main/haiku/SDL_BApp.h index ba3f927..7adbd00 100644 --- a/Source/3rdParty/SDL2/src/main/haiku/SDL_BApp.h +++ b/Source/3rdParty/SDL2/src/main/haiku/SDL_BApp.h @@ -198,7 +198,7 @@ public: _current_context->UnlockGL(); _current_context = newContext; if (_current_context) - _current_context->LockGL(); + _current_context->LockGL(); } #endif @@ -231,7 +231,7 @@ private: SDL_SendMouseMotion(win, 0, 0, x, y); /* Tell the application that the mouse passed over, redraw needed */ - BE_UpdateWindowFramebuffer(NULL,win,NULL,-1); + HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1); } void _HandleMouseButton(BMessage *msg) { @@ -274,11 +274,11 @@ private: } /* Make sure this isn't a repeated event (key pressed and held) */ - if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) { + if(state == SDL_PRESSED && HAIKU_GetKeyState(scancode) == SDL_PRESSED) { return; } - BE_SetKeyState(scancode, state); - SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode)); + HAIKU_SetKeyState(scancode, state); + SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode)); if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { const int8 *keyUtf8; diff --git a/Source/3rdParty/SDL2/src/main/haiku/SDL_BeApp.cc b/Source/3rdParty/SDL2/src/main/haiku/SDL_BeApp.cc index f4ee179..cbd2129 100644 --- a/Source/3rdParty/SDL2/src/main/haiku/SDL_BeApp.cc +++ b/Source/3rdParty/SDL2/src/main/haiku/SDL_BeApp.cc @@ -31,7 +31,7 @@ #include <storage/File.h> #include <unistd.h> -#include "SDL_BApp.h" /* SDL_BApp class definition */ +#include "SDL_BApp.h" /* SDL_BApp class definition */ #include "SDL_BeApp.h" #include "SDL_timer.h" #include "SDL_error.h" @@ -53,24 +53,24 @@ StartBeApp(void *unused) { BApplication *App; - // default application signature - const char *signature = "application/x-SDL-executable"; - // dig resources for correct signature - image_info info; - int32 cookie = 0; - if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { - BFile f(info.name, O_RDONLY); - if (f.InitCheck() == B_OK) { - BAppFileInfo app_info(&f); - if (app_info.InitCheck() == B_OK) { - char sig[B_MIME_TYPE_LENGTH]; - if (app_info.GetSignature(sig) == B_OK) - signature = strndup(sig, B_MIME_TYPE_LENGTH); - } - } - } - - App = new SDL_BApp(signature); + // default application signature + const char *signature = "application/x-SDL-executable"; + // dig resources for correct signature + image_info info; + int32 cookie = 0; + if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + BFile f(info.name, O_RDONLY); + if (f.InitCheck() == B_OK) { + BAppFileInfo app_info(&f); + if (app_info.InitCheck() == B_OK) { + char sig[B_MIME_TYPE_LENGTH]; + if (app_info.GetSignature(sig) == B_OK) + signature = strndup(sig, B_MIME_TYPE_LENGTH); + } + } + } + + App = new SDL_BApp(signature); App->Run(); delete App; @@ -144,12 +144,12 @@ SDL_QuitBeApp(void) /* SDL_BApp functions */ void SDL_BApp::ClearID(SDL_BWin *bwin) { - _SetSDLWindow(NULL, bwin->GetID()); - int32 i = _GetNumWindowSlots() - 1; - while(i >= 0 && GetSDLWindow(i) == NULL) { - _PopBackWindow(); - --i; - } + _SetSDLWindow(NULL, bwin->GetID()); + int32 i = _GetNumWindowSlots() - 1; + while(i >= 0 && GetSDLWindow(i) == NULL) { + _PopBackWindow(); + --i; + } } #endif /* __HAIKU__ */ diff --git a/Source/3rdParty/SDL2/src/main/windows/SDL_windows_main.c b/Source/3rdParty/SDL2/src/main/windows/SDL_windows_main.c index 5e643a4..32f6727 100644 --- a/Source/3rdParty/SDL2/src/main/windows/SDL_windows_main.c +++ b/Source/3rdParty/SDL2/src/main/windows/SDL_windows_main.c @@ -116,50 +116,66 @@ OutOfMemory(void) # endif #endif -/* WinMain, main, and wmain eventually call into here. */ -static int -main_utf8(int argc, char *argv[]) -{ - SDL_SetMainReady(); - - /* Run the application main() code */ - return SDL_main(argc, argv); -} - /* Gets the arguments with GetCommandLine, converts them to argc and argv - and calls main_utf8 */ + and calls SDL_main */ static int main_getcmdline() { char **argv; int argc; - char *cmdline; + char *cmdline = NULL; int retval = 0; + int cmdalloc = 0; + const TCHAR *text = GetCommandLine(); + const TCHAR *ptr; + int argc_guess = 2; /* space for NULL and initial argument. */ + int rc; + + /* make a rough guess of command line arguments. Overestimates if there + are quoted things. */ + for (ptr = text; *ptr; ptr++) { + if ((*ptr == ' ') || (*ptr == '\t')) { + argc_guess++; + } + } - /* Grab the command line */ - TCHAR *text = GetCommandLine(); #if UNICODE - cmdline = WIN_StringToUTF8(text); + rc = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL); + if (rc > 0) { + cmdalloc = rc + (sizeof (char *) * argc_guess); + argv = (char **) VirtualAlloc(NULL, cmdalloc, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + if (argv) { + int rc2; + cmdline = (char *) (argv + argc_guess); + rc2 = WideCharToMultiByte(CP_UTF8, 0, text, -1, cmdline, rc, NULL, NULL); + SDL_assert(rc2 == rc); + } + } #else /* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */ - cmdline = SDL_strdup(text); + rc = ((int) SDL_strlen(text)) + 1; + cmdalloc = rc + (sizeof (char *) * argc_guess); + argv = (char **) VirtualAlloc(NULL, cmdalloc, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + if (argv) { + cmdline = (char *) (argv + argc_guess); + SDL_strcpy(cmdline, text); + } #endif if (cmdline == NULL) { return OutOfMemory(); } /* Parse it into argv and argc */ - argc = ParseCommandLine(cmdline, NULL); - argv = SDL_stack_alloc(char *, argc + 1); - if (argv == NULL) { - return OutOfMemory(); - } - ParseCommandLine(cmdline, argv); + SDL_assert(ParseCommandLine(cmdline, NULL) <= argc_guess); + argc = ParseCommandLine(cmdline, argv); - retval = main_utf8(argc, argv); + SDL_SetMainReady(); - SDL_stack_free(argv); - SDL_free(cmdline); + /* Run the application main() code */ + retval = SDL_main(argc, argv); + + VirtualFree(argv, cmdalloc, MEM_DECOMMIT); + VirtualFree(argv, 0, MEM_RELEASE); return retval; } @@ -177,21 +193,7 @@ console_ansi_main(int argc, char *argv[]) int console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp) { - int retval = 0; - char **argv = SDL_stack_alloc(char*, argc + 1); - int i; - - for (i = 0; i < argc; ++i) { - argv[i] = WIN_StringToUTF8(wargv[i]); - } - argv[argc] = NULL; - - retval = main_utf8(argc, argv); - - /* !!! FIXME: we are leaking all the elements of argv we allocated. */ - SDL_stack_free(argv); - - return retval; + return main_getcmdline(); } #endif diff --git a/Source/3rdParty/SDL2/src/main/windows/version.rc b/Source/3rdParty/SDL2/src/main/windows/version.rc index 6d16ad5..8eb8c8a 100644 --- a/Source/3rdParty/SDL2/src/main/windows/version.rc +++ b/Source/3rdParty/SDL2/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,8,0 - PRODUCTVERSION 2,0,8,0 + FILEVERSION 2,0,9,0 + PRODUCTVERSION 2,0,9,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 8, 0\0" + VALUE "FileVersion", "2, 0, 9, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright 2018 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 8, 0\0" + VALUE "ProductVersion", "2, 0, 9, 0\0" END END BLOCK "VarFileInfo" |