On Wed, 20 Apr 2022 17:04:09 GMT, Alexander Zuev <kiz...@openjdk.org> wrote:

> Clear the kCGEventFlagMaskSecondaryFn flag if it is set before posting 
> keyboard events to the system queue.

Just a note - with the proposed fix, some generated events will be different 
from those generated by a real keyboard - namely events for arrow keys and 
F1-F12 keys, as those have 'inherent' Fn modifier set, regardless of whether Fn 
key was pressed during event generation. This won't be observable from Java 
applications, as Java APIs don't expose Fn modifier in `KeyEvent`-s, but can 
theoretically make some difference when interacting with other apps (I don't 
know about any problematic cases currently though). If this can be considered a 
problem, it's possible to improve the fix by not clearing Fn flag for key 
events 'inherently' having that Fn modifier. Simple approach might just 
hard-code them, and a more robust one (but a bit more complicated as well) can 
determine the set of affected keycodes on Robot startup, by examining flags set 
by `CGEventCreateKeyboardEvent` in a 'clear' event source state.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8320

Reply via email to