From 5954361cc328b71eb1dff98cff7e0980cdaf65bf Mon Sep 17 00:00:00 2001 From: Oschowa Date: Fri, 28 Aug 2020 18:31:04 +0200 Subject: [PATCH] Add an option to start in fullscreen if nested --- src/main.cpp | 7 ++++++- src/main.hpp | 2 ++ src/sdlwindow.cpp | 10 +++++++--- src/steamcompmgr.cpp | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b91d094..c05ed53 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,6 +26,8 @@ uint32_t g_nOutputWidth = 1280; uint32_t g_nOutputHeight = 720; int g_nOutputRefresh = 60; +bool g_bFullscreen = false; + bool g_bIsNested = false; bool g_bFilterGameWindow = true; @@ -64,7 +66,7 @@ int main(int argc, char **argv) bool bSleepAtStartup = false; - while ((o = getopt (argc, argv, ":R:T:w:h:W:H:r:NFSvVecsdlnb")) != -1) + while ((o = getopt (argc, argv, ":R:T:w:h:W:H:r:NFSvVecsdlnbf")) != -1) { switch (o) { case 'w': @@ -97,6 +99,9 @@ int main(int argc, char **argv) case 'b': g_bBorderlessOutputWindow = true; break; + case 'f': + g_bFullscreen = true; + break; default: break; } diff --git a/src/main.hpp b/src/main.hpp index 45f6780..489d036 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -16,6 +16,8 @@ extern uint32_t g_nOutputWidth; extern uint32_t g_nOutputHeight; extern int g_nOutputRefresh; +extern bool g_bFullscreen; + extern bool g_bFilterGameWindow; extern bool g_bBorderlessOutputWindow; diff --git a/src/sdlwindow.cpp b/src/sdlwindow.cpp index 6310fe1..6cb01ba 100644 --- a/src/sdlwindow.cpp +++ b/src/sdlwindow.cpp @@ -68,7 +68,6 @@ void inputSDLThreadRun( void ) SDL_Event event; SDL_Keymod mod; uint32_t key; - static bool bFullscreen = false; SDL_Init( SDL_INIT_VIDEO | SDL_INIT_EVENTS ); @@ -84,6 +83,11 @@ void inputSDLThreadRun( void ) nSDLWindowFlags |= SDL_WINDOW_BORDERLESS; } + if ( g_bFullscreen == true ) + { + nSDLWindowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; + } + g_SDLWindow = SDL_CreateWindow( "gamescope", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, @@ -141,8 +145,8 @@ void inputSDLThreadRun( void ) switch ( key ) { case KEY_F: - bFullscreen = !bFullscreen; - SDL_SetWindowFullscreen( g_SDLWindow, bFullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0 ); + g_bFullscreen = !g_bFullscreen; + SDL_SetWindowFullscreen( g_SDLWindow, g_bFullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0 ); break; case KEY_N: g_bFilterGameWindow = !g_bFilterGameWindow; diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index bc91144..b0e8e1a 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -2464,7 +2464,7 @@ steamcompmgr_main (int argc, char **argv) // :/ optind = 1; - while ((o = getopt (argc, argv, ":R:T:w:h:W:H:r:NFSvVecsdlnb")) != -1) + while ((o = getopt (argc, argv, ":R:T:w:h:W:H:r:NFSvVecsdlnbf")) != -1) { switch (o) { case 'R':