Skip to content

SDL bugfix for settings smaller than your monitors resolution. #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/projectM-sdl/projectM_SDL_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,24 @@ srand((int)(time(NULL)));
app = new projectMSDL(settings, 0);
}

// If our config or hard-coded settings create a resolution smaller than the monitors, then resize the SDL window to match.
if (height > app->getWindowHeight() || width > app->getWindowWidth()) {
SDL_SetWindowSize(win, app->getWindowWidth(),app->getWindowHeight());
SDL_SetWindowPosition(win, (width / 2)-(app->getWindowWidth()/2), (height / 2)-(app->getWindowHeight()/2));
} else if (height < app->getWindowHeight() || width < app->getWindowWidth()) {
// If our config is larger than our monitors resolution then reduce it.
SDL_SetWindowSize(win, width, height);
SDL_SetWindowPosition(win, 0, 0);
}

std::string modKey = "CTRL";
// Create a help menu specific to SDL
std::string modKey = "CTRL";

#if __APPLE_
modKey = "CMD";
#endif

std::string sdlHelpMenu = "\n"
std::string sdlHelpMenu = "\n"
"F1: This help menu""\n"
"F3: Show preset name""\n"
"F5: Show FPS""\n"
Expand All @@ -388,9 +398,8 @@ modKey = "CMD";
modKey + "-S: Stretch Monitors""\n" +
modKey + "-F: Fullscreen""\n" +
modKey + "-Q: Quit";

app->setHelpText(sdlHelpMenu.c_str());

app->setHelpText(sdlHelpMenu.c_str());

app->init(win, &glCtx);

#if STEREOSCOPIC_SBS
Expand Down Expand Up @@ -515,6 +524,11 @@ modKey = "CMD";
#if !FAKE_AUDIO && !WASAPI_LOOPBACK
app->endAudioCapture();
#endif

// Write back config with current app settings (if we loaded from a config file to begin with)
if (!configFilePath.empty()) {
projectM::writeConfig(configFilePath, app->settings());
}
delete app;

return PROJECTM_SUCCESS;
Expand Down