Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089894

Mac: key codes for non-US English keyboard layouts may be incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8
    • javafx
    • None
    • Mac

      This is a follow-up for a MS Windows-specific bug RT-32300. Note that the AWT/Swing in JDK suffer from the same bug as well.

      The keys corresponding to Window's VK_OEM_1 ... VK_OEM_7 ( ;: + , - . /? `~ [{ \| }] '" ) always generate the following key codes on Mac:

              case 0x29:
              case 0x18:
              case 0x2B:
              case 0x1B:
              case 0x2F:
              case 0x2C:
              case 0x32:
              case 0x21:
              case 0x2A:
              case 0x1E:
              case 0x27:

      Note that I was unable to find keys that would generate the VK_OEM_8 and VK_OEM_102 on my keyboard.

      The value of the characters: property depends on the key and the event:

      1. For regular keys it contains the actual character for the current keyboard layout. E.g. it is the + character for the }] key when the German layout is active.

      2. For dead keys: the keyDown: provides an empty characters: array. The keyUp:, however, gives the symbolic representation of the dead key released.

      Another issue is that, for example, in German layout the Z and Y keys are switched. The characters: for both keyDown: and keyUp: provides the correct values, but the keyCode is wrong when the German layout is active (it reports the Z keyCode for the key that generates the 'Y' character).

            mfox Martin Fox
            anthony Anthony Petrov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: