From 9900b263d4f245f2c4f6b592a1ea9b6b755223c2 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 29 Apr 2021 12:50:43 +1000 Subject: [PATCH] [client] spice: new option `spice:showCursorDot` added This option if disabled will prevent the client from showing a "dot" cursor when the mouse is over the window, but the window is unfocused. --- client/src/app.c | 3 +++ client/src/config.c | 20 ++++++++++++++------ client/src/main.h | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/src/app.c b/client/src/app.c index babea6f3..2c7e43a9 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -63,6 +63,9 @@ void app_handleFocusEvent(bool focused) for (int key = 0; key < KEY_MAX; key++) if (g_state.keyDown[key]) app_handleKeyRelease(key); + + if (!g_params.showCursorDot) + g_state.ds->showPointer(false); } g_cursor.realign = true; diff --git a/client/src/config.c b/client/src/config.c index bd7add60..7eed1263 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -421,6 +421,13 @@ static struct Option options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false }, + { + .module = "app", + .name = "showCursorDot", + .description = "Use a \"dot\" cursor when the window does not have focus", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true + }, {0} }; @@ -483,9 +490,9 @@ bool config_load(int argc, char * argv[]) } // setup the application params for the basic types - g_params.cursorPollInterval = option_get_int ("app", "cursorPollInterval"); - g_params.framePollInterval = option_get_int ("app", "framePollInterval" ); - g_params.allowDMA = option_get_bool ("app", "allowDMA" ); + g_params.cursorPollInterval = option_get_int ("app" , "cursorPollInterval"); + 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" ); @@ -551,9 +558,10 @@ bool config_load(int argc, char * argv[]) g_params.useSpiceClipboard = false; } - g_params.scaleMouseInput = option_get_bool("spice", "scaleCursor"); - g_params.captureOnStart = option_get_bool("spice", "captureOnStart"); - g_params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); + g_params.scaleMouseInput = option_get_bool("spice", "scaleCursor"); + g_params.captureOnStart = option_get_bool("spice", "captureOnStart"); + g_params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); + g_params.showCursorDot = option_get_bool("spice", "showCursorDot"); } return true; diff --git a/client/src/main.h b/client/src/main.h index 39675773..29faa0f5 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -151,6 +151,7 @@ struct AppParams bool rawMouse; bool autoCapture; bool captureInputOnly; + bool showCursorDot; }; struct CBRequest