From d839a45d0b819a9c7e91340f2bcee83073bdb0a2 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 28 Mar 2025 16:38:02 +1100 Subject: [PATCH] [client] kvmfr: report the local window size to the VM --- client/src/core.c | 15 +++++++++++++++ common/include/common/KVMFR.h | 13 +++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/client/src/core.c b/client/src/core.c index 0cb4bde6..86ffed7f 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -190,6 +190,21 @@ bool core_warpPointer(int x, int y, bool exiting) void core_updatePositionInfo(void) { + if (g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE) + { + const KVMFRWindowSize msg = { + .msg.type = KVMFR_MESSAGE_WINDOWSIZE, + .w = g_state.windowW, + .h = g_state.windowH + }; + + uint32_t serial; + LGMP_STATUS status; + if ((status = lgmpClientSendData(g_state.pointerQueue, + &msg, sizeof(msg), &serial)) != LGMP_OK) + DEBUG_WARN("Message send failed: %s", lgmpStatusString(status)); + } + if (!g_state.haveSrcSize) goto done; diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index 8e18e5b7..16ef0343 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -56,14 +56,16 @@ typedef uint32_t KVMFRCursorFlags; enum { - KVMFR_FEATURE_SETCURSORPOS = 0x1 + KVMFR_FEATURE_SETCURSORPOS = 0x1, + KVMFR_FEATURE_WINDOWSIZE = 0x2 }; typedef uint32_t KVMFRFeatureFlags; enum { - KVMFR_MESSAGE_SETCURSORPOS + KVMFR_MESSAGE_SETCURSORPOS, + KVMFR_MESSAGE_WINDOWSIZE }; typedef uint32_t KVMFRMessageType; @@ -176,6 +178,13 @@ typedef struct KVMFRSetCursorPos } KVMFRSetCursorPos; +typedef struct KVMFRWindowSize +{ + KVMFRMessage msg; + uint32_t w, h; +} +KVMFRWindowSize; + #ifdef _MSC_VER #pragma warning(pop) #endif