From 67c907b22cef605e94a7990ddc02c010df09ff61 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Fri, 20 Sep 2019 17:08:14 -0700 Subject: [PATCH] Updated Mouse Cursor Capture, to process NULL Atoms --- meshcore/KVM/Linux/linux_kvm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/meshcore/KVM/Linux/linux_kvm.c b/meshcore/KVM/Linux/linux_kvm.c index 12c3c9d..ddd0419 100644 --- a/meshcore/KVM/Linux/linux_kvm.c +++ b/meshcore/KVM/Linux/linux_kvm.c @@ -699,26 +699,26 @@ void* kvm_server_mainloop(void* parm) x11_exports->XNextEvent(cursordisplay, &XE); if (XE.type == (event_base + 1)) { + char buffer[8]; + Atom cursor_atom = NULL; if (sizeof(void*) == 8) { // 64bit - if (((uint64_t*)((char*)&XE + 64))[0] == 0) + if (((uint64_t*)((char*)&XE + 64))[0] != 0) { - continue; // Atom is NULL + cursor_atom = ((Atom*)((char*)&XE + 64))[0]; } } else { // 32bit - if (((uint32_t*)((char*)&XE + 32))[0] == 0) + if (((uint32_t*)((char*)&XE + 32))[0] != 0) { - continue; // Atom is NULL + cursor_atom = ((Atom*)((char*)&XE + 32))[0]; } } - - char buffer[8]; - Atom cursor_atom = ((Atom*)((char*)&XE + (sizeof(void*) == 8 ? 64 : 32)))[0]; - char *name = x11_exports->XGetAtomName(cursordisplay, cursor_atom); + + char *name = cursor_atom != NULL ? (x11_exports->XGetAtomName(cursordisplay, cursor_atom)) : NULL; int curcursor = KVM_MouseCursor_HELP; if (name != NULL)