1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00

Allow using F11 and (on macOS) RCmd+Enter/F to toggle fullscreen

This patch allows the use of pressing F11 to toggle fullscreen, as well as
allowing the use of Right Command when using the Command+Enter/F shortcut on
macOS. Apparently Alt+Enter isn't the only shortcut to toggle fullscreen,
Alt+F also works, which I didn't know before.

I'm adding F11 as a shortcut because it's a far more natural shortcut to
toggle fullscreen than this Alt+Enter or Alt+F business, which seems to be a
relic mimicking some other games and some Microsoft stuff?

I'm also adding RCommand+Enter/F because I see no reason not to. If you can
use RAlt on non-macOS, why can't you use RCommand on macOS, too?

I also cleaned up the formatting relating to the shortcut code, and made sure
the closing parenthesis was outside the ifdef so my text editor wouldn't
highlight the parenthesis inside the non-macOS ifdef-branch as a dangling
closing parenthesis, because it assumes the one in the branch above is the
actual closing parenthesis and doesn't parse macros.
This commit is contained in:
Misa 2020-03-12 16:00:18 -07:00 committed by Ethan Lee
parent 0e09f26451
commit e23682615d

View File

@ -81,14 +81,13 @@ void KeyPoll::Poll()
{
pressedbackspace = true;
}
else if ( ( evt.key.keysym.sym == SDLK_RETURN ||
evt.key.keysym.sym == SDLK_f ) &&
#ifdef __APPLE__ /* OSX prefers the command key over the alt keys. -flibit */
keymap[SDLK_LGUI] )
else if (((evt.key.keysym.sym == SDLK_RETURN || evt.key.keysym.sym == SDLK_f) &&
#ifdef __APPLE__ /* OSX prefers the command keys over the alt keys. -flibit */
(keymap[SDLK_LGUI] || keymap[SDLK_RGUI])
#else
( keymap[SDLK_LALT] ||
keymap[SDLK_RALT] ) )
(keymap[SDLK_LALT] || keymap[SDLK_RALT])
#endif
) || evt.key.keysym.sym == SDLK_F11)
{
toggleFullscreen = true;
}