ref: 34ba8008e57bbdc58349c087f8cea249cf8ade36
parent: d7a68c165d5139497523a67559c0e1f4df9efd50
author: Jonathan Dowland <[email protected]>
date: Fri Apr 8 19:59:52 EDT 2016
vary fullscreen keyboard shortcut by platform On Windows, the common idiom for fullscreen mode in applications is alt+enter. On Mac, there is less consensus but it seems to be often command+enter (see e.g. iTerm). I'm not sure there's any consensus on other platforms. Use alt+enter by default for all platforms but additionally support command+enter on Mac OS X.
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -318,6 +318,15 @@
}
}
+static boolean ToggleFullScreenKeyShortcut(SDL_Keysym *sym)
+{
+ Uint16 flags = (KMOD_LALT | KMOD_RALT);
+#if defined(__MACOSX__)
+ flags |= (KMOD_LGUI | KMOD_RGUI);
+#endif
+ return (sym->scancode == SDL_SCANCODE_RETURN && sym->mod & flags);
+}
+
static void I_ToggleFullScreen(void)
{
Uint32 flags = SDL_GetWindowFlags(screen) & SDL_WINDOW_FULLSCREEN_DESKTOP;
@@ -337,8 +346,7 @@
switch (sdlevent.type)
{
case SDL_KEYDOWN:
- if (sdlevent.key.keysym.scancode == SDL_SCANCODE_RETURN &&
- sdlevent.key.keysym.mod & (KMOD_LGUI | KMOD_RGUI))
+ if (ToggleFullScreenKeyShortcut(&sdlevent.key.keysym))
{
I_ToggleFullScreen();
break;