[client] added new input:mouseRedraw option

This new option, when enabled (the default) enables cursor movements to
trigger frame updates in the client, improving responsiveness at the
cost of increased FPS while the mouse is moving around.
This commit is contained in:
Geoffrey McRae 2020-08-20 15:50:33 +10:00
parent f9b6dcc986
commit 6927dbecd2
4 changed files with 18 additions and 4 deletions

View file

@ -1 +1 @@
B2-rc4-7-g5c912e3c27+1
B2-rc4-8-gf9b6dcc986+1

View file

@ -247,6 +247,13 @@ static struct Option options[] =
.type = OPTION_TYPE_INT,
.value.x_int = 0,
},
{
.module = "input",
.name = "mouseRedraw",
.description = "Mouse movements trigger redraws (ignores FPS minimum)",
.type = OPTION_TYPE_BOOL,
.value.x_bool = true,
},
// spice options
{
@ -399,6 +406,7 @@ bool config_load(int argc, char * argv[])
params.escapeKey = option_get_int ("input", "escapeKey" );
params.hideMouse = option_get_bool ("input", "hideCursor" );
params.mouseSens = option_get_int ("input", "mouseSens" );
params.mouseRedraw = option_get_bool ("input", "mouseRedraw" );
params.minimizeOnFocusLoss = option_get_bool("win", "minimizeOnFocusLoss");

View file

@ -358,6 +358,9 @@ static int cursorThread(void * unused)
state.cursor.x,
state.cursor.y
);
if (params.mouseRedraw)
lgSignalEvent(e_frame);
}
lgmpClientUnsubscribe(&queue);
@ -1349,13 +1352,15 @@ static int lg_run()
// ensure renderer viewport is aware of the current window size
updatePositionInfo();
// use a default of 60FPS now that frame updates are host update triggered
if (params.fpsMin == -1)
state.frameTime = 1e9 / 60;
{
// minimum 60fps to keep interactivity decent
state.frameTime = 1000000000ULL / 60ULL;
}
else
{
DEBUG_INFO("Using the FPS minimum from args: %d", params.fpsMin);
state.frameTime = 1e9 / params.fpsMin;
state.frameTime = 1000000000ULL / (unsigned long long)params.fpsMin;
}
register_key_binds();

View file

@ -160,6 +160,7 @@ struct AppParams
const char * windowTitle;
int mouseSens;
bool mouseRedraw;
};
struct CBRequest