VIDEO: removed real fullscreen support - use fake fullscreen

this fixes the ui displays not receiving mouse input with the correct
coordinates in (real) fullscreen mode
master
Martin Gerhardy 2022-02-06 14:27:17 +01:00
parent 236e743530
commit 12fbd2ae7f
1 changed files with 16 additions and 6 deletions

View File

@ -175,11 +175,21 @@ void WindowedApp::onMouseButtonRelease(int32_t x, int32_t y, uint8_t button) {
bool WindowedApp::onKeyPress(int32_t key, int16_t modifier) {
if (modifier & KMOD_LALT) {
if (key == SDLK_RETURN) {
const uint32_t flags = SDL_GetWindowFlags(_window);
if (flags & SDL_WINDOW_FULLSCREEN_DESKTOP) {
SDL_SetWindowFullscreen(_window, 0);
} else {
SDL_SetWindowFullscreen(_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_DisplayMode displayMode;
if (SDL_GetWindowDisplayMode(_window, &displayMode) == 0) {
const uint32_t flags = SDL_GetWindowFlags(_window);
if (flags & SDL_WINDOW_BORDERLESS) {
SDL_SetWindowBordered(_window, SDL_TRUE);
SDL_SetWindowResizable(_window, SDL_TRUE);
core::Var::getSafe(cfg::ClientFullscreen)->setVal(false);
Log::debug("Add window border and allow to resize (windowed)");
} else {
SDL_SetWindowBordered(_window, SDL_FALSE);
SDL_SetWindowResizable(_window, SDL_FALSE);
core::Var::getSafe(cfg::ClientFullscreen)->setVal(true);
Log::debug("Remove window border and don't allow to resize (fullscreen)");
}
SDL_SetWindowSize(_window, displayMode.w, displayMode.h);
}
return true;
}
@ -296,7 +306,7 @@ app::AppState WindowedApp::onInit() {
Log::debug("Disable high dpi support");
}
if (fullscreen) {
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_BORDERLESS;
flags |= SDL_WINDOW_BORDERLESS;
} else {
flags |= SDL_WINDOW_RESIZABLE;
}