This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: console enhancements: mouse events


2009/11/6 Thomas Wolff:
> * I would like to fix some key assignments:
> Â- Control-(Shift-)6 inputs Control-^ which is not proper on international
> Â Âkeyboards if Shift-6 is not "^", Control-^ (the key) does not input
> Â ÂControl-^ (the character) on the other hand; the same glitch
> Â Âoccurs in the pure Windows console, however.
> Â ÂUnfortunately, with the functions being used it is not possible to
> Â Âdetect that shifted key "^" was hit together with Control; only
> Â Âkeycodes/scancodes are available when Control/Shift/Alt are used. So
> Â ÂI don't know whether this can easily be fixed. It works in mintty but
> Â ÂI think mintty uses different Windows functions.

Mintty roughly does the following for Ctrl(+Shift)+symbol combinations:
- obtain the keymap using GetKeyboardState()
- set the state of the Ctrl key to released
- invoke ToUnicode() to get the character code according to the keyboard layout
- if the character code is one of [\]_^? send the corresponding control code
- otherwise, set the state of both Ctrl and Alt to pressed (this is
equivalent to AltGr), and try ToUnicode() again

The last step means that e.g. Ctrl+9 on a German keyboard will send
^]. The proper combination would be Ctrl+AltGr+9, but since
AltGr==Ctrl+Alt, that can't be distinguished from AltGr+9 without
Ctrl. (Well, not without somewhat dodgy trickery anyway.)

Btw, ^[, ^], and ^\ are actually available as Ctrl+Ã, Ctrl+plus, and
Ctrl+# in the German keyboard layout, but those combinations make no
sense unless you're familiar with the US layout. It's similar with
many, but by no means all, other layouts. (Microsoft's Keyboard Layout
Creator is a good way to inspect different layouts.)

> Â- Pressing something like Alt-Ã on a German keyboard leaves an illegal UTF-8
> Â Âsequence (the second byte of the respective sequence) in input, apparently
> Â Âbecause Alt-0xC3 is handled somehow. Don't know, though, whether this is
> Â Âa cygwin console issue or maybe a readline issue.

Readline issue. It's fine in zsh.

Andy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]