<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Semyon,<div class=""><br class=""></div><div class="">Gentle reminder. Please review the changes.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Manajit</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 14-May-2016, at 2:20 am, Manajit Halder <<a href="mailto:manajit.halder@oracle.com" class="">manajit.halder@oracle.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=windows-1252" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="Menlo" class="">Hi Semyon,</font><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="">The fix is changed a bit because it was observed that the modifier keys plus alphabet keys were not working together. In the modified fix only Num keys are posted by AXUIElementPostKeyboardEvent and remaining keys are posted by CGPostKeyboardEvent/CGEventPost. The fix is explained in the comment in file CRobot.m.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Please review the new changes:</font></div></div><div class=""><font color="#4787ff" face="Menlo" class=""><u class=""><a href="http://cr.openjdk.java.net/~mhalder/8155740/webrev.01/" class="">http://cr.openjdk.java.net/~mhalder/8155740/webrev.01/</a></u></font></div><div class=""><font color="#4787ff" face="Menlo" class=""><u class=""><br class=""></u></font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Answers to your questions:</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font color="#5e30eb" face="Menlo" class="">What is difference between AXUIElementPostKeyboardEvent and CGEventCreateKeyboardEvent?</font></div><div class=""><font face="Menlo" class=""><div class=""><font face="Menlo" class=""><br class=""></font></div>Difference as per the documentation:</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>AXUIElementPostKeyboardEvent is similar to CGPostKeyboardEvent (which synthesizes a low-level 
keyboard event on the local machine), but it allows you to specify the 
target application as opposed to always sending the events to the active
 application. If the system-wide accessibility object is passed in the 
application parameter, the event is sent to the active application. </font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Difference behaviour as per the implementation observed while debugging the code:</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="">AXUIElementPostKeyboardEvent:</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>AXUIElementPostKeyboardEvent posts 0 key code for all the modifier keys with key codes 16, 17,18, 20, 157 and also for newly added modifier key VK_ALT_GRAPH. But it posts correct key code for all the remaining keys.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>While debugging it was that for modifier keys keyDown and keyUp events are not generated, but flagsChanged event (flagsChanged: (NSEvent *)event) is generated. But for all other keys keyDown followed by keyUp events are generated.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">CGEventCreateKeyboardEvent:</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>CGEventCreateKeyboardEvent posts correct key code for all the keys except for numeric keys (numbers 0 to 9 on normal keyboard). CGEventCreateKeyboardEvent posts wrong key codes for the number keys 0 to 9. Instead of posting number key codes it posts Numpad key codes for the corresponding number key. For example Numpad0 key code is posted for number 0, Numpad1 key code is posted for number 1 and simillarly for remaining num keys.</font></div><div class=""><span class="Apple-tab-span" style="white-space:pre"><font face="Menlo" class="">      </font></span></div><div class=""><font color="#5e30eb" face="Menlo" class="">Why the latter was commented? Does it mean that valid modifier keys have not been sent by AWT robot?</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">I didn’t get your question clearly. If you meant why in the current implementation the later part (fix using CGPostKeyboardEvent) of fix was commented.</font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>I am not very sure about it. As per the comment it is only clear that CGPostKeyboardEvent/CGEventPost would have been a better solution and I agree with that, perhaps reason could be related to the difference in behaviour observed while debugging the code as mentioned above.</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Thanks,</font></div><div class=""><font face="Menlo" class="">Manajit</font></div><div class=""><br class=""></div><div class=""><div class=""><blockquote type="cite" class=""><div class="">
  
    <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    Hi Manajit,<br class="">
    <br class="">
    Just a few questions to clarify on the fix.<br class="">
    What is difference between AXUIElementPostKeyboardEvent and
    CGEventCreateKeyboardEvent?<br class=""></div></div></blockquote><span class="Apple-tab-span" style="white-space:pre">  </span><br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    Why the latter was commented? Does it mean that valid modifier keys
    have not been sent by AWT robot?<br class="">
    <br class="">
    --Semyon<br class="">
    <br class="">
    <br class="">
    <div class="moz-cite-prefix">On 5/12/2016 10:45 AM, Manajit Halder
      wrote:<br class="">
    </div>
    <blockquote cite="mid:538F0C0F-2C53-49CD-96B5-F78A794E3177@oracle.com" type="cite" class="">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252" class="">
      <div style="line-height: 16px;" class=""><font class="" size="2" face="Menlo">Hi All,</font></div>
      <div style="line-height: 16px;" class="">
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo">Kindly review the fix for JDK9.</font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><b class="">Bug</b>: </font></div>
        <div class=""><a moz-do-not-send="true" href="https://bugs.openjdk.java.net/browse/JDK-8155740" class=""><font class="" size="2" face="Menlo">https://bugs.openjdk.java.net/browse/JDK-8155740</font></a></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><u class=""><br class="">
            </u></font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><b class="">Webrev</b>: </font></div>
        <div class=""><a moz-do-not-send="true" href="http://cr.openjdk.java.net/%7Emhalder/8155740/webrev.00/" class=""><font class="" size="2" face="Menlo">http://cr.openjdk.java.net/~mhalder/8155740/webrev.00/</font></a></div>
        <div class=""><font class="" size="2" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><b class="">Issue: </b></font></div>
        <div class=""><font class="" size="2" face="Menlo">[macosx]
            robot.keyPress and robot.keyRelease do not generate key
            event for Alt-Graph key VK_ALT_GRAPH.</font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><b class="">Cause: </b></font></div>
        <div class=""><font class="" size="2" face="Menlo">VK_ALT_GRAPH
            is a new key added to the Mac OS X platform and it is not
            mapped to any key on the OS X platform.</font></div>
        <div class=""><font class="" size="2" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><b class="">Fix: </b></font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo">VK_ALT_GRAPH is mapped to right option (<span style="line-height: normal; background-color: rgb(238,
              238, 238);" class="">OSX_RightOption) key on Mac OS X.</span></font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo"><span style="line-height: normal;
              background-color: rgb(238, 238, 238);" class="">Method </span><span style="line-height: normal;" class="">Java_sun_lwawt_macosx_CRobot_keyEvent
              is modified for the following reason:</span></font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo">AXUIElementPostKeyboardEvent posts 0 key code
            for all  the modifier keys with key codes (16, 17,18, 20,
            157) and also for newly added modifier key VK_ALT_GRAPH.</font></div>
        <div class=""><font class="" size="2" face="Menlo">But it posts
            correct key code for all the other keys. On the other hand
            CGEventCreateKeyboardEvent posts correct key code for all
            the modifier keys and </font></div>
        <div class=""><font class="" size="2" face="Menlo">hence it is
            used to post modifier key events and
            AXUIElementPostKeyboardEvent is used to post all the
            remaining key events.</font></div>
        <div class=""><font class="" size="2" face="Menlo"><br class="">
          </font></div>
        <div class=""><font class="" size="2" color="#001e57" face="Menlo">Regards,<br class="">
            Manajit</font></div>
      </div>
    </blockquote>
    <br class="">
  </div>

</div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>