RFR: JDK-8302618: [macOS] Problem typing uppercase letters with java.awt.Robot when moving mouse [v7]
Harshitha Onkar
honkar at openjdk.org
Mon Jul 24 21:46:48 UTC 2023
On Mon, 24 Jul 2023 18:05:32 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> test changes: added CountDownLatch
>
> src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m line 317:
>
>> 315: initFlags = keyPressed
>> 316: ? (initFlags | flagMaskValue) // add flag bits if modifier key pressed
>> 317: : (initFlags & ~flagMaskValue); // clear flag bits if modifier key released
>
> `initFlags` is modified as each event is generated; does it store the *init* flags?
`initFlags` is appended with or cleared off modifier flag bits, as a result `initFlag` value at the beginning and end of the test will remain same.
To make sure only necessary flag bits are modified and we are not introducing new flag bits or clearing out something that is already present or known to the system, the `initFlag` is not used directly in `CGEventSetFlags` but it is copied over to a local `flag` variable as follows which is then used in `CGEventSetFlags` API and post the event.
CGEventFlags flags = CGEventSourceFlagsState(kCGEventSourceStateHIDSystemState);
flags = (initFlags & allModifiersMask) | (flags & (~allModifiersMask));
The second line copies over all the flag bits corresponding to modifier flags (if present in initFlags) and all the bits already present.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14744#discussion_r1272787893
More information about the client-libs-dev
mailing list