Thanks, Alex.

A little more digging, and here’s some more info; I’m hoping this will be 
enough for the maintainers of 2htdp/universe to track down what’s going on.

In 2htdp/private/check-aux.rkt in the htdp-lib package, I opened a REPL and ran 
this code:
> (require racket/gui)
> (define f
    (let ([es (make-eventspace)])
      (parameterize ([current-eventspace es])
        (new (class frame%
               (define/override (on-subwindow-char r e)
                 (define ps (key-event->parts e))
                 (if (equal? ps "release")
                   (printf "released ~a~%" (key-release->parts e))
                   (printf "pressed ~a~%" ps)))
               (super-new))
             [label "foo"]))))
> (define p (new panel%
                 [parent f]
                 [min-width 200]
                 [min-height 100]))
> (send f show #t)

Then, with focus on the frame I created, I:
held left-shift
held right-shift
released right-shift
released left-shift

This triggered the messages:
pressed shift
pressed rshift
pressed rshift
released shift

I wrote the above class definition as I did, because I see that 2htdp/world.rkt 
uses that technique (checking the output of key-event->parts) to tell if it’s 
got a key release. What I’ve observed is that if one shift key is released 
while the other is held down, the key event's get-key-code method is producing 
the symbol 'shift or 'rshift, not 'release as the universe library expects.

So it appears that this is a bug originating down where the key-event% is being 
instantiated in the MrEd library layer, which is a bit beyond the depth I can 
troubleshoot in the time I have. I’ve created an issue on Github 
<https://github.com/racket/gui/issues/91>, and will leave it at that.

Hope this helps.

Regards,
Jordan


> On Dec 17, 2017, at 18:45, Alex Harsanyi <[email protected]> wrote:
> 
> I tested this on a Windows platform and have the same result. It seems there 
> is a problem in Racket with handling the right shift key: pressing down the 
> right shift key results in "keydown" being invoked with a "rshift" argument, 
> but releasing the right shift key results in "keyup" being called with a 
> "shift" argument (instead of "rshift")
> 
> Best Regards,
> Alex.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to