From d42e40972887f5a691361057923a8a13e964276d Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 8 Jan 2022 19:32:58 +1100 Subject: [PATCH] [client] spice: show message when connected to the wrong guest --- client/src/main.c | 17 ++++++++++++++--- client/src/main.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 335050d0..dc452668 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -805,8 +805,14 @@ static void checkUUID(void) sizeof(g_state.spiceUUID)) == 0) return; - DEBUG_ERROR("UUIDs do not match, you have connected SPICE to the wrong guest"); - g_state.state = APP_STATE_SHUTDOWN; + app_msgBox( + "SPICE Configuration Error", + "You have connected SPICE to the wrong guest.\n" + "Input will not function until this is corrected."); + + g_params.useSpiceInput = false; + g_state.spiceClose = true; + purespice_disconnect(); } void spiceReady(void) @@ -899,7 +905,12 @@ int spiceThread(void * arg) end: audio_free(); - g_state.state = APP_STATE_SHUTDOWN; + + // if the connection was disconnected intentionally we don't want to shutdown + // so that the user can see the message box and take action + if (!g_state.spiceClose) + g_state.state = APP_STATE_SHUTDOWN; + return 0; } diff --git a/client/src/main.h b/client/src/main.h index 1aaa2215..4ce59b72 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -94,6 +94,7 @@ struct AppState LG_RendererRect dstRect; bool posInfoValid; bool alignToGuest; + bool spiceClose; LG_Renderer * lgr; atomic_int lgrResize;