mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[client] close message boxes if the client connects
This commit is contained in:
parent
4122841b09
commit
ca0bc7c514
@ -974,14 +974,14 @@ static void reportBadVersion()
|
||||
DEBUG_ERROR("Please install the matching host application for this client");
|
||||
}
|
||||
|
||||
static void showSpiceInputHelp(void)
|
||||
static MsgBoxHandle showSpiceInputHelp(void)
|
||||
{
|
||||
static bool done = false;
|
||||
if (!g_params.useSpiceInput || done)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
done = true;
|
||||
app_msgBox(
|
||||
return app_msgBox(
|
||||
"Information",
|
||||
"Please note you can still control your guest\n"
|
||||
"through SPICE if you press the capture key.");
|
||||
@ -1227,16 +1227,24 @@ static int lg_run(void)
|
||||
KVMFR *udata;
|
||||
int waitCount = 0;
|
||||
|
||||
MsgBoxHandle msgs[10];
|
||||
int msgsCount;
|
||||
|
||||
restart:
|
||||
msgsCount = 0;
|
||||
memset(msgs, 0, sizeof(msgs));
|
||||
|
||||
while(g_state.state == APP_STATE_RUNNING)
|
||||
{
|
||||
if ((status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata)) == LGMP_OK)
|
||||
break;
|
||||
|
||||
if (status == LGMP_ERR_INVALID_VERSION)
|
||||
switch(status)
|
||||
{
|
||||
case LGMP_ERR_INVALID_VERSION:
|
||||
{
|
||||
reportBadVersion();
|
||||
app_msgBox(
|
||||
msgs[msgsCount++] = app_msgBox(
|
||||
"Incompatible LGMP Version",
|
||||
"The host application is not compatible with this client.\n"
|
||||
"Please download and install the matching version."
|
||||
@ -1250,15 +1258,12 @@ restart:
|
||||
if (g_state.state != APP_STATE_RUNNING)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (status != LGMP_ERR_INVALID_SESSION && status != LGMP_ERR_INVALID_MAGIC)
|
||||
case LGMP_ERR_INVALID_SESSION:
|
||||
case LGMP_ERR_INVALID_MAGIC:
|
||||
{
|
||||
DEBUG_ERROR("lgmpClientSessionInit Failed: %s", lgmpStatusString(status));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (waitCount++ == 0)
|
||||
{
|
||||
DEBUG_BREAK();
|
||||
@ -1269,7 +1274,7 @@ restart:
|
||||
if (waitCount == 30)
|
||||
{
|
||||
DEBUG_BREAK();
|
||||
app_msgBox(
|
||||
msgs[msgsCount++] = app_msgBox(
|
||||
"Host Application Not Running",
|
||||
"It seems the host application is not running or your\n"
|
||||
"virtual machine is still starting up\n"
|
||||
@ -1280,19 +1285,25 @@ restart:
|
||||
"\n"
|
||||
"Continuing to wait...");
|
||||
|
||||
showSpiceInputHelp();
|
||||
msgs[msgsCount++] = showSpiceInputHelp();
|
||||
|
||||
DEBUG_INFO("Check the host log in your guest at %%ProgramData%%\\Looking Glass (host)\\looking-glass-host.txt");
|
||||
DEBUG_INFO("Continuing to wait...");
|
||||
}
|
||||
|
||||
g_state.ds->wait(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("lgmpClientSessionInit Failed: %s", lgmpStatusString(status));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (g_state.state != APP_STATE_RUNNING)
|
||||
return -1;
|
||||
|
||||
// dont show warnings again after the first startup
|
||||
// dont show warnings again after the first successful startup
|
||||
waitCount = 100;
|
||||
|
||||
const bool magicMatches = memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) == 0;
|
||||
@ -1303,14 +1314,13 @@ restart:
|
||||
{
|
||||
if(g_state.state == APP_STATE_RUNNING)
|
||||
g_state.ds->wait(1000);
|
||||
|
||||
goto restart;
|
||||
continue;
|
||||
}
|
||||
|
||||
reportBadVersion();
|
||||
if (magicMatches)
|
||||
{
|
||||
app_msgBox(
|
||||
msgs[msgsCount++] = app_msgBox(
|
||||
"Incompatible KVMFR Version",
|
||||
"The host application is not compatible with this client.\n"
|
||||
"Please download and install the matching version.\n"
|
||||
@ -1331,7 +1341,7 @@ restart:
|
||||
|
||||
DEBUG_BREAK();
|
||||
|
||||
showSpiceInputHelp();
|
||||
msgs[msgsCount++] = showSpiceInputHelp();
|
||||
|
||||
DEBUG_INFO("Waiting for you to upgrade the host application");
|
||||
|
||||
@ -1339,9 +1349,22 @@ restart:
|
||||
if(g_state.state == APP_STATE_RUNNING)
|
||||
g_state.ds->wait(1000);
|
||||
|
||||
goto restart;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(g_state.state != APP_STATE_RUNNING)
|
||||
return -1;
|
||||
|
||||
/* close any informational message boxes from above as we now connected
|
||||
* successfully */
|
||||
|
||||
for(int i = 0; i < msgsCount; ++i)
|
||||
if (msgs[i])
|
||||
app_msgBoxClose(msgs[i]);
|
||||
|
||||
DEBUG_INFO("Guest Information:");
|
||||
DEBUG_INFO("Version : %s", udata->hostver);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user