From 9cadb64942e6847b274fe32e1accfd21aee2ac2e Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 13 Sep 2023 14:07:42 +1000 Subject: [PATCH] [client] main: make activation requests optional --- client/src/config.c | 50 ++++++++++++++++++++++++++------------------- client/src/main.c | 6 ++++-- client/src/main.h | 1 + 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/client/src/config.c b/client/src/config.c index feb2e6f0..8baa12be 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -295,6 +295,13 @@ static struct Option options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false, }, + { + .module = "win", + .name = "requestActivation", + .description = "Request activation when attention is needed", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true + }, // input options { @@ -634,27 +641,28 @@ bool config_load(int argc, char * argv[]) g_params.framePollInterval = option_get_int ("app" , "framePollInterval" ); g_params.allowDMA = option_get_bool ("app" , "allowDMA" ); - g_params.windowTitle = option_get_string("win", "title" ); - g_params.autoResize = option_get_bool ("win", "autoResize" ); - g_params.allowResize = option_get_bool ("win", "allowResize" ); - g_params.keepAspect = option_get_bool ("win", "keepAspect" ); - g_params.forceAspect = option_get_bool ("win", "forceAspect" ); - g_params.dontUpscale = option_get_bool ("win", "dontUpscale" ); - g_params.intUpscale = option_get_bool ("win", "intUpscale" ); - g_params.shrinkOnUpscale = option_get_bool ("win", "shrinkOnUpscale" ); - g_params.borderless = option_get_bool ("win", "borderless" ); - g_params.fullscreen = option_get_bool ("win", "fullScreen" ); - g_params.maximize = option_get_bool ("win", "maximize" ); - g_params.fpsMin = option_get_int ("win", "fpsMin" ); - g_params.ignoreQuit = option_get_bool ("win", "ignoreQuit" ); - g_params.noScreensaver = option_get_bool ("win", "noScreensaver" ); - g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver" ); - g_params.showAlerts = option_get_bool ("win", "alerts" ); - g_params.quickSplash = option_get_bool ("win", "quickSplash" ); - g_params.overlayDim = option_get_bool ("win", "overlayDimsDesktop"); - g_params.uiFont = option_get_string("win", "uiFont" ); - g_params.uiSize = option_get_int ("win", "uiSize" ); - g_params.jitRender = option_get_bool ("win", "jitRender" ); + g_params.windowTitle = option_get_string("win", "title" ); + g_params.autoResize = option_get_bool ("win", "autoResize" ); + g_params.allowResize = option_get_bool ("win", "allowResize" ); + g_params.keepAspect = option_get_bool ("win", "keepAspect" ); + g_params.forceAspect = option_get_bool ("win", "forceAspect" ); + g_params.dontUpscale = option_get_bool ("win", "dontUpscale" ); + g_params.intUpscale = option_get_bool ("win", "intUpscale" ); + g_params.shrinkOnUpscale = option_get_bool ("win", "shrinkOnUpscale" ); + g_params.borderless = option_get_bool ("win", "borderless" ); + g_params.fullscreen = option_get_bool ("win", "fullScreen" ); + g_params.maximize = option_get_bool ("win", "maximize" ); + g_params.fpsMin = option_get_int ("win", "fpsMin" ); + g_params.ignoreQuit = option_get_bool ("win", "ignoreQuit" ); + g_params.noScreensaver = option_get_bool ("win", "noScreensaver" ); + g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver" ); + g_params.showAlerts = option_get_bool ("win", "alerts" ); + g_params.quickSplash = option_get_bool ("win", "quickSplash" ); + g_params.overlayDim = option_get_bool ("win", "overlayDimsDesktop"); + g_params.uiFont = option_get_string("win", "uiFont" ); + g_params.uiSize = option_get_int ("win", "uiSize" ); + g_params.jitRender = option_get_bool ("win", "jitRender" ); + g_params.requestActivation = option_get_bool ("win", "requestActivation" ); if (g_params.noScreensaver && g_params.autoScreensaver) { diff --git a/client/src/main.c b/client/src/main.c index 5855db41..22f2ae1e 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -569,7 +569,8 @@ int main_frameThread(void * unused) break; } - g_state.ds->requestActivation(); + if (g_params.requestActivation) + g_state.ds->requestActivation(); while(g_state.state == APP_STATE_RUNNING && !g_state.stopVideo) { @@ -782,7 +783,8 @@ int main_frameThread(void * unused) overlaySplash_show(false); - if (frame->flags & FRAME_FLAG_REQUEST_ACTIVATION) + if (frame->flags & FRAME_FLAG_REQUEST_ACTIVATION && + g_params.requestActivation) g_state.ds->requestActivation(); const bool blockScreensaver = frame->flags & FRAME_FLAG_BLOCK_SCREENSAVER; diff --git a/client/src/main.h b/client/src/main.h index 9755f94b..4fae595b 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -201,6 +201,7 @@ struct AppParams const char * uiFont; int uiSize; bool jitRender; + bool requestActivation; unsigned int cursorPollInterval; unsigned int framePollInterval;