by Michael S. Kaplan, published on 2005/01/22 16:46 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/01/22/358771.aspx
Lionel Fourquaux asks:
As a member of a student group that provides some help with MS products, I've been trying to create a keyboard layout that would give a (partial) answer to a common complaint from Unix users: how to get a "Compose" key in Windows.
First, I've to say they won't be completely satisfied, since it appears to be impossible to reproduce, at least with MSKLC, the exact behavior they want. (It probably possible to do it by filtering keyboard events at a higher level, but it doesn't look as clean a solution).
First, to explain a bit about the Compose key if you have never heard of it before....
Looking at a definition in a description of KEYMAPS:
Then there may also be compose definitions. They have syntax
compose ’char’ ’char’ to ’char’
and describe how two bytes are combined to form a third one (when a dead accent or compose key is used). This is used to get accented letters and the like on a standard keyboard.
At first glance they are a lot like dead keys, right?
Well, not exactly. After all, one does not a key to change the behavior of another key to make it act like a dead key. Thus a line in the KERNEL ACCENT TABLE that looked like "compose ’,’ ’c’ to ccedilla" would mean that typing <ComposeKey><,><c> would create <ccedilla>. And that just typing <,><c> without touching the Compose key would not. Of course, with dead keys in Windows keyboards (like those you can define in MSKLC) there is no exact conditional mechanism like that.
Now you could fake it, though. And it would not be such a bad fake.
You could define your dead keys in the AltGR state such that any time you typed <AltGR><,> followed by <c> you would get what you wanted. You could optionally define <AltGR> + <c> to put out that same lowercase 'c' if you wanted that same behavior when the faux-compose key was held down.
Of course this method is kind of expensive; you have to be willing sacrifice AltGR as a shift state (you are putting in otherwise unexpected definitions to support the Compose functionality anyway, and it would be incredibly confusing to have the AltGR perform other tasks as well. But if you turn your AltGR into a faux-Compose key consistently in the definition, then your keyboard layout would certainly act like it has a Compose key.
Note that other Unix-type functionality (loading the Compose key definitions into arbitrary keyboards) would not exist and could never really be added. You would have to look into the SetWindowsHookEx API with one of the keyboard hook types to try to affect keyboard behavior in such a marked way. This is of course a pretty extreme way of getting such a task done and it is worth really considering whether such a functionality is a sensible thing to have (given the differences in the overlap of letters that are needed across languages).
In any case, Lionel then continued:
Second, it appears that MSKLC really doesn't like want I'm trying to do: it doesn't signal any clear problem, but some keys in the resulting layout do not work as they should and as they do in the test window. I've tried many variations, and I suspect that I've hit either a bug or an undocumented limitation.
Recently someone in the newsgroups reported a specific bug in an experimental (one could almost call it an MSKLC stress test!) keyboard with 17 different dead keys and over 300 dead key pairs defined was having some problems in two of those dead key definitions (in the VK_OEM_5 and VK_OEM_7 definitions); I will be investigating that report soon. Is this a similar type of problem?
# Peter da Silva on 22 Jan 2005 4:42 PM:
# Michael Kaplan on 22 Jan 2005 5:15 PM:
# Lionel Fourquaux on 23 Jan 2005 9:25 AM:
# Michael Kaplan on 23 Jan 2005 10:23 AM:
# Paul on 23 Jan 2005 9:54 PM:
# Michael Kaplan on 23 Jan 2005 10:08 PM:
# Lionel Fourquaux on 25 Jan 2005 10:59 AM:
# Michael Kaplan on 25 Jan 2005 11:51 AM:
# Gerben Vos on 16 Sep 2008 8:55 AM:
Dead keys *are* less practical. When I press comma, I want a comma; I don't want this key to have different results (comma or cedille) depending on what key I press next. A compose key gives an easy choice between the comma and the cedille. It's a simple matter of offering a consistent and easy-to-remember user interface.
The Unix (or at least Linux) compose key does use more than two keys for some combinations; for example, Compose - - . gives an en-dash, while Compose - - - gives an em-dash. They may not be perfect key combinations, but they *are* easy to remember (and let's face it, you don't have to use those dashes very often).
# Gerben Vos on 16 Sep 2008 9:52 AM:
I would like to point lovers of the compose key to http://keyboards.jargon-file.org/ , where there are several choices, all apparently MSKLC-generated. The layouts "Pseudo VT320, "United States International Alternate", "United States Combining Diacritical" all look quite promising.
# Lapo Luchini on 29 Oct 2009 4:30 AM:
IMHO AllChars is the solution to emulate compose key on Windows:
I don't know its internals, but it's opensource and it works; I used it for a few days and am very very satisfied so far.
Simon on 15 Aug 2013 2:24 AM:
> ... you have to be willing sacrifice AltGR as a shift state...
I have never net anyone who used the AltGr key in the English speaking world using EN-GB keyboard. The same for Alt on EN-US local keyboards - Who uses these, other than to access accents chars?
Thanks for this article. Perhaps there lies a method that I can use Alt for a deadkey to access French accented characters : One day...
2005/11/15 It is not easy to chain dead keys on Windows
go to newer or older post, or back to index or month or day