mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[c-host] use the correct buffer for the cursor shape
This commit is contained in:
parent
b0fb7177bb
commit
7a98a886b6
@ -261,6 +261,7 @@ bool captureGetPointerBuffer(void ** data, uint32_t * size)
|
|||||||
// spin until there is room
|
// spin until there is room
|
||||||
while(lgmpHostQueuePending(app.pointerQueue) == LGMP_Q_POINTER_LEN)
|
while(lgmpHostQueuePending(app.pointerQueue) == LGMP_Q_POINTER_LEN)
|
||||||
{
|
{
|
||||||
|
DEBUG_INFO("pending");
|
||||||
if (!app.running)
|
if (!app.running)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -273,19 +274,12 @@ bool captureGetPointerBuffer(void ** data, uint32_t * size)
|
|||||||
|
|
||||||
void capturePostPointerBuffer(CapturePointer pointer)
|
void capturePostPointerBuffer(CapturePointer pointer)
|
||||||
{
|
{
|
||||||
// spin until there is room
|
|
||||||
while(lgmpHostQueuePending(app.pointerQueue) == LGMP_Q_POINTER_LEN)
|
|
||||||
{
|
|
||||||
if (!app.running)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PLGMPMemory mem;
|
PLGMPMemory mem;
|
||||||
const bool newClient = lgmpHostNewSubCount(app.pointerQueue) > 0;
|
const bool newClient = lgmpHostNewSubCount(app.pointerQueue) > 0;
|
||||||
|
|
||||||
if (pointer.shapeUpdate || newClient)
|
if (pointer.shapeUpdate || newClient)
|
||||||
{
|
{
|
||||||
if (!newClient)
|
if (pointer.shapeUpdate)
|
||||||
{
|
{
|
||||||
// swap the latest shape buffer out of rotation
|
// swap the latest shape buffer out of rotation
|
||||||
PLGMPMemory tmp = app.pointerShape;
|
PLGMPMemory tmp = app.pointerShape;
|
||||||
@ -297,7 +291,11 @@ void capturePostPointerBuffer(CapturePointer pointer)
|
|||||||
mem = app.pointerShape;
|
mem = app.pointerShape;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
mem = app.pointerMemory[app.pointerIndex];
|
mem = app.pointerMemory[app.pointerIndex];
|
||||||
|
if (++app.pointerIndex == LGMP_Q_POINTER_LEN)
|
||||||
|
app.pointerIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
KVMFRCursor *cursor = lgmpHostMemPtr(mem);
|
KVMFRCursor *cursor = lgmpHostMemPtr(mem);
|
||||||
cursor->x = pointer.x;
|
cursor->x = pointer.x;
|
||||||
@ -324,17 +322,18 @@ void capturePostPointerBuffer(CapturePointer pointer)
|
|||||||
app.pointerShapeValid = true;
|
app.pointerShapeValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool sendShape = (pointer.shapeUpdate || newClient) && app.pointerShapeValid;
|
const uint32_t sendShape =
|
||||||
|
((pointer.shapeUpdate || newClient) && app.pointerShapeValid) ? 1 : 0;
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
if ((status = lgmpHostPost(app.pointerQueue, sendShape ? 1 : 0, mem)) != LGMP_OK)
|
while ((status = lgmpHostPost(app.pointerQueue, sendShape, mem)) != LGMP_OK)
|
||||||
{
|
{
|
||||||
|
if (status == LGMP_ERR_QUEUE_FULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
DEBUG_ERROR("lgmpHostPost Failed (Pointer): %s", lgmpStatusString(status));
|
DEBUG_ERROR("lgmpHostPost Failed (Pointer): %s", lgmpStatusString(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++app.pointerIndex == LGMP_Q_POINTER_LEN)
|
|
||||||
app.pointerIndex = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is called from the platform specific startup routine
|
// this is called from the platform specific startup routine
|
||||||
|
Loading…
Reference in New Issue
Block a user