mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-20 22:32:01 +00:00
client: move LGMP session probing off the event thread
LGMP session validation may wait 500 ms for the shared-memory heartbeat to advance. Run it on a worker so Wayland input remains responsive while preserving stale-data detection.
This commit is contained in:
@@ -1196,6 +1196,25 @@ static MsgBoxHandle showSpiceInputHelp(void)
|
|||||||
"through SPICE if you press the capture key.");
|
"through SPICE if you press the capture key.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct LGMPClientSessionProbe
|
||||||
|
{
|
||||||
|
PLGMPClient client;
|
||||||
|
uint32_t udataSize;
|
||||||
|
uint8_t * udata;
|
||||||
|
uint32_t remoteVersion;
|
||||||
|
LGMP_STATUS status;
|
||||||
|
atomic_bool done;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int lgmpClientSessionProbe(void * opaque)
|
||||||
|
{
|
||||||
|
struct LGMPClientSessionProbe * probe = opaque;
|
||||||
|
probe->status = lgmpClientSessionInit(probe->client, &probe->udataSize,
|
||||||
|
&probe->udata, NULL, &probe->remoteVersion);
|
||||||
|
atomic_store_explicit(&probe->done, true, memory_order_release);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lg_run(void)
|
static int lg_run(void)
|
||||||
{
|
{
|
||||||
g_cursor.sens = g_params.mouseSens;
|
g_cursor.sens = g_params.mouseSens;
|
||||||
@@ -1495,8 +1514,36 @@ restart:
|
|||||||
initialSpiceEnable = 0;
|
initialSpiceEnable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = lgmpClientSessionInit(g_state.lgmp, &udataSize, (uint8_t **)&udata,
|
struct LGMPClientSessionProbe probe =
|
||||||
NULL, &remoteVersion);
|
{
|
||||||
|
.client = g_state.lgmp,
|
||||||
|
.done = false,
|
||||||
|
};
|
||||||
|
LGThread * probeThread;
|
||||||
|
if (!lgCreateThread("lgmpSession", lgmpClientSessionProbe, &probe,
|
||||||
|
&probeThread))
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Failed to create LGMP session probe thread");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (g_state.state == APP_STATE_RUNNING &&
|
||||||
|
!atomic_load_explicit(&probe.done, memory_order_acquire))
|
||||||
|
g_state.ds->wait(100);
|
||||||
|
|
||||||
|
if (!lgJoinThread(probeThread, NULL))
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Failed to join LGMP session probe thread");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_state.state != APP_STATE_RUNNING)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
status = probe.status;
|
||||||
|
udataSize = probe.udataSize;
|
||||||
|
udata = (KVMFR *)probe.udata;
|
||||||
|
remoteVersion = probe.remoteVersion;
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case LGMP_OK:
|
case LGMP_OK:
|
||||||
|
|||||||
Reference in New Issue
Block a user