From f5d9ddb6fe63b3601532d9ba1bce2963815f0dbb Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 3 Feb 2021 08:14:34 +0200 Subject: Added keybinding (F11) for toggling fullscreen mode IssueID #130 --- src/app.c | 7 +++++++ src/ui/keys.c | 3 +++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/app.c b/src/app.c index a2d80bf2..6f50ca7b 100644 --- a/src/app.c +++ b/src/app.c @@ -1078,6 +1078,13 @@ iBool handleCommand_App(const char *cmd) { SDL_MaximizeWindow(d->window->win); return iTrue; } + else if (equal_Command(cmd, "window.fullscreen")) { + SDL_SetWindowFullscreen(d->window->win, + SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_FULLSCREEN_DESKTOP + ? 0 + : SDL_WINDOW_FULLSCREEN_DESKTOP); + return iTrue; + } else if (equal_Command(cmd, "font.set")) { setFreezeDraw_Window(get_Window(), iTrue); d->prefs.font = arg_Command(cmd); diff --git a/src/ui/keys.c b/src/ui/keys.c index 656a52ac..0f4a19f7 100644 --- a/src/ui/keys.c +++ b/src/ui/keys.c @@ -84,6 +84,9 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] = { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 }, { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 }, { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 }, +#if !defined (iPlatformApple) /* Ctrl-Cmd-F on macOS */ + { 73, { "Toggle fullscreen mode", SDLK_F11, 0, "window.fullscreen" }, 0 }, +#endif { 76, { "New tab", newTab_KeyShortcut, "tabs.new" }, 0 }, { 77, { "Close tab", closeTab_KeyShortcut, "tabs.close" }, 0 }, { 80, { "Previous tab", prevTab_KeyShortcut, "tabs.prev" }, 0 }, -- cgit v1.2.3