On Mon, 10 Jul 2023 16:41:47 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> At this point I don't have a strong opinion on whether this field is private >> or not. Originally I wanted it to be private because I thought of it as >> "whatever magic value makes KeyCharacterCombinations work" and was concerned >> we might want to tweak that over time. That's less of a concern now that >> I've prototyped the implementation on three different platforms. >> >> This is largely a policy issue that's above my pay grade. This is an >> intrinsically platform-specific bit of information we would be exposing to >> developers. > > Are we going to create side effects when KeyEvents are synthesized? See, for > instance, EmbeddedScene:366 or FXVKSkin:860 (and possibly other places)? A KeyEvent that doesn’t originate from Glass will not have a hardwareCode but will have a KeyCode. When matching it against a char combo the platform can just invoke the old getKeyCodeForChar logic and compare the result against the KeyEvent’s KeyCode. This is the same test that used to happen in the Java core so there should be no change in behavior. Unfortunately the current behavior is all over the map. On the Mac KeyCharacterCombinations don’t work when JavaFX is embedded in a JFXPanel (long story). On Windows and Linux they do work. I could make char combos work on the Mac but that would just lead to other bugs because AWT on the Mac does a poor job of assigning KeyCodes for punctuation and symbol keys. I will take a look at the VKFX skin but I also doubt it assigns KeyCodes “correctly” for char combos, it just doesn’t have enough information to do the job right. (In general we should only match KeyCharacterCombinations against KeyEvents that Glass generates. Otherwise we’re depending on the creator of the KeyEvent to assign the same code that Glass would assign to that key. That’s a tall order.) So there’s nothing in this PR that would make matters worse but given the current behavior I don’t know how to write tests to ensure that. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1126#discussion_r1261673784