From b2974c38efb7ff599232d4a0fda15d0775fad3cc Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 2 Jun 2021 22:09:09 +1000 Subject: [PATCH] [client] app: cleanup clipboard option logic --- client/src/app.c | 3 +++ client/src/config.c | 13 ++++++++----- client/src/main.c | 11 ++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/client/src/app.c b/client/src/app.c index 3c42fe0a..fa67c038 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -128,6 +128,9 @@ void app_clipboardRelease(void) void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count) { + if (!g_params.clipboardToVM) + return; + if (count == 0) { spice_clipboard_release(); diff --git a/client/src/config.c b/client/src/config.c index 7b7d7edc..a4ef5e0c 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -568,11 +568,14 @@ bool config_load(int argc, char * argv[]) if (g_params.useSpiceClipboard) { - g_params.clipboardToVM = option_get_bool("spice", "clipboardToVM" ); - g_params.clipboardToLocal = option_get_bool("spice", "clipboardToLocal"); - - if (!g_params.clipboardToVM && !g_params.clipboardToLocal) - g_params.useSpiceClipboard = false; + g_params.clipboardToVM = option_get_bool("spice", "clipboardToVM" ); + g_params.clipboardToLocal = option_get_bool("spice", "clipboardToLocal"); + g_params.useSpiceClipboard = g_params.clipboardToVM || g_params.clipboardToLocal; + } + else + { + g_params.clipboardToVM = false; + g_params.clipboardToLocal = false; } g_params.scaleMouseInput = option_get_bool("spice", "scaleCursor"); diff --git a/client/src/main.c b/client/src/main.c index 594c2ce9..ce6587af 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -684,11 +684,12 @@ static int lg_run(void) // try to connect to the spice server if (g_params.useSpiceInput || g_params.useSpiceClipboard) { - spice_set_clipboard_cb( - cb_spiceNotice, - cb_spiceData, - cb_spiceRelease, - cb_spiceRequest); + if (g_params.useSpiceClipboard) + spice_set_clipboard_cb( + cb_spiceNotice, + cb_spiceData, + cb_spiceRelease, + cb_spiceRequest); if (!spice_connect(g_params.spiceHost, g_params.spicePort, "")) {