<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">Hi All,</font></span><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">Kindly review the fix for JDK9.</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><b class="">Bug</b>: </font></div><div class="" style="background-color: rgb(255, 255, 255);"><a href="https://bugs.openjdk.java.net/browse/JDK-8149456" class=""><font face="Menlo" class="">https://bugs.openjdk.java.net/browse/JDK-8149456</font></a></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><b class="">Webrev</b>: </font></div><div class="" style="background-color: rgb(255, 255, 255);"><font color="rgba(0, 0, 0, 0)" class=""><span class="" style="text-rendering: optimizelegibility;"><font color="#800080" face="Menlo" class=""><a href="http://cr.openjdk.java.net/~arapte/manajit/8149456/webrev.00/" class="">http://cr.openjdk.java.net/~arapte/manajit/8149456/webrev.00/</a></font></span></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><b class="">Issue</b>: </font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>[macosx] robot.keyPress do not generate key events (keyPressed and keyReleased) for function keys F13 to F19.</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><b class="">Cause</b>: </font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>robot.keyPress(keyCode) passes java key code for the particular key pressed to native side (MacOS X). On the MacOS corresponding key code matched and returned to java side. But as per the current implementation keys with java key code below 222 returns a valid key code form MacOS X and for all java key codes above 222 MacOS don’t have any valid key code to return and it returns a default value 127 (undefined) for all of them including  function keys F13 to F20. The java key codes for keys F13 to F19 is in range 61440 to 61447.</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><b class="">Fix</b>: </font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>Create a dictionary of java keys and OS X keys with:</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">           </span>key: java key</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">          </span>value: OS X key</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">Use the macros defined as macros in header java_awt_event_KeyEvent.h for java keys</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">Define integer constants for OS X keys as shown below:</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">const static int OSX_kVK_ANSI_A                  = 0x00;</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">const static int OSX_kVK_ANSI_S                  = 0x01;</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">const static int OSX_kVK_ANSI_D                  = 0x02;</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">const static int OSX_kVK_ANSI_F                  = 0x03;</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><b class=""><font face="Menlo" class="">Problem in modifying/extending current fix:</font></b></div><div class="" style="background-color: rgb(255, 255, 255);"><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>Why the current fix can’t be extended/modified to support keys F13 to F20.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">1) The current fix creates an array with array index as java key and array value as corresponding OS X key.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>static const unsigned char javaToMacKeyCode[] = {</font></div><div class=""><font face="Menlo" class="">    127,    //     0     0 VK_UNDEFINED                      No_Equivalent</font></div><div class=""><font face="Menlo" class="">    127,    //     1   0x1 Not_Used</font></div><div class=""><font face="Menlo" class="">    127,    //     2   0x2 Not_Used</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Here 0, 1 and 2 are the java keys and 127, 127 and 127 are the corresponding key values in OS X for the same key.</font></div><div class=""><font face="Menlo" class="">The array can’t be modified to add support for F13 to F20 because their corresponding values are 61440 to 61447.</font></div><div class=""><font face="Menlo" class="">It won’t be a good solution to extended the array with index 61440 to 61447.</font></div><div class=""><span class="Apple-tab-span" style="white-space:pre"><font face="Menlo" class="">                </font></span></div><div class=""><font face="Menlo" class="">2) The current fix creates an array using a pearl script. The pearl script uses hardcoded values of java keys and OS X keys. </font></div><div class=""><font face="Menlo" class="">Also the Pearl script is not checked in to the java codebase.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">3) The current fix not modifiable and not readable.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><b class=""><font face="Menlo" class="">Time comparisons between with and without fix in milliseconds:</font></b></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-weight: bold; white-space: pre;">       </span>The time comparison is done by taking the time diff in milliseconds before and after calling robot keypress for all the keys using the test code written for the fix.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>Time diff taken for 5 test runs:</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>With fix: <span class="Apple-tab-span" style="white-space:pre">  </span>1658, 1698, 1705, 1453 and 1516</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Without fix:       <span class="Apple-tab-span" style="white-space:pre"> </span>1523, 1579, 1690, 1648 and 1504</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><b class=""><font face="Menlo" class="">Note:</font></b></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-weight: bold; white-space: pre;">   </span>The following java keys are not matched in the current fix because of the following reasons:</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">         </span>1) They are already matched with their corresponding keys on Mac OS.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">         </span>2) There are no defined keys on Mac OS with the same functionality for PRINTSCREEN, SCROLL LOCK and PAUSE.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">           </span>3) The following java keys are not defined in keyTable in AWTEvent.m file.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">         </span>java_awt_event_KeyEvent_VK_PRINTSCREEN</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">               </span>java_awt_event_KeyEvent_VK_SCROLL_LOCK </font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">         </span>java_awt_event_KeyEvent_VK_PAUSE</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space: pre;">   </span>In the previous fix these keys were matched to OSX_F14, OSX_F13 and OSX_F15 respectively.</font></div></div></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class="">Regards,<br class="">Manajit</font></div><div class="" style="background-color: rgb(255, 255, 255);"><font face="Menlo" class=""><br class=""></font></div></body></html>