public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Dead keys
@ 2001-05-01 18:04 Stian Sletner
  0 siblings, 0 replies; 5+ messages in thread
From: Stian Sletner @ 2001-05-01 18:04 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Alan Cox, Andries.Brouwer

Hello.

I've long been bothered by the fact that 3 of the 6 "dead keys" in the
kernel are actually mapped to the wrong characters.  Now, I realize that
there might be some deliberate reason for this, since it's such an
obvious annoyance and since they all fit in US ASCII the way it is now.
Also, I've noticed that it is the same way in X11, independent from
this.  I'd like to know the reasoning, if there is one.

Normally, you wouldn't notice this too much, since the compose rules
are set up in such a way that you can use the dead keys to compose what
you would expect, anyway.  However, if you were to press a dead key and
then space, or some un-composable key (to get the dead key character by
itself), you would get the wrong character.  Instead of '¨' (ISO 8859-1
decimal 168: DIAERESIS), you would get '"' (ASCII decimal 34); instead
of '´' (ISO 8859-1 decimal 180: ACUTE ACCENT), you would get '\'' (ASCII
decimal 39); and instead of '¸' (ISO 8859-1 decimal 184: CEDILLA), you
would get ',' (ASCII decimal 44).

I took the liberty of creating a patch that changes this in keyboard.c,
and also adds compose rules to defkeymap.map so they can be used
properly.  If there is some reason why this shouldn't be applied, I'd
like to know what, since this makes my console life easier. :)

Thanks.

(Patched against 2.4.3, but it applies to 2.4.4 too.  Just tested it.)

diff -u linux/drivers/char/defkeymap.map linux-patched/drivers/char/defkeymap.map
--- linux/drivers/char/defkeymap.map	Fri Feb 24 20:38:27 1995
+++ linux-patched/drivers/char/defkeymap.map	Thu Apr 26 22:09:13 2001
@@ -291,12 +291,16 @@
 compose '`' 'a' to 'à'
 compose '\'' 'A' to 'Á'
 compose '\'' 'a' to 'á'
+compose '´' 'A' to 'Á'
+compose '´' 'a' to 'á'
 compose '^' 'A' to 'Â'
 compose '^' 'a' to 'â'
 compose '~' 'A' to 'Ã'
 compose '~' 'a' to 'ã'
 compose '"' 'A' to 'Ä'
 compose '"' 'a' to 'ä'
+compose '¨' 'A' to 'Ä'
+compose '¨' 'a' to 'ä'
 compose 'O' 'A' to 'Å'
 compose 'o' 'a' to 'å'
 compose '0' 'A' to 'Å'
@@ -307,22 +311,32 @@
 compose 'a' 'e' to 'æ'
 compose ',' 'C' to 'Ç'
 compose ',' 'c' to 'ç'
+compose '¸' 'C' to 'Ç'
+compose '¸' 'c' to 'ç'
 compose '`' 'E' to 'È'
 compose '`' 'e' to 'è'
 compose '\'' 'E' to 'É'
 compose '\'' 'e' to 'é'
+compose '´' 'E' to 'É'
+compose '´' 'e' to 'é'
 compose '^' 'E' to 'Ê'
 compose '^' 'e' to 'ê'
 compose '"' 'E' to 'Ë'
 compose '"' 'e' to 'ë'
+compose '¨' 'E' to 'Ë'
+compose '¨' 'e' to 'ë'
 compose '`' 'I' to 'Ì'
 compose '`' 'i' to 'ì'
 compose '\'' 'I' to 'Í'
 compose '\'' 'i' to 'í'
+compose '´' 'I' to 'Í'
+compose '´' 'i' to 'í'
 compose '^' 'I' to 'Î'
 compose '^' 'i' to 'î'
 compose '"' 'I' to 'Ï'
 compose '"' 'i' to 'ï'
+compose '¨' 'I' to 'Ï'
+compose '¨' 'i' to 'ï'
 compose '-' 'D' to 'Ð'
 compose '-' 'd' to 'ð'
 compose '~' 'N' to 'Ñ'
@@ -331,27 +345,38 @@
 compose '`' 'o' to 'ò'
 compose '\'' 'O' to 'Ó'
 compose '\'' 'o' to 'ó'
+compose '´' 'O' to 'Ó'
+compose '´' 'o' to 'ó'
 compose '^' 'O' to 'Ô'
 compose '^' 'o' to 'ô'
 compose '~' 'O' to 'Õ'
 compose '~' 'o' to 'õ'
 compose '"' 'O' to 'Ö'
 compose '"' 'o' to 'ö'
+compose '¨' 'O' to 'Ö'
+compose '¨' 'o' to 'ö'
 compose '/' 'O' to 'Ø'
 compose '/' 'o' to 'ø'
 compose '`' 'U' to 'Ù'
 compose '`' 'u' to 'ù'
 compose '\'' 'U' to 'Ú'
 compose '\'' 'u' to 'ú'
+compose '´' 'U' to 'Ú'
+compose '´' 'u' to 'ú'
 compose '^' 'U' to 'Û'
 compose '^' 'u' to 'û'
 compose '"' 'U' to 'Ü'
 compose '"' 'u' to 'ü'
+compose '¨' 'U' to 'Ü'
+compose '¨' 'u' to 'ü'
 compose '\'' 'Y' to 'Ý'
 compose '\'' 'y' to 'ý'
