Hot Door CORE Forum

Full Version: why no addKeyDownMonitor() callback response?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What kinds of things can cause keydown monitors to become unresponsive? (I blame macOS)

I often add keydown monitors to my tools, and generally it's worked well to add them on the tool's mouseDown event, respond to the keydown's callback during a drag, then remove the keydown monitor on mouseUp so that keystrokes aren't stolen from other plugins or from AI itself.


Code:
this->key5pressID = this->__corePlug->dispatcher()->addKeyDownMonitor(hdi::core::Dispatcher::LD_5Key, HDI_CORE_CALLBACK(panel::Plugin, this, __key5downCB));

--> callback changes a variable if the 5 key is pressed

Code:
this->__corePlug->dispatcher()->removeKeyDownMonitor(this->key5pressID);

I can verify that the monitors are added and removed when they should be, but sometimes all of them in all of my CORE plugins become unresponsive -- not just slow, but they stop responding altogether. Regular modifier keys, however, can still be detected directly through the tool with no problem. I don't know about Windows, but it's happening in all versions of AI in macOS Ventura, possibly more often in recent updates. It was never a problem in macOS Big Sur and earlier.

I don't see a counterpart to CORE's keydown monitors in the SDK, so'll ask here rather than on an Adobe forum.
I suspect that recent updates to macOS Ventura have blocked those key presses. I have added Adobe Illustrator to the list of applications in System Settings > Privacy & Security > Input Monitoring. Is there another setting I can check? Or maybe it's a macOS bug? But then, alphanumeric keys are still sensed for Adobe's Curve and Spiral tools.

Using CGEventSourceKeyState to manually get the key states is proving difficult outside of a typical Mac app, but I suspect that's what CORE already uses, so I'd end up with the same result. :-/