mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-05-17 03:51:17 +00:00
[client] implement support for KVMFR_FEATURE_SETCURSORPOS
This commit is contained in:
parent
95bbd67dea
commit
afbee641b1
@ -407,13 +407,25 @@ void core_handleMouseNormal(double ex, double ey)
|
||||
if (g_cursor.realign)
|
||||
{
|
||||
g_cursor.realign = false;
|
||||
|
||||
struct DoublePoint guest;
|
||||
util_localCurToGuest(&guest);
|
||||
|
||||
/* add the difference to the offset */
|
||||
ex += guest.x - (g_cursor.guest.x + g_cursor.guest.hx);
|
||||
ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy);
|
||||
if (g_state.kvmfrFeatures & KVMFR_FEATURE_SETCURSORPOS)
|
||||
{
|
||||
const KVMFRSetCursorPos msg = {
|
||||
.msg.type = KVMFR_MESSAGE_SETCURSORPOS,
|
||||
.x = guest.x,
|
||||
.y = guest.y
|
||||
};
|
||||
|
||||
lgmpClientSendData(g_state.pointerQueue, &msg, sizeof(msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add the difference to the offset */
|
||||
ex += guest.x - (g_cursor.guest.x + g_cursor.guest.hx);
|
||||
ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy);
|
||||
}
|
||||
|
||||
/* don't test for an exit as we just entered, we can get into a enter/exit
|
||||
* loop otherwise */
|
||||
|
@ -299,7 +299,6 @@ static int renderThread(void * unused)
|
||||
static int cursorThread(void * unused)
|
||||
{
|
||||
LGMP_STATUS status;
|
||||
PLGMPClientQueue queue;
|
||||
LG_RendererCursor cursorType = LG_CURSOR_COLOR;
|
||||
|
||||
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
||||
@ -307,7 +306,8 @@ static int cursorThread(void * unused)
|
||||
// subscribe to the pointer queue
|
||||
while(g_state.state == APP_STATE_RUNNING)
|
||||
{
|
||||
status = lgmpClientSubscribe(g_state.lgmp, LGMP_Q_POINTER, &queue);
|
||||
status = lgmpClientSubscribe(g_state.lgmp, LGMP_Q_POINTER,
|
||||
&g_state.pointerQueue);
|
||||
if (status == LGMP_OK)
|
||||
break;
|
||||
|
||||
@ -325,7 +325,7 @@ static int cursorThread(void * unused)
|
||||
while(g_state.state == APP_STATE_RUNNING)
|
||||
{
|
||||
LGMPMessage msg;
|
||||
if ((status = lgmpClientProcess(queue, &msg)) != LGMP_OK)
|
||||
if ((status = lgmpClientProcess(g_state.pointerQueue, &msg)) != LGMP_OK)
|
||||
{
|
||||
if (status == LGMP_ERR_QUEUE_EMPTY)
|
||||
{
|
||||
@ -375,7 +375,7 @@ static int cursorThread(void * unused)
|
||||
char buffer[msg.size];
|
||||
memcpy(buffer, msg.mem, msg.size);
|
||||
KVMFRCursor * cursor = (KVMFRCursor *)buffer;
|
||||
lgmpClientMessageDone(queue);
|
||||
lgmpClientMessageDone(g_state.pointerQueue);
|
||||
|
||||
g_cursor.guest.visible =
|
||||
msg.udata & CURSOR_FLAG_VISIBLE;
|
||||
@ -389,7 +389,7 @@ static int cursorThread(void * unused)
|
||||
case CURSOR_TYPE_MASKED_COLOR: cursorType = LG_CURSOR_MASKED_COLOR; break;
|
||||
default:
|
||||
DEBUG_ERROR("Invalid cursor type");
|
||||
lgmpClientMessageDone(queue);
|
||||
lgmpClientMessageDone(g_state.pointerQueue);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ static int cursorThread(void * unused)
|
||||
lgSignalEvent(g_state.frameEvent);
|
||||
}
|
||||
|
||||
lgmpClientUnsubscribe(&queue);
|
||||
lgmpClientUnsubscribe(&g_state.pointerQueue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1137,6 +1137,8 @@ restart:
|
||||
DEBUG_INFO("Host ready, reported version: %s", udata->hostver);
|
||||
DEBUG_INFO("Starting session");
|
||||
|
||||
g_state.kvmfrFeatures = udata->features;
|
||||
|
||||
if (!lgCreateThread("cursorThread", cursorThread, NULL, &t_cursor))
|
||||
{
|
||||
DEBUG_ERROR("cursor create thread failed");
|
||||
|
@ -103,8 +103,8 @@ struct AppState
|
||||
|
||||
struct IVSHMEM shm;
|
||||
PLGMPClient lgmp;
|
||||
PLGMPClientQueue frameQueue;
|
||||
PLGMPClientQueue pointerQueue;
|
||||
KVMFRFeatureFlags kvmfrFeatures;
|
||||
|
||||
LGThread * frameThread;
|
||||
LGEvent * frameEvent;
|
||||
|
Loading…
x
Reference in New Issue
Block a user