From f9894856c47b8b65e4dc1fad62f883c8a3b43300 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 31 May 2026 19:39:44 +0800 Subject: [PATCH 3/3] KeyboardMacOS.mm: fix for 10.5 --- vncviewer/KeyboardMacOS.mm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git vncviewer/KeyboardMacOS.mm vncviewer/KeyboardMacOS.mm index 599612ec..1f84f529 100644 --- vncviewer/KeyboardMacOS.mm +++ vncviewer/KeyboardMacOS.mm @@ -29,9 +29,18 @@ #include #include +#include + +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#define kIOHIDCapsLockState 0 +#define kIOHIDNumLockState 1 +static inline kern_return_t IOHIDGetModifierLockState(io_connect_t, int, bool*) { return KERN_FAILURE; } +static inline kern_return_t IOHIDSetModifierLockState(io_connect_t, int, bool) { return KERN_FAILURE; } +#define TIGERVNC_NO_IOHID_MODIFIER_LOCK_STATE +#endif // This wasn't added until 10.12 -#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 const int kVK_RightCommand = 0x36; #endif // And this is still missing @@ -260,6 +269,9 @@ std::list KeyboardMacOS::translateToKeySyms(int systemKeyCode) unsigned KeyboardMacOS::getLEDState() { +#ifdef TIGERVNC_NO_IOHID_MODIFIER_LOCK_STATE + return rfb::ledUnknown; +#else unsigned state; int ret; bool on; @@ -285,10 +297,15 @@ unsigned KeyboardMacOS::getLEDState() // No support for Scroll Lock // return state; +#endif } void KeyboardMacOS::setLEDState(unsigned state) { +#ifdef TIGERVNC_NO_IOHID_MODIFIER_LOCK_STATE + (void)state; + return; +#else int ret; ret = setModifierLockState(kIOHIDCapsLockState, state & rfb::ledCapsLock); @@ -304,6 +321,7 @@ void KeyboardMacOS::setLEDState(unsigned state) } // No support for Scroll Lock // +#endif } bool KeyboardMacOS::isKeyboardEvent(const NSEvent* nsevent) -- 2.54.0