Thanks for the helpful table!

The problem with Control combinations was a mistake in my code, fixed
in the enclosed "key.rkt".

The problem with dead keys was harder. It seems that ToUnicode() has
the same effect as TranslateEvent() for dead-key combinations, so using
ToUnicode() multiple times and in addition to TranslateEvent() triggers
the extra accents in your experiments. My new attempt uses ToUnicode()
only when it's in a position to cancel a TranslateEvent() call ---
which is always the case when we first want to get its result ---- and
records the result instead of calling ToUnicode() again later.

At Wed, 16 Mar 2016 08:53:48 +0000, Bert De Ketelaere wrote:
> Thanks for looking into this!  My implementation worked somewhat, but I was 
> indeed not happy with the way I solved it. (State and losing the key release 
> events)
> Just to be sure, I updated my patch a week ago for some errors I found in my 
> handling of key-events, the table below is based on that revision.
> 
> 
> ​       ​       ​old
>         bdeket​ mflat​  desired​        ​
> ​AltGr+q        custom keybinding​ ​    <nothing>​      ​◊      ​◊      ​◊    
>   ​
> ​Ctrl+Alt+q     ​q      ​q      ​◊      ​q      ​(normal is nothing)
> 
> ​AltGr+<        keyboard layout​ ​      \​      ​\      ​\      ​\      ​ ​
> ​Ctrl+Alt+<     ​<      ​\      \​      ​\
> ​AltGr+ù        ​keyboard layout
> ​dead key
> ​       ​<waiting>      ù​      ​´´     <waiting>​      ​ ​ ​(my patch does 
> this ok if 
> ù without modifier is used before ù with modifier, so it deserves some 
> points, 
> but probably negative ones, because of its inconsistency)
> ​followed by space
>         ​´      ​ù´     ​´´´    ​´
> ​followed by a
>         ​á      ​ùá     ​´´á    ​á
> ​AltGr+e        keyboard layout​ ​      ​€      €​      ​€      ​€      ​(I 
> would 
> expect the menu only to open for Alt+e)
> ​
> ​Ctr+Alt+e      ​<opens edit menu>
>         ​€      ​€      ​€
> ​Ctr+s  ​save   ​<ok>   ​<ok>   ​<nothing>      ​<ok>   ​
> ​Ctrl+c ​copy   ​<ok>   ​<ok>   ​<nothing>      ​<ok>   ​
> ​Alt+arrowright ​jump to end s-expr
>         ​<ok>   ​<ok>   ​<ok>   ​<ok>   ​
> ​Ctrl+Arrowright
>         ​jump to end word
>         ​<ok>   ​<ok>   ​<ok>   ​<ok>   ​
> 
> 
> I'll look at your code when I have more time tomorrow or this weekend.
> 
> 
> Thanks again,
> 
> Bert
> 
> ________________________________________
> Van: racket-users@googlegroups.com <racket-users@googlegroups.com> namens 
> Matthew Flatt <mfl...@cs.utah.edu>
> Verzonden: woensdag 16 maart 2016 4:09
> Aan: Bert De Ketelaere
> CC: us...@racket-lang.org
> Onderwerp: Re: [racket-users] Re: custom keybindings (AltGr)
> 
> Thanks for looking into this problem in depth! Although I'll suggest an
> alternate implementation, your patch was helpful for me to understand
> the problems and goals.
> 
> To generate an event when AltGr-<x> doesn't produce a character, I
> think a better approach here is to call ToUnicode(). That seems to work
> as a check for whether a meaning is assigned to a key combination. It
> avoids using state to try to match key-up events with key-down events,
> and it should work better with key repeats.
> 
> For making Ctl-Alt-<x> work as AltGr-<x>, I think I see what you want,
> based on how programs like Notepad interpret key combinations. I think
> other users will still want to distinguish Ctl-Alt-<x> and AltGr-<x>
> for keyboard shortcuts, though, along the same lines that Emacs
> distinguishes them. So we'll probably need to make that an option,
> similar to the `special-option-key` setting for OS X.
> 
> Can you try the enclosed "key.rkt" to see whether it works the way you
> want? This version defines `control+alt-always-as-altgr?` as #t to
> simulate an option for making Ctl-Alt-<x> work as AltGr-<x>.
> 
> At Mon, 7 Mar 2016 15:16:23 +0000, Bert De Ketelaere wrote:
> > Hello,
> >
> >
> > after looking around trying to fix my previous
> > 
> problem<https://groups.google.com/d/topic/racket-users/_1i-zcfBaaM/discussion>
> > I found that DrRacket really is not sending any event for AltGr+(Key x)
> > combinations if this combination doesn't actually produces a char.
> >
> > I tried changing the win32/key.rkt file in gui-lib so DrRacket would get 
> these
> > events and en passant I tried to make DrRacket behave more like other Win
> > programs when it comes to keyboard input.
> >
> >
> > my attempt is at:
> >
> > https://github.com/bdeket/gui/commit/994a5655a9f913b7388e0c74c1b6203659b645d3
> >
> >
> > A few problems remain:
> >
> > Ctrl+Alt+(key x): where this combination doesn't produce a char, x is 
> produced
> > instead of nothing
> >
> > Ctrl+Alt+(key x) or AltGr+(key x): the release event is now hijacked and 
> sends
> > another keypress-event.
> >
> >     This is a problem, but I don't know how to fix this, and I prefer this
> > over the previous state where key-events where ignored
> >
> >
> > Unfortunately I didn't understand all the code that was already there, and I
> > didn't find standard tests to test this.
> >
> > Are there tests for the key-events?
> >
> >
> > Kind regards,
> >
> > Bert
> >
> > --
> > 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 racket-users+unsubscr...@googlegroups.com.
> > For more options, visit 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 racket-users+unsubscr...@googlegroups.com.
> For more options, visit 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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: key.rkt
Description: Binary data

Reply via email to