+compose '´' 'Y' to 'Ý'
+compose '´' 'y' to 'ý'
 compose 'T' 'H' to 'Þ'
 compose 't' 'h' to 'þ'
 compose 's' 's' to 'ß'
 compose '"' 'y' to 'ÿ'
+compose '¨' 'y' to 'ÿ'
 compose 's' 'z' to 'ß'
 compose 'i' 'j' to 'ÿ'
diff -u linux/drivers/char/keyboard.c linux-patched/drivers/char/keyboard.c
--- linux/drivers/char/keyboard.c	Mon Oct 16 21:58:51 2000
+++ linux-patched/drivers/char/keyboard.c	Mon Apr 23 12:02:36 2001
@@ -557,11 +557,11 @@
 }
 
 #define A_GRAVE  '`'
-#define A_ACUTE  '\''
+#define A_ACUTE  '\264'
 #define A_CFLEX  '^'
 #define A_TILDE  '~'
-#define A_DIAER  '"'
-#define A_CEDIL  ','
+#define A_DIAER  '\250'
+#define A_CEDIL  '\270'
 static unsigned char ret_diacr[NR_DEAD] =
 	{A_GRAVE, A_ACUTE, A_CFLEX, A_TILDE, A_DIAER, A_CEDIL };

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] Dead keys
@ 2001-05-01 19:20 Andries.Brouwer
  2001-05-01 19:29 ` Stian Sletner
  0 siblings, 1 reply; 5+ messages in thread
From: Andries.Brouwer @ 2001-05-01 19:20 UTC (permalink / raw)
  To: linux-kernel, stian; +Cc: Andries.Brouwer, alan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]

	From stian@sletner.com Tue May  1 20:05:26 2001

	Normally, you wouldn't notice this too much, since the compose rules
	are set up in such a way that you can use the dead keys to compose what
	you would expect, anyway.  However, if you were to press a dead key and
	then space, or some un-composable key (to get the dead key character by
	itself), you would get the wrong character.  Instead of '¨' (ISO 8859-1
	decimal 168: DIAERESIS), you would get '"' (ASCII decimal 34); instead
	of '´' (ISO 8859-1 decimal 180: ACUTE ACCENT), you would get '\'' (ASCII
	decimal 39); and instead of '¸' (ISO 8859-1 decimal 184: CEDILLA), you
	would get ',' (ASCII decimal 44).

	I took the liberty of creating a patch that changes this in keyboard.c,
	and also adds compose rules to defkeymap.map so they can be used
	properly.  If there is some reason why this shouldn't be applied, I'd
	like to know what, since this makes my console life easier. :)

I think the main reason why it shouldn't be applied is that it changes
something. This keyboard stuff is unbelievably complicated. Many people
and distributions have wrestled with it and have got it working for them.
When you change stuff, you force people to start worrying about this again.

[In other words, a global rewrite may be allowed, but non-compatible changes
in a few details only is really a bad idea.]

But there are other reasons why your patch is a bad idea. Everybody has
a double quote in his keymap, so using that to create umlauts is easy.
Only few people have a diaeresis in their keymap, so requiring a diaeresis
makes life more difficult for most people.
(In other words, composing ASCII to make ISO 8859-1 is better than composing
ISO 8859-1 to make ISO 8859-1.)

Finally, you have loadkeys. If you change your private keymap
you achieve what you desire for yourself without disturbing others.

Andries

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] Dead keys
@ 2001-05-01 23:12 Andries.Brouwer
  2001-05-01 23:39 ` Stian Sletner
  0 siblings, 1 reply; 5+ messages in thread
From: Andries.Brouwer @ 2001-05-01 23:12 UTC (permalink / raw)
  To: Andries.Brouwer, stian; +Cc: alan, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

> The issue here is that the dead keys themselves
> are producing the wrong characters.

No. If someone without diaeresis key uses the double quote,
and attaches dead_diaeresis to it, she probably wants that
double quote when it is followed by a space.
When programming one needs quotes etc.
When writing text one needs a-umlaut and c-cedilla etc.
Very few people need a lone diaeresis. I do not mind if most
people would need an additional keystroke to obtain that.

> the dead_* are wrong, and I can't change them with a keymap, afaik?

Yes, you can. Linux keyboard handling is very flexible.

You can change the table of compose definitions with loadkeys,
and there is no restriction of what is combined with what.
You can also make any symbol into a dead symbol.

Example:

% loadkeys
plain keycode 53 = 0x0d2f
compose '/' 'o' to '\370'
%

This makes the slash (on my keyboard) into a dead slash:
when followed by an o I get the Danish oslash (ø),
and otherwise it remains a slash.

Explanation of the loadkeys input: 
The first line makes unadorned [no Shift, Ctrl, Alt] slash
(on my keyboard the key with keytop / has keycode 53 as showkey tells me)
into a dead ASCII slash. The 0d part is for "dead".
The 2f part is hex for the ASCII slash (octal 057).
The combine statement adds a combination to the compose table.
(Maybe it was there already - didnt check.)
For 2f and 370, see ascii(7) and iso_8859-1(7).

Andries

[Yes, a very small example, and the input contains numbers
in decimal, octal and hexadecimal.]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-01 23:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-01 18:04 [PATCH] Dead keys Stian Sletner
  -- strict thread matches above, loose matches on Subject: below --
2001-05-01 19:20 Andries.Brouwer
2001-05-01 19:29 ` Stian Sletner
2001-05-01 23:12 Andries.Brouwer
2001-05-01 23:39 ` Stian Sletner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox