diff --git a/client/src/core.c b/client/src/core.c index b6fa8d39..ab51a6ad 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -408,7 +408,6 @@ void core_handleMouseNormal(double ex, double ey) /* if we have been instructed to realign */ if (g_cursor.realign) { - g_cursor.realign = false; struct DoublePoint guest; util_localCurToGuest(&guest); @@ -416,11 +415,33 @@ void core_handleMouseNormal(double ex, double ey) { const KVMFRSetCursorPos msg = { .msg.type = KVMFR_MESSAGE_SETCURSORPOS, - .x = guest.x, - .y = guest.y + .x = round(guest.x), + .y = round(guest.y) }; - lgmpClientSendData(g_state.pointerQueue, &msg, sizeof(msg), NULL); + uint32_t setPosSerial; + if (lgmpClientSendData(g_state.pointerQueue, + &msg, sizeof(msg), &setPosSerial) == LGMP_OK) + { + /* wait for the move request to be processed */ + do + { + uint32_t hostSerial; + if (lgmpClientGetSerial(g_state.pointerQueue, &hostSerial) != LGMP_OK) + return; + + if (hostSerial >= setPosSerial) + break; + + g_state.ds->wait(1); + } + while(app_isRunning()); + + g_cursor.guest.x = msg.x; + g_cursor.guest.y = msg.y; + g_cursor.realign = false; + return; + } } else { @@ -429,6 +450,8 @@ void core_handleMouseNormal(double ex, double ey) ey += guest.y - (g_cursor.guest.y + g_cursor.guest.hy); } + g_cursor.realign = false; + /* don't test for an exit as we just entered, we can get into a enter/exit * loop otherwise */ testExit = false;