diff --git a/host/include/interface/platform.h b/host/include/interface/platform.h index 03df37a3..294a654b 100644 --- a/host/include/interface/platform.h +++ b/host/include/interface/platform.h @@ -44,3 +44,5 @@ const char * os_getDataPath(); void os_showMessage(const char * caption, const char * msg); bool os_blockScreensaver(); +bool os_hasSetCursorPos(void); +void os_setCursorPos(int x, int y); diff --git a/host/platform/Linux/src/platform.c b/host/platform/Linux/src/platform.c index 96aa02ba..12c19891 100644 --- a/host/platform/Linux/src/platform.c +++ b/host/platform/Linux/src/platform.c @@ -86,3 +86,12 @@ void os_showMessage(const char * caption, const char * msg) { DEBUG_INFO("%s: %s", caption, msg); } + +bool os_hasSetCursorPos(void) +{ + return false; +} + +void os_setCursorPos(int x, int y) +{ +} diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index f3854b78..1f736c94 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -573,3 +573,13 @@ void os_showMessage(const char * caption, const char * msg) { MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONINFORMATION); } + +bool os_hasSetCursorPos(void) +{ + return true; +} + +void os_setCursorPos(int x, int y) +{ + SetCursorPos(x, y); +} diff --git a/host/src/app.c b/host/src/app.c index 174ce1cf..93ca6668 100644 --- a/host/src/app.c +++ b/host/src/app.c @@ -147,6 +147,22 @@ static bool lgmpTimer(void * opaque) return false; } + uint8_t data[LGMP_MSGS_SIZE]; + size_t size; + while((status = lgmpHostReadData(app.pointerQueue, &data, &size)) == LGMP_OK) + { + KVMFRMessage *msg = (KVMFRMessage *)data; + switch(msg->type) + { + case KVMFR_MESSAGE_SETCURSORPOS: + { + KVMFRSetCursorPos *sp = (KVMFRSetCursorPos *)msg; + os_setCursorPos(sp->x, sp->y); + break; + } + } + } + return true; } @@ -545,8 +561,9 @@ int app_main(int argc, char * argv[]) DEBUG_INFO("KVMFR Version : %u", KVMFR_VERSION); KVMFR udata = { - .magic = KVMFR_MAGIC, - .version = KVMFR_VERSION, + .magic = KVMFR_MAGIC, + .version = KVMFR_VERSION, + .features = os_hasSetCursorPos() ? KVMFR_FEATURE_SETCURSORPOS : 0 }; strncpy(udata.hostver, BUILD_VERSION, sizeof(udata.hostver)-1); @@ -661,7 +678,7 @@ int app_main(int argc, char * argv[]) LG_LOCK_INIT(app.pointerLock); - if (!lgCreateTimer(100, lgmpTimer, NULL, &app.lgmpTimer)) + if (!lgCreateTimer(10, lgmpTimer, NULL, &app.lgmpTimer)) { DEBUG_ERROR("Failed to create the LGMP timer");