diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 69fb4184a..bb2541cb1 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -25,6 +25,7 @@ #include "views/GamelistView.h" #include "views/ViewController.h" +#include #include #include @@ -537,9 +538,14 @@ bool SystemData::loadConfig() unsigned int lastTime {0}; unsigned int accumulator {0}; + SDL_Event event {}; for (pugi::xml_node system {systemList.child("system")}; system; system = system.next_sibling("system")) { + // Parse events so that the OS doesn't think the application is hanging on startup, + // this is required as the main application loop hasn't started yet. + while (SDL_PollEvent(&event)) {}; + std::string name; std::string fullname; std::string sortName; diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 3ff2ababc..07a06d2ed 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -685,15 +685,7 @@ int main(int argc, char* argv[]) if (Settings::getInstance()->getBool("SplashScreen")) window->renderSplashScreen(Window::SplashScreenState::SCANNING, 0.0f); - InputManager::getInstance().parseEvent(event); - if (event.type == SDL_QUIT) - return 1; - -#if !defined(__APPLE__) - // This hides the mouse cursor during startup, i.e. before we have begun to capture SDL events. - // On macOS this causes the mouse cursor to jump back to the Dock so don't do it on this OS. - SDL_SetRelativeMouseMode(SDL_TRUE); -#endif + while (SDL_PollEvent(&event)) {}; #if defined(_WIN64) // Hide taskbar if the setting for this is enabled. @@ -769,12 +761,6 @@ int main(int argc, char* argv[]) .count() << " ms"; -#if !defined(__APPLE__) - // Now that we've finished loading, disable the relative mouse mode or otherwise mouse - // input wouldn't work in any games that are launched. - SDL_SetRelativeMouseMode(SDL_FALSE); -#endif - // Main application loop. #if defined(__EMSCRIPTEN__) diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 857a24e8d..9ab80b361 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -1112,9 +1112,14 @@ void ViewController::preload() float loadedSystems {0.0f}; unsigned int lastTime {0}; unsigned int accumulator {0}; + SDL_Event event {}; for (auto it = SystemData::sSystemVector.cbegin(); // Line break. it != SystemData::sSystemVector.cend(); ++it) { + // Parse events so that the OS doesn't think the application is hanging on startup, + // this is required as the main application loop hasn't started yet. + while (SDL_PollEvent(&event)) {}; + const std::string entryType {(*it)->isCustomCollection() ? "custom collection" : "system"}; LOG(LogDebug) << "ViewController::preload(): Populating gamelist for " << entryType << " \"" << (*it)->getName() << "\"";