<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 11/5/18 8:51 AM, Ambarish Rapte
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:6646bbab-b2ef-4699-ba30-d4f0aa748170@default">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:892616096;
        mso-list-type:hybrid;
        mso-list-template-ids:1990760098 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:976909916;
        mso-list-type:hybrid;
        mso-list-template-ids:-1815160992 67698703 67698689 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2
        {mso-list-id:1093355499;
        mso-list-type:hybrid;
        mso-list-template-ids:-800447746 67698713 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l2:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l3
        {mso-list-id:1424912694;
        mso-list-type:hybrid;
        mso-list-template-ids:-1254033006 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l3:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l3:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l3:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l3:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l4
        {mso-list-id:1787850064;
        mso-list-type:hybrid;
        mso-list-template-ids:-2001858808 1250705206 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l4:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0F0;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l4:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l4:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l4:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l4:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l4:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l4:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l4:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l4:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l5
        {mso-list-id:1842550224;
        mso-list-type:hybrid;
        mso-list-template-ids:1870430728 -1346468084 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l5:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l5:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l5:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l5:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif][if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:windowtext">Hi Phil,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">The little abstraction or lack of
            clarity in documentation is leading us to make some
            assumptions.<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Just trying to connect the pieces,<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">I referred these two doc pages to
            learn LOWORD behavior:<o:p></o:p></span></p>
        <ol style="margin-top:0in" start="1" type="a">
          <li class="MsoListParagraph"
            style="color:windowtext;margin-left:0in;mso-list:l2 level1
            lfo5">LOWORD : <a
href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms632659%28v=vs.85%29.aspx"
              moz-do-not-send="true">https://msdn.microsoft.com/en-us/library/windows/desktop/ms632659(v=vs.85).aspx</a><o:p></o:p></li>
          <li class="MsoListParagraph"
            style="color:windowtext;margin-left:0in;mso-list:l2 level1
            lfo5">WORD : <a
href="https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types"
              moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types</a><o:p></o:p></li>
        </ol>
        <p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.25in"><span
            style="color:windowtext">And the documentation of </span><span
            style="color:windowtext">LB_ITEMFROMPOINT does not mention
            LB_ERR(-1)</span><span style="color:windowtext"><o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="text-indent: 0.25in;"><span
            style="color: windowtext;">Based on these documentation, it
            looks safe to conclude that LOWORD would be positive.</span></p>
      </div>
    </blockquote>
    <br>
    I don't think so. I already pointed out that it is apparently
    returning -1 in your test<br>
    when HIWORD is 1. I am pretty sure it isn't expecting you to
    interpret 0xFFFF stored<br>
    in 16 bits as positive.<br>
    <br>
    <blockquote type="cite"
      cite="mid:6646bbab-b2ef-4699-ba30-d4f0aa748170@default">
      <div class="WordSection1">
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in">Issue #1 :<span
            style="color:windowtext"><o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in">Yes, the HIWORD
          is 1, when the mouse is clicked inside the list’s client area
          but not on the item.<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in">Once we separate
          the HIWORD and LOWORD, LOWORD gives correct index of the last
          item, and this issue gets solved.<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in">Checking if
          HIWORD is 1 can be additional check. But as we extract correct
          index, this check can be ignored for allowing selection.<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in">Or the other way,
          we can use HIWORD to avoid selection/deselection when it is 1.<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in"><o:p> </o:p></p>
        <p class="MsoNormal" style="text-indent:.25in">Additionally, The
          behavior on Ubuntu and mac is different,<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in">Ubuntu: Last item
          does not get selected & it also does not select any other
          item. User must click on the item to select or deselect.<o:p></o:p></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Mac: Selects the last item<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Windows: Focused item gets selected
            / deselected on multiple clicks, 3-4<o:p></o:p></span></p>
        <ul style="margin-top:0in" type="disc">
          <li class="MsoListParagraph"
            style="color:windowtext;margin-left:0in;mso-list:l4 level1
            lfo6">After this fix[Allowing selection], Mac and Windows
            will have same behavior.</li>
        </ul>
      </div>
    </blockquote>
    <br>
    These are platform UI components. They can behave differently w.r.t
    things like<br>
    how they respond to mouse clicks, all dependent on what the platform
    norms are.<br>
    I see no reason to go out of our way to "make windows mouse clicks
    behave like mac".<br>
    <br>
    <br>
    <blockquote type="cite"
      cite="mid:6646bbab-b2ef-4699-ba30-d4f0aa748170@default">
      <div class="WordSection1">
        <ul style="margin-top:0in" type="disc">
          <li class="MsoListParagraph"
            style="color:windowtext;margin-left:0in;mso-list:l4 level1
            lfo6"><o:p></o:p><br>
          </li>
        </ul>
        <p class="MsoNormal" style="text-indent:.25in"><o:p> </o:p></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Issue #2 :<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">This looks a very corner case of
            list of size more than 65535 size, but the item selection
            and deselection works fine with keyboard.<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Also List behaves correctly on
            Ubuntu and Mac.<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">Just for a look, I am including a
            fix for this issue in webrev.03: <a
              href="http://cr.openjdk.java.net/%7Earapte/8198000/webrev.03/"
              moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/webrev.03/</a>
            <o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext">As you have already mentioned we
            should not really change a long running behavior, but I
            could not hold on from suggestion. <o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent: 0.25in;"><span
            style="color: windowtext;">If you think this fix is not
            needed, I shall just change/remove it.</span></p>
      </div>
    </blockquote>
    <br>
    Not understanding you. How can you tell if 0x0001 is supposed to be
    "1" or "65536" ?<br>
    <br>
    I also don't like std::pow .. it is unnecessary here.<br>
    <br>
    Not withstanding the lack of clarity on how you are claiming to know
    that,<br>
    I was expecting a fix to look more like<br>
    <br>
    <meta http-equiv="content-type" content="text/html;
      charset=windows-1252">
    <pre><span class="new">        LONG count = GetCount();</span>
<span class="new">        if (count > 0) {</span>
         LONG item = static_cast<LONG>(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam));           
         if (HIWORD(item) == 0) {
            item = LOWORD(item);
            if (item > 0 && item < GetCount()) {
              ...
     
So if the user clicks outside we do nothing. What is wrong with that ?

-phil.
</pre>
    <br>
    <br>
    <blockquote type="cite"
      cite="mid:6646bbab-b2ef-4699-ba30-d4f0aa748170@default">
      <div class="WordSection1">
        <p class="MsoNormal" style="text-indent:.25in"><span
            style="color:windowtext"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext">Regards,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext">Ambarish<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
                style="color:windowtext"> Philip Race <br>
                <b>Sent:</b> Saturday, November 03, 2018 10:59 PM<br>
                <b>To:</b> Ambarish Rapte <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:ambarish.rapte@oracle.com"><ambarish.rapte@oracle.com></a><br>
                <b>Cc:</b> <a class="moz-txt-link-abbreviated"
                  href="mailto:awt-dev@openjdk.java.net">awt-dev@openjdk.java.net</a><br>
                <b>Subject:</b> Re: <AWT Dev> [12] RFR :
                JDK-8198000 :
                java/awt/List/EmptyListEventTest/EmptyListEventTest.java
                debug assert on Windows<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">- I am not sure you can assume the LOWORD
          value is non-negative.<br>
             It seems to me that the 0XFFFF we got back is meant to be
          interpreted as "-1"<br>
             which is what I wrote below.<br>
             I do note that it appears that in issue #2 you are seeing
          that up to 65534 items<br>
             may be allowed and it wraps if you add more than 65535 .. <br>
             So *perhaps* we can interpret 0xFFFF as meaning positive
          65535 but I think<br>
             *only* if HIWORD is "0".<br>
          <br>
          - Issue #1 : I am not sure that a "1" in HIWORD automatically
          means it is off the<br>
          end of the list ... just "outside the client area". I think if
          HIWORD is 1 we just<br>
          bail don't we ? <br>
            Then you don't have to worry about whether 0xFFFF meant -1
          or 65536<br>
          <br>
          - Issue #2 : There is always *some* limit in cases like this.
          32767 (2^15-1) or 65535 (2^16-1)<br>
          are very typical in these platform APIs. Often the platform
          doesn't explicitly document it<br>
          and you have to infer it from the data type. I think it was
          all very moot when these APIs<br>
          were designed because you'd run out of memory before you could
          get that many items :-)<br>
          I'd be surprised if there were not already some open bug
          pointing out that we accept "int"<br>
          for index and don't have any feedback when exceeding platform
          limits.<br>
          From a compatibility point of view, I don't think it is worth
          doing anything that would<br>
          break ancient applications to provide that feedback. <br>
          <br>
          -phil.<br>
          <br>
          <br>
          <br>
          On 11/2/18, 10:23 AM, Ambarish Rapte wrote: <o:p></o:p></p>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span style="color:windowtext">Hi Phil,</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  Thanks
              for guiding with the documentation.</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  The fix
              is modified after a relook at the documentation, and
              observed two issues [mentioned below].</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  webrev:
              <a
                href="http://cr.openjdk.java.net/%7Earapte/8198000/webrev.02"
                moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/webrev.02</a>
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">Fix
              Justification:</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> 
              LB_ITEMFROMPOINT documentation(<a
href="https://docs.microsoft.com/en-us/windows/desktop/controls/lb-itemfrompoint"
                moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/desktop/controls/lb-itemfrompoint</a>):</span><o:p></o:p></p>
          <ol style="margin-top:0in" start="1" type="1">
            <li class="MsoNormal" style="color:windowtext;mso-list:l1
              level1 lfo1">Message LB_ITEMFROMPOINT returns a LONG
              value.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l1
              level1 lfo1">There is no mention of LB_ERR as return
              value, like it is mentioned clearly for some of the other
              messages as LB_GETCOUNT, LB_SETITEMHEIGHT, LB_GETTEXT,
              LB_GETCURSEL.<o:p></o:p></li>
          </ol>
          <ol style="margin-top:0in" start="2" type="1">
            <ul style="margin-top:0in" type="disc">
              <li class="MsoNormal" style="color:windowtext;mso-list:l1
                level2 lfo1"><span style="color:black">So</span> the
                existing comparison against LB_ERR is incorrect.<o:p></o:p></li>
            </ul>
          </ol>
          <ol style="margin-top:0in" start="3" type="1">
            <li class="MsoNormal" style="color:windowtext;mso-list:l1
              level1 lfo1">The two parts LOWORD and HIWORD of return
              value are of type WORD(unsigned short), so the return
              value can never be negative.<o:p></o:p></li>
          </ol>
          <ol style="margin-top:0in" start="3" type="1">
            <ul style="margin-top:0in" type="disc">
              <li class="MsoNormal" style="color:windowtext;mso-list:l1
                level2 lfo1">It is another reason to not to compare the
                returned index value with LB_ERR which is defined as
                (-1).<o:p></o:p></li>
            </ul>
          </ol>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">Fix: </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  Extract
              the index from LOWORD into a WORD variable and verify only
              if the index is smaller than the list size. (webrev.02)</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  This
              fixes both JDK-8198000 & below mentioned Issue 1. </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">2 other
              Issues:</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  Issue 1:
              NON selection of an item.</span><o:p></o:p></p>
          <ol style="margin-top:0in" start="1" type="1">
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">Currently the returned LONG value is used
              without extracting the LOWORD.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">As far as the HIWORD is 0, the LONG return
              value would be same as index of item(LOWORD).<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">But when HIWORD is 1, the LONG return value
              would be a large unexpected value. If it is used as an
              index, then it would result in NON selection of the item.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">Test program: <a
                href="http://cr.openjdk.java.net/%7Earapte/8198000/ListSize3.java"
                moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/ListSize3.java</a>
              <o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">Steps:<o:p></o:p></li>
          </ol>
          <ol style="margin-top:0in" start="5" type="1">
            <ol style="margin-top:0in" start="1" type="a">
              <li class="MsoNormal" style="color:windowtext;mso-list:l5
                level2 lfo2">Compile and execute the test program with
                release build JDK.<o:p></o:p></li>
              <li class="MsoNormal" style="color:windowtext;mso-list:l5
                level2 lfo2">Click in the list's client area below the
                last item, i.e. do not click on any item.<o:p></o:p></li>
            </ol>
          </ol>
          <ol style="margin-top:0in" start="6" type="1">
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">Expected behavior:  Last item should get
              selected.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l5
              level1 lfo2">Actual behavior:  Last item does not get
              selected on first click. But the focused item gets
              selected after few clicks.<o:p></o:p></li>
          </ol>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">  Issue 2:
              Incorrect selection when list size exceeds sizeof(WORD)
              [0xFFFF].</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">Steps:</span><o:p></o:p></p>
          <ol style="margin-top:0in" start="1" type="1">
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Compile and execute the program with release
              build JDK (with or without the fix) : <a
                href="http://cr.openjdk.java.net/%7Earapte/8198000/List65544.java"
                moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/List65544.java</a>
              <o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Click the first item in list, press End key.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Click the last item 65544.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Expected behavior:  The item 65544 should get
              selected.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Actual behavior: The item 65544 does not get
              selected and instead item 8 gets selected.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">Verified only windows behavior.<o:p></o:p></li>
            <li class="MsoNormal" style="color:windowtext;mso-list:l0
              level1 lfo3">I suggest to file a new JBS for this issue.<o:p></o:p></li>
          </ol>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">Regards,</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext">Ambarish</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0in 0in 0in">
              <p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
                  style="color:windowtext"> Phil Race <br>
                  <b>Sent:</b> Thursday, November 01, 2018 1:51 AM<br>
                  <b>To:</b> Ambarish Rapte <a
                    href="mailto:ambarish.rapte@oracle.com"
                    moz-do-not-send="true"><ambarish.rapte@oracle.com></a>;
                  <a href="mailto:awt-dev@openjdk.java.net"
                    moz-do-not-send="true">awt-dev@openjdk.java.net</a><br>
                  <b>Subject:</b> Re: <AWT Dev> [12] RFR :
                  JDK-8198000 :
                  java/awt/List/EmptyListEventTest/EmptyListEventTest.java
                  debug assert on Windows</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal"> <o:p></o:p></p>
          <p class="MsoNormal" style="margin-bottom:12.0pt">That adds
            what I suggested, but I had also suggested you leave in what
            you<br>
            had added as it also adds some protection.<br>
            <br>
            Additionally I read the MS docs and they do explain the
            131071 return value.<br>
            The message this code is sending is  LB_ITEMFROMPOINT and
            the docs say here<br>
            <a
href="https://docs.microsoft.com/en-us/windows/desktop/controls/lb-itemfrompoint"
              moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/desktop/controls/lb-itemfrompoint</a>
            that<br>
            <br>
            >The return value contains the index of the nearest item
            in the <a
              href="https://msdn.microsoft.com/library/windows/desktop/ms632659"
              moz-do-not-send="true"><strong><span
                  style="font-family:"Calibri",sans-serif">LOWORD</span></strong></a>.
            The <a
              href="https://msdn.microsoft.com/library/windows/desktop/ms632657"
              moz-do-not-send="true"><strong><span
                  style="font-family:"Calibri",sans-serif">HIWORD</span></strong></a>
            is zero if the > specified point is in the client area of
            the list box, or one if it is outside the client area"<br>
            <br>
            You got 131071 which is, in hex 0X1FFFF.<br>
            <br>
            So you got "1" for hi-word, meaning "outside client area"
            and "-1" for loword,<br>
            meaning the index. And a return index of "-1" doubtless
            means an error ..<br>
            <br>
            -phil.<br>
            <br>
            <br>
            <o:p></o:p></p>
          <div>
            <p class="MsoNormal">On 10/31/18 12:49 PM, Ambarish Rapte
              wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><span style="color:windowtext">Hi Phil
                & Sergey,</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
            <p class="MsoNormal" style="text-indent:.5in"><span
                style="color:windowtext">This issue was introduced with
                the fix for <a
                  href="https://bugs.openjdk.java.net/browse/JDK-6806217"
                  title="implement synthetic focus model for MS Windows"
                  moz-do-not-send="true">JDK-6806217</a>, in 7b55, which
                modified AwtList::HandleEvent(), so It was not observed
                with JDK6.</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext">               

                Please review the updated change as discussed offline: <a
href="http://cr.openjdk.java.net/%7Earapte/8198000/webrev.01/"
                  moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/webrev.01/</a></span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext">Regards,</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext">Ambarish</span><o:p></o:p></p>
            <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
            <div>
              <div style="border:none;border-top:solid #E1E1E1
                1.0pt;padding:3.0pt 0in 0in 0in">
                <p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span
                    style="color:windowtext"> Phil Race <br>
                    <b>Sent:</b> Tuesday, October 30, 2018 2:09 AM<br>
                    <b>To:</b> Ambarish Rapte <a
                      href="mailto:ambarish.rapte@oracle.com"
                      moz-do-not-send="true"><ambarish.rapte@oracle.com></a>;
                    <a href="mailto:awt-dev@openjdk.java.net"
                      moz-do-not-send="true">awt-dev@openjdk.java.net</a><br>
                    <b>Subject:</b> Re: <AWT Dev> [12] RFR :
                    JDK-8198000 :
                    java/awt/List/EmptyListEventTest/EmptyListEventTest.java
                    debug assert on Windows</span><o:p></o:p></p>
              </div>
            </div>
            <p class="MsoNormal"> <o:p></o:p></p>
            <p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
            <div>
              <p class="MsoNormal">On 10/29/18 7:31 AM, Ambarish Rapte
                wrote:<o:p></o:p></p>
            </div>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <p class="MsoNormal">Hi,<o:p></o:p></p>
              <p class="MsoNormal">                Please review this
                Windows only fix,<o:p></o:p></p>
              <p class="MsoNormal">                JBS: <a
                  href="https://bugs.openjdk.java.net/browse/JDK-8198000"
                  moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8198000</a><o:p></o:p></p>
              <p class="MsoNormal">                Webrev: <a
                  href="http://cr.openjdk.java.net/%7Earapte/8198000/webrev.00/"
                  moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/webrev.00/</a><o:p></o:p></p>
              <p class="MsoNormal"> <o:p></o:p></p>
              <p class="MsoNormal">Issue:<o:p></o:p></p>
              <ol style="margin-top:0in" start="1" type="1">
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4">Test

                  asserts with debug build jdk, only on windows.<o:p></o:p></li>
              </ol>
            </blockquote>
            <p class="MsoNormal"><br>
              Only the debug build turns on asserts.<br>
              But I think JDK 6 always turned on asserts, and this test
              was introduced in 6,<br>
              so something must have changed else we'd have seen this
              test fail a long time ago.<br>
              Can you identify what it was ?<br>
              <br>
              Also same comment as the other bug - you need to add the
              bug id to the test.<br>
              <br>
              <br>
              <br>
              <br>
              <o:p></o:p></p>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <ol style="margin-top:0in" start="2" type="1">
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4"> <o:p></o:p></li>
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4">Assert

                  at Line no 77, awt_List.h :: IsItemSelected()<o:p></o:p></li>
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4">awt_List.cpp

                   ::  AwtList::HandleEvent() calls IsItemSelected()
                  with an incorrect index value. <o:p></o:p></li>
              </ol>
            </blockquote>
            <p class="MsoNormal"><br>
              Why ? <br>
              <br>
              <br>
              <br>
              <br>
              <o:p></o:p></p>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <ol style="margin-top:0in" start="5" type="1">
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4"> <o:p></o:p></li>
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4">In
                  AwtList::HandleEvent() , the call
                  SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam) 
                  returns an arbitrary value 131071, which gets passed
                  to IsItemSelected().<o:p></o:p></li>
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4">Could

                  not find any relevance to the value 131071, from
                  LB_ITEMFROMPOINT doc.<o:p></o:p></li>
              </ol>
            </blockquote>
            <p class="MsoNormal"><br>
              That is (128*1024)-1, so it is probably not "arbitrary".<br>
              <br>
              Please add the eval above to the bug report .. once we
              have a complete understanding.<br>
              <br>
              -phil.<br>
              <br>
              <br>
              <br>
              <br>
              <o:p></o:p></p>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <ol style="margin-top:0in" start="8" type="1">
                <li class="MsoNormal" style="mso-list:l3 level1 lfo4"> <o:p></o:p></li>
              </ol>
              <p class="MsoNormal"> <o:p></o:p></p>
              <p class="MsoNormal">Fix:  Index should be verified before
                making call to IsItemSelected() : <a
                  href="http://cr.openjdk.java.net/%7Earapte/8198000/webrev.00/"
                  moz-do-not-send="true">http://cr.openjdk.java.net/~arapte/8198000/webrev.00/</a><o:p></o:p></p>
              <p class="MsoListParagraph"> <o:p></o:p></p>
              <p class="MsoNormal">Verification:  All list tests pass.<o:p></o:p></p>
              <p class="MsoNormal"> <o:p></o:p></p>
              <p class="MsoNormal">Regards,<o:p></o:p></p>
              <p class="MsoNormal">Ambarish<o:p></o:p></p>
            </blockquote>
            <p class="MsoNormal"> <o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal"> <o:p></o:p></p>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <br>
  </body>
</html>