From 6927dbecd2061726b4079ee896dc4b33beee6268 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 20 Aug 2020 15:50:33 +1000 Subject: [PATCH] [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. --- VERSION | 2 +- client/src/config.c | 8 ++++++++ client/src/main.c | 11 ++++++++--- client/src/main.h | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 020680e6..3c832765 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc4-7-g5c912e3c27+1 \ No newline at end of file +B2-rc4-8-gf9b6dcc986+1 \ No newline at end of file diff --git a/client/src/config.c b/client/src/config.c index f45fe45c..d12185c2 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -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"); diff --git a/client/src/main.c b/client/src/main.c index 0436b73d..02bc1db4 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -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(); diff --git a/client/src/main.h b/client/src/main.h index c60d26f4..2fd0b56f 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -160,6 +160,7 @@ struct AppParams const char * windowTitle; int mouseSens; + bool mouseRedraw; }; struct CBRequest