diff --git a/client/README.md b/client/README.md index 4560639e..30ec68a4 100644 --- a/client/README.md +++ b/client/README.md @@ -101,24 +101,25 @@ Command line arguments will override any options loaded from the config files. | app:framePollInterval | | 1000 | How often to check for a frame update in microseconds | |-------------------------------------------------------------------------------------------------------------------------| -|-------------------------------------------------------------------------------------------------------| -| Long | Short | Value | Description | -|-------------------------------------------------------------------------------------------------------| -| win:title | | Looking Glass (client) | The window title | -| win:position | | center | Initial window position at startup | -| win:size | | 1024x768 | Initial window size at startup | -| win:autoResize | -a | no | Auto resize the window to the guest | -| win:allowResize | -n | yes | Aallow the window to be manually resized | -| win:keepAspect | -r | yes | Maintain the correct aspect ratio | -| win:borderless | -d | no | Borderless mode | -| win:fullScreen | -F | no | Launch in fullscreen borderless mode | -| win:maximize | -T | no | Launch window maximized | -| win:fpsLimit | -K | 200 | Frame rate limit (0 = disable - not recommended) | -| win:showFPS | -k | no | Enable the FPS & UPS display | -| win:ignoreQuit | -Q | no | Ignore requests to quit (ie: Alt+F4) | -| win:noScreensaver | -S | no | Prevent the screensaver from starting | -| win:alerts | -q | yes | Show on screen alert messages | -|-------------------------------------------------------------------------------------------------------| +|-------------------------------------------------------------------------------------------------------------| +| Long | Short | Value | Description | +|-------------------------------------------------------------------------------------------------------------| +| win:title | | Looking Glass (client) | The window title | +| win:position | | center | Initial window position at startup | +| win:size | | 1024x768 | Initial window size at startup | +| win:autoResize | -a | no | Auto resize the window to the guest | +| win:allowResize | -n | yes | Aallow the window to be manually resized | +| win:keepAspect | -r | yes | Maintain the correct aspect ratio | +| win:borderless | -d | no | Borderless mode | +| win:fullScreen | -F | no | Launch in fullscreen borderless mode | +| win:maximize | -T | no | Launch window maximized | +| win:minimizeOnFocusLoss | | yes | Minimize window on focus loss | +| win:fpsLimit | -K | 200 | Frame rate limit (0 = disable - not recommended) | +| win:showFPS | -k | no | Enable the FPS & UPS display | +| win:ignoreQuit | -Q | no | Ignore requests to quit (ie: Alt+F4) | +| win:noScreensaver | -S | no | Prevent the screensaver from starting | +| win:alerts | -q | yes | Show on screen alert messages | +|-------------------------------------------------------------------------------------------------------------| |---------------------------------------------------------------------------------------------------------------------------------------| | Long | Short | Value | Description | diff --git a/client/src/config.c b/client/src/config.c index f01bcfe3..5f9a8b09 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -175,6 +175,13 @@ static struct Option options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false, }, + { + .module = "win", + .name = "minimizeOnFocusLoss", + .description = "Minimize window on focus loss", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true, + }, { .module = "win", .name = "fpsLimit", @@ -396,6 +403,8 @@ bool config_load(int argc, char * argv[]) params.hideMouse = option_get_bool ("input", "hideCursor" ); params.mouseSens = option_get_int ("input", "mouseSens" ); + params.minimizeOnFocusLoss = option_get_bool("win", "minimizeOnFocusLoss"); + if (option_get_bool("spice", "enable")) { params.spiceHost = option_get_string("spice", "host"); @@ -559,4 +568,4 @@ static char * optScancodeToString(struct Option * opt) char * str; alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int)); return str; -} \ No newline at end of file +} diff --git a/client/src/main.c b/client/src/main.c index 8b71cd11..47def566 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1102,7 +1102,7 @@ int run() return 1; } - if (params.fullscreen) + if (params.fullscreen || !params.minimizeOnFocusLoss) SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); if (!params.noScreensaver) @@ -1377,4 +1377,4 @@ int main(int argc, char * argv[]) config_free(); return ret; -} \ No newline at end of file +} diff --git a/client/src/main.h b/client/src/main.h index 3321d5b7..806ea72c 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -82,6 +82,7 @@ struct AppParams bool borderless; bool fullscreen; bool maximize; + bool minimizeOnFocusLoss; bool center; int x, y; unsigned int w, h; @@ -129,4 +130,4 @@ struct KeybindHandle // forwards extern struct AppState state; -extern struct AppParams params; \ No newline at end of file +extern struct AppParams params;