mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 13:33:40 +00:00
[client] wm: optionally disable screensaver when requested in guest
This commit adds a new option, win:autoScreensaver, which when set to yes, automatically disables the screensaver when requested by an application running in the guest, and enables it when the application no longer wants it disabled. This is useful when doing media playback in the guest.
This commit is contained in:
parent
8e98f863b6
commit
0c9ecdfcb5
@ -224,6 +224,13 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "autoScreensaver",
|
||||
.description = "Prevent the screensaver from starting when guest requests it",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "alerts",
|
||||
@ -473,21 +480,29 @@ 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.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.showFPS = option_get_bool ("win", "showFPS" );
|
||||
g_params.ignoreQuit = option_get_bool ("win", "ignoreQuit" );
|
||||
g_params.noScreensaver = option_get_bool ("win", "noScreensaver");
|
||||
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
||||
g_params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||
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.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.showFPS = option_get_bool ("win", "showFPS" );
|
||||
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" );
|
||||
|
||||
if (g_params.noScreensaver && g_params.autoScreensaver)
|
||||
{
|
||||
fprintf(stderr, "win:noScreensaver (-S) and win:autoScreensaver "
|
||||
"can't be used simultaneously\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(option_get_int("win", "rotate"))
|
||||
{
|
||||
|
@ -538,6 +538,15 @@ int main_frameThread(void * unused)
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_params.autoScreensaver && g_state.autoIdleInhibitState != frame->blockScreensaver)
|
||||
{
|
||||
if (frame->blockScreensaver)
|
||||
g_state.ds->inhibitIdle();
|
||||
else
|
||||
g_state.ds->uninhibitIdle();
|
||||
g_state.autoIdleInhibitState = frame->blockScreensaver;
|
||||
}
|
||||
|
||||
atomic_fetch_add_explicit(&g_state.frameCount, 1, memory_order_relaxed);
|
||||
lgSignalEvent(e_frame);
|
||||
lgmpClientMessageDone(queue);
|
||||
|
@ -92,6 +92,8 @@ struct AppState
|
||||
|
||||
uint64_t resizeTimeout;
|
||||
bool resizeDone;
|
||||
|
||||
bool autoIdleInhibitState;
|
||||
};
|
||||
|
||||
struct AppParams
|
||||
@ -121,6 +123,7 @@ struct AppParams
|
||||
bool hideMouse;
|
||||
bool ignoreQuit;
|
||||
bool noScreensaver;
|
||||
bool autoScreensaver;
|
||||
bool grabKeyboard;
|
||||
bool grabKeyboardOnFocus;
|
||||
int escapeKey;
|
||||
|
Loading…
Reference in New Issue
Block a user