From db51acdd8aed3856a54e7d54b682bf7ec140754d Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 15 Nov 2020 14:41:22 +0100 Subject: [PATCH] [client] add option to always show cursor --- client/README.md | 1 + client/src/config.c | 8 ++++++++ client/src/main.c | 6 ++++-- client/src/main.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/client/README.md b/client/README.md index 64e0e0ac..df3aabd6 100644 --- a/client/README.md +++ b/client/README.md @@ -144,6 +144,7 @@ Command line arguments will override any options loaded from the config files. | spice:clipboardToLocal | | yes | Allow the clipboard to be syncronized FROM the VM | | spice:scaleCursor | -j | yes | Scale cursor input position to screen size when up/down scaled | | spice:captureOnStart | | no | Capture mouse and keyboard on start | +| spice:alwaysShowCursor | | no | Always show host cursor | |------------------------------------------------------------------------------------------------------------------| |--------------------------------------------------------------------------| diff --git a/client/src/config.c b/client/src/config.c index 0bfc61b0..293b5494 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -344,6 +344,13 @@ static struct Option options[] = .type = OPTION_TYPE_BOOL, .value.x_bool = false }, + { + .module = "spice", + .name = "alwaysShowCursor", + .description = "Always show host cursor", + .type = OPTION_TYPE_BOOL, + .value.x_bool = false + }, {0} }; @@ -453,6 +460,7 @@ bool config_load(int argc, char * argv[]) params.scaleMouseInput = option_get_bool("spice", "scaleCursor"); params.captureOnStart = option_get_bool("spice", "captureOnStart"); + params.alwaysShowCursor = option_get_bool("spice", "alwaysShowCursor"); } return true; diff --git a/client/src/main.c b/client/src/main.c index 88156aab..8672e63d 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -821,7 +821,7 @@ static void handleMouseMoveEvent(int ex, int ey) state.updateCursor = true; state.warpState = WARP_STATE_OFF; - if (params.useSpiceInput) + if (params.useSpiceInput && !params.alwaysShowCursor) state.drawCursor = false; return; } @@ -906,7 +906,9 @@ static void handleWindowLeave() if (!params.useSpiceInput) return; - state.drawCursor = false; + if (!params.alwaysShowCursor) + state.drawCursor = false; + state.cursorInView = false; state.updateCursor = true; state.warpState = WARP_STATE_OFF; diff --git a/client/src/main.h b/client/src/main.h index 0ba249e0..312240d6 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -155,6 +155,7 @@ struct AppParams bool showAlerts; bool captureOnStart; bool quickSplash; + bool alwaysShowCursor; unsigned int cursorPollInterval; unsigned int framePollInterval;