Skip to content
Permalink
Browse files

gui: alt+enter - toggle fullscreen

  • Loading branch information
JaCzekanski committed Aug 26, 2019
1 parent 55dc032 commit 74e34b99f883055e320acc172024fae858597971
Showing with 13 additions and 0 deletions.
  1. +4 −0 src/platform/windows/input/sdl_input_manager.cpp
  2. +8 −0 src/platform/windows/main.cpp
  3. +1 −0 src/utils/event.h
@@ -120,6 +120,10 @@ bool SdlInputManager::handleEvent(SDL_Event& event) {
}
break;
}
if ((event.key.keysym.mod & KMOD_ALT) && event.key.keysym.sym == SDLK_RETURN) {
bus.notify(Event::Gui::ToggleFullscreen{});
return true;
}
}

if ((!keyboardCaptured || waitingForKeyPress) && (type == SDL_KEYDOWN || type == SDL_KEYUP)) {
@@ -299,6 +299,14 @@ int main(int argc, char** argv) {
bool doHardReset = false;
bus.listen<Event::System::HardReset>(busToken, [&](auto) { doHardReset = true; });

bus.listen<Event::Gui::ToggleFullscreen>(busToken, [&](auto) {
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_DESKTOP) {
SDL_SetWindowFullscreen(window, 0);
} else {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
}
});

// If argument given - open that file (same as drag and drop)
if (argc > 1) {
loadFile(sys, argv[1]);
@@ -28,6 +28,7 @@ namespace Gui {
struct Toast {
std::string message;
};
struct ToggleFullscreen {};
} // namespace Gui
}; // namespace Event

0 comments on commit 74e34b9

Please sign in to comment.
You can’t perform that action at this time.