diff --git a/desktop_version/src/KeyPoll.cpp b/desktop_version/src/KeyPoll.cpp index 43a99efa..1daf6394 100644 --- a/desktop_version/src/KeyPoll.cpp +++ b/desktop_version/src/KeyPoll.cpp @@ -68,7 +68,7 @@ void KeyPoll::disabletextentry() SDL_StopTextInput(); } -void KeyPoll::Poll() +void KeyPoll::Poll(Screen *screen) { SDL_Event evt; while (SDL_PollEvent(&evt)) @@ -246,9 +246,14 @@ void KeyPoll::Poll() isActive = true; if (!useFullscreenSpaces) { - SDL_Window *window = SDL_GetWindowFromID(evt.window.windowID); - wasFullscreen = SDL_GetWindowFlags(window); - SDL_SetWindowFullscreen(window, 0); + if (wasFullscreen) + { + screen->isWindowed = false; + SDL_SetWindowFullscreen( + SDL_GetWindowFromID(evt.window.windowID), + SDL_WINDOW_FULLSCREEN_DESKTOP + ); + } } SDL_DisableScreenSaver(); } @@ -257,9 +262,11 @@ void KeyPoll::Poll() isActive = false; if (!useFullscreenSpaces) { + wasFullscreen = !screen->isWindowed; + screen->isWindowed = true; SDL_SetWindowFullscreen( SDL_GetWindowFromID(evt.window.windowID), - wasFullscreen + 0 ); } SDL_EnableScreenSaver(); diff --git a/desktop_version/src/KeyPoll.h b/desktop_version/src/KeyPoll.h index 53630450..8a17209b 100644 --- a/desktop_version/src/KeyPoll.h +++ b/desktop_version/src/KeyPoll.h @@ -7,6 +7,8 @@ #include "SDL.h" +#include "Screen.h" + enum Kybrd { KEYBOARD_UP = SDLK_UP, @@ -52,7 +54,7 @@ public: void disabletextentry(); - void Poll(); + void Poll(Screen *screen); bool isDown(SDL_Keycode key); diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index fe9b7cb4..d4e57644 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -338,7 +338,7 @@ int main(int argc, char *argv[]) - key.Poll(); + key.Poll(&gameScreen); if(key.toggleFullscreen) { if(!gameScreen.isWindowed)