X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=2efaac415be6bcf6fdc188de8a408bd63ad35fee;hb=5d346cad6a50bbd83d84721caae9235dff8132f0;hp=59df351e4574ceea0416e978c3e18ddb1757ef52;hpb=90366961d7188d661017383ab2f4718e4cbc89d3;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 59df351..2efaac4 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -504,6 +504,16 @@ static void sdlEventProc(const SDL_Event &e, Game &game) } } + #if (defined(__APPLE__) && defined(__MACH__)) + if (e.key.keysym.sym == SDLK_q) + { + if (e.key.keysym.mod & KMOD_META) + { + gDone=true; + } + } + #endif + else if (e.key.keysym.sym == SDLK_RETURN) { if (e.key.keysym.mod & KMOD_ALT) @@ -1442,6 +1452,19 @@ static inline void chdirToAppPath(const char *argv0) char *dir = calcBaseDir(argv0); if (dir) { + #if (defined(__APPLE__) && defined(__MACH__)) + // Chop off /Contents/MacOS if it's at the end of the string, so we + // land in the base of the app bundle. + const size_t len = strlen(dir); + const char *bundledirs = "/Contents/MacOS"; + const size_t bundledirslen = strlen(bundledirs); + if (len > bundledirslen) + { + char *ptr = (dir + len) - bundledirslen; + if (strcasecmp(ptr, bundledirs) == 0) + *ptr = '\0'; + } + #endif chdir(dir); free(dir); }