[client] app: cleanup clipboard option logic

This commit is contained in:
Geoffrey McRae 2021-06-02 22:09:09 +10:00
parent b657b57016
commit b2974c38ef
3 changed files with 17 additions and 10 deletions

View File

@ -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();

View File

@ -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");

View File

@ -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, ""))
{