From bced5f95ffebe9369c77c20b96ca1da316e32f14 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 27 Jan 2020 02:07:32 +1100 Subject: [PATCH] [all] make cursor visible a flag and send it seperate to position --- VERSION | 2 +- .../platform/Windows/capture/DXGI/src/dxgi.c | 18 ++++++++++-------- c-host/src/app.c | 8 +++++--- client/src/main.c | 4 +++- common/include/common/KVMFR.h | 4 ++-- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/VERSION b/VERSION index d20cc74e..0f3f42b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-115-gfea0a98b9e+1 \ No newline at end of file +B1-116-g9d7f773b9c+1 \ No newline at end of file diff --git a/c-host/platform/Windows/capture/DXGI/src/dxgi.c b/c-host/platform/Windows/capture/DXGI/src/dxgi.c index 1b8126fd..6e5cf89a 100644 --- a/c-host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/c-host/platform/Windows/capture/DXGI/src/dxgi.c @@ -710,19 +710,21 @@ static CaptureResult dxgi_capture() frameInfo.PointerPosition.Visible != this->lastPointerVisible ) { - pointer.positionUpdate = true; - /* the pointer position is invalid if the pointer is not visible */ if (frameInfo.PointerPosition.Visible) { - this->lastPointerX = frameInfo.PointerPosition.Position.x; - this->lastPointerY = frameInfo.PointerPosition.Position.y; + pointer.positionUpdate = true; + pointer.x = + this->lastPointerX = + frameInfo.PointerPosition.Position.x; + pointer.y = + this->lastPointerY = + frameInfo.PointerPosition.Position.y; } - this->lastPointerVisible = frameInfo.PointerPosition.Visible; - pointer.x = this->lastPointerX; - pointer.y = this->lastPointerY; - pointer.visible = this->lastPointerVisible; + pointer.visible = + this->lastPointerVisible = + frameInfo.PointerPosition.Visible; postPointer = true; } } diff --git a/c-host/src/app.c b/c-host/src/app.c index c68f00e7..26e89c30 100644 --- a/c-host/src/app.c +++ b/c-host/src/app.c @@ -325,11 +325,13 @@ void capturePostPointerBuffer(CapturePointer pointer) if (pointer.positionUpdate) { flags |= CURSOR_FLAG_POSITION; - cursor->x = pointer.x; - cursor->y = pointer.y; - cursor->visible = pointer.visible; + cursor->x = pointer.x; + cursor->y = pointer.y; } + if (pointer.visible) + flags |= CURSOR_FLAG_VISIBLE; + if (pointer.shapeUpdate) { // remember which slot has the latest shape diff --git a/client/src/main.c b/client/src/main.c index f3983550..64ae2d28 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -300,11 +300,13 @@ static int cursorThread(void * unused) KVMFRCursor * cursor = (KVMFRCursor *)msg.mem; + state.cursorVisible = + msg.udata & CURSOR_FLAG_VISIBLE; + if (msg.udata & CURSOR_FLAG_POSITION) { state.cursor.x = cursor->x; state.cursor.y = cursor->y; - state.cursorVisible = cursor->visible; state.haveCursorPos = true; if (!state.haveAligned && state.haveSrcSize && state.haveCurLocal) diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index b5a92dc8..ab9a24a7 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -37,7 +37,8 @@ FrameType; enum { CURSOR_FLAG_POSITION = 0x1, - CURSOR_FLAG_SHAPE = 0x2 + CURSOR_FLAG_VISIBLE = 0x2, + CURSOR_FLAG_SHAPE = 0x4 }; typedef uint32_t KVMFRCursorFlags; @@ -52,7 +53,6 @@ CursorType; typedef struct KVMFRCursor { int16_t x, y; // cursor x & y position - bool visible; // cursor visible CursorType type; // shape buffer data type uint32_t width; // width of the shape uint32_t height; // height of the shape