<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    On 1/26/2012 22:29, Guillermo Polito wrote:
    <blockquote
cite="mid:CAOBmb50FpguxMbAEvNegx4JXQ7YaLOsrVMMtw2cn_bLYUALwwQ@mail.gmail.com"
      type="cite">
      <pre wrap=""> </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      Hi!<br>
      <br>
      <div class="gmail_quote">On Thu, Jan 26, 2012 at 4:41 PM, Andreas
        Raab <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          &nbsp;<br>
          <div> <br>
            <br>
            On 1/26/2012 15:43, Guillermo Polito wrote:
            <blockquote type="cite">
              <pre> </pre>
              <br>
              <fieldset></fieldset>
              <br>
              <div>The question is:</div>
              <div><br>
              </div>
              <div>Should KeyDown, KeyUp and KeyChar events for the same
                key produce the same keyCode? &nbsp;I think yes. &nbsp;Because the
                keyCode indicates the key pressed in the keyboard.
                Doesn't it?</div>
            </blockquote>
            It does. Which is precisely the reason why it *can't*
            produce different values when you press the shift key with
            it.<br>
            &nbsp;</div>
        </blockquote>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> The KEY you are
            pressing does not change depending on the modifier; your OS
            decides that the combination of the Shift key and the P key
            produces an uppercase P character. Similarly to the OS
            deciding that (when using dead keys for example) pressing
            the accent key followed by the a key produces an accented a.
            Would you expect the keyDown value for the accented a to
            change as well? This way lies complete madness.<br>
          </div>
        </blockquote>
        <div><br>
          But you're talking about the keychar event and I've not
          modified at all it's behavior :/.&nbsp; And yes, I agree I should
          not do any conversion on KeyUp and KeyDown :).<br>
          &nbsp;</div>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> <br>
            Maybe you don't understand what these events are used for.
            Consider you are writing a game and you're using shift and
            control key for primary and secondary weapon action. Would
            you expect that the person writing the game needs to handle
            all of the various control and shift key combos in order to
            find out that the user pressed the a key to move forward?<br>
          </div>
        </blockquote>
        <div><br>
          Oh, yes I do understand.&nbsp; Maybe I didn't explain me fine,
          sorry.<br>
          <br>
          The main problem is that I want keycodes to be the same
          through the three platforms (unix, mac and windows).&nbsp; And for
          that, I have to do a mapping somewhere (this piece of code I
          wrote today was to play and see how it behaves, because the
          codes are to be defined :) ).<br>
          <br>
          So, I thought those conversions could be done through the <b>keymap</b>
          array.<br>
          Maybe that's not the way to do the mapping, but <i>the</i>
          mapping should be done somewhere.<br>
        </div>
      </div>
    </blockquote>
    <br>
    The simplest place to do the mapping is inside the image.<br>
    <br>
    Cheers,<br>
    &nbsp; - Andreas<br>
    <br>
    <blockquote
cite="mid:CAOBmb50FpguxMbAEvNegx4JXQ7YaLOsrVMMtw2cn_bLYUALwwQ@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">
        <div><br>
          Then, after looking at how other platforms work, I reached the
          conclusion that if events for the same stroke have different
          keycodes I don't care :), since the keycode should only be
          important for KeyUp and KeyDown and not KeyChar (where I
          should only care about charCode).<br>
          <br>
        </div>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> <br>
            <blockquote type="cite">
              <div>Now,&nbsp;utf32Code should be only used on KeyChar events,
                and I don't care about them.</div>
              <div><br>
              </div>
              <div>How does it work now?</div>
              <div><br>
              </div>
              <div>(KeyDown, KeyUp) and KeyChar events send different
                keyCodes to the image.</div>
            </blockquote>
            <br>
            Which is exactly the right thing to do.<br>
          </div>
        </blockquote>
        <div><br>
          I answered before :).<br>
          &nbsp;</div>
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF" text="#000000"> <br>
            Cheers,<br>
            &nbsp; - Andreas<br>
          </div>
        </blockquote>
        <div><br>
          Thanks, I'm learning!<br>
          Guille<br>
        </div>
      </div>
    </blockquote>
  </body>
</html>