From c6c4eea94ba3e533578fbd36f005401ebd456df5 Mon Sep 17 00:00:00 2001 From: Christopher Mosher Date: Sat, 12 Jan 2019 23:30:34 -0500 Subject: [PATCH] exit full screen before dialogs --- src/configep2.cpp | 1 + src/emulator.cpp | 1 + src/screenimage.cpp | 6 ++++++ src/screenimage.h | 1 + 4 files changed, 9 insertions(+) diff --git a/src/configep2.cpp b/src/configep2.cpp index 0329683..17b8f89 100644 --- a/src/configep2.cpp +++ b/src/configep2.cpp @@ -270,6 +270,7 @@ void Config::tryParseLine(const std::string& line, Memory& ram, Memory& rom, Slo std::getline(tok,fn_optional); trim(fn_optional); if (fn_optional.length() == 0) { + gui.exitFullScreen(); char const *ft[1] = { "*.woz" }; char const *fn = tinyfd_openFileDialog("Load floppy", "", 1, ft, "WOZ 2.0 disk images", 0); if (fn) { diff --git a/src/emulator.cpp b/src/emulator.cpp index f4de24f..d3cb83e 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -368,6 +368,7 @@ void Emulator::dispatchKeypress(const SDL_KeyboardEvent& keyEvent) { return; }// ...else exit the entire emulation else if (sym == SDLK_F9) { + this->screenImage.exitFullScreen(); if (isSafeToQuit()) { this->quit = true; } diff --git a/src/screenimage.cpp b/src/screenimage.cpp index 31267ec..492225f 100644 --- a/src/screenimage.cpp +++ b/src/screenimage.cpp @@ -63,6 +63,12 @@ cassettename(32, ' ') { createScreen(); } +void ScreenImage::exitFullScreen() { + if (this->fullscreen) { + toggleFullScreen(); + } +} + void ScreenImage::toggleFullScreen() { this->fullscreen = !this->fullscreen; const int flags = this->fullscreen ? SDL_WINDOW_FULLSCREEN : 0; diff --git a/src/screenimage.h b/src/screenimage.h index b7828e8..de88ddd 100644 --- a/src/screenimage.h +++ b/src/screenimage.h @@ -51,6 +51,7 @@ public: ScreenImage(); ~ScreenImage(); + void exitFullScreen(); void toggleFullScreen(); void drawPower(bool on); void notifyObservers();