1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-10 12:33:30 +00:00

Updated Windows KVM Cursor rendering, to always remote render the cursor, if the remote user was not the one that last moved the mouse.

This commit is contained in:
Bryan Roe
2020-03-03 13:57:07 -08:00
parent e90fc18f67
commit 9f5df396e8
3 changed files with 23 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ limitations under the License.
extern void ILibAppendStringToDiskEx(char *FileName, char *data, int dataLen);
extern ILibQueue gPendingPackets;
extern int gRemoteMouseRenderDefault;
extern int gRemoteMouseMoved;
uint64_t gMouseInputTime = 0;
HWINEVENTHOOK CUR_HOOK = NULL;
@@ -179,6 +180,7 @@ int KVM_GetCursorHash(HCURSOR hc, char *buffer, size_t bufferLen)
void __stdcall KVM_APCSink(ULONG_PTR user)
{
if (ntohs(((unsigned short*)user)[0]) == MNG_KVM_MOUSE_MOVE) { gRemoteMouseMoved = 0; }
ILibQueue_EnQueue(gPendingPackets, (char*)user);
}
void CALLBACK KVMWinEventProc(

View File

@@ -39,6 +39,7 @@ limitations under the License.
ILibProcessPipe_SpawnTypes gProcessSpawnType = ILibProcessPipe_SpawnTypes_USER;
int gProcessTSID = -1;
extern int gRemoteMouseRenderDefault;
int gRemoteMouseMoved = 0;
#pragma pack(push, 1)
typedef struct KVMDebugLog
@@ -498,6 +499,8 @@ int kvm_server_inputdata(char* block, int blocklen, ILibKVM_WriteHandler writeHa
if (size == 10 || size == 12)
{
gRemoteMouseMoved = 1;
// Get positions and scale correctly
x = (double)ntohs(((short*)(block))[3]) * 1024 / SCALING_FACTOR;
y = (double)ntohs(((short*)(block))[4]) * 1024 / SCALING_FACTOR;
@@ -936,7 +939,24 @@ DWORD WINAPI kvm_server_mainloop_ex(LPVOID parm)
}
ILibMemory_Free(tmoBuffer);
}
if (mouseMove[0] == 0 && (gRemoteMouseRenderDefault != 0 || gRemoteMouseMoved == 0))
{
mouseMove[0] = 1;
CURSORINFO info = { 0 };
info.cbSize = sizeof(info);
GetCursorInfo(&info);
if (SCREEN_SEL_TARGET == 0)
{
mouseMove[1] = info.ptScreenPos.x - VSCREEN_X;
mouseMove[2] = info.ptScreenPos.y - VSCREEN_Y;
}
else
{
mouseMove[1] = info.ptScreenPos.x - SCREEN_X;
mouseMove[2] = info.ptScreenPos.y - SCREEN_Y;
}
}
// Scan the desktop
if (get_desktop_buffer(&desktop, &desktopsize, mouseMove) == 1 || desktop == NULL)

View File

@@ -260,6 +260,7 @@ forceUpdate: If set, will cause the agent to perform a self-update on next st
ignoreProxyFile: If set, will cause the agent to ignore any proxy settings
logUpdate: If set, will cause the agent to log self-update status
jsDebugPort: Specify a JS Debugger Port
remoteMouseRender: If set, will always render the remote mouse cursor for KVM
showModuleNames: If set, will display the name of modules when they are loaded for the first time
slaveKvmLog: [Linux] If set, will enable logging inside the Child KVM Process.
WebProxy: Manually specify proxy configuration