LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] dead keys in unicode console mode
@ 2001-10-08 19:53 Radovan Garabik
  2001-10-09  2:16 ` Guest section DW
  0 siblings, 1 reply; 6+ messages in thread
From: Radovan Garabik @ 2001-10-08 19:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

FWIW, this little patch makes it possible to
use dead keys in unicode console mode.
It is against 2.4.10, but should apply cleanly in
broader range of kernel versions.

-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!

[-- Attachment #2: dead_keys.patch --]
[-- Type: text/plain, Size: 2420 bytes --]

diff -Nurd linux.orig/drivers/char/keyboard.c linux/drivers/char/keyboard.c
--- linux.orig/drivers/char/keyboard.c	Tue Sep 18 22:39:51 2001
+++ linux/drivers/char/keyboard.c	Mon Oct  8 21:39:02 2001
@@ -151,7 +151,7 @@
 
 /* N.B. drivers/macintosh/mac_keyb.c needs to call put_queue */
 void put_queue(int);
-static unsigned char handle_diacr(unsigned char);
+static ushort handle_diacr(unsigned char);
 
 /* kbd_pt_regs - set by keyboard_interrupt(), used by show_ptregs() */
 struct pt_regs * kbd_pt_regs;
@@ -541,12 +541,24 @@
 
 static void do_self(unsigned char value, char up_flag)
 {
+        ushort v;
 	if (up_flag)
 		return;		/* no action, if this is a key release */
 
-	if (diacr)
-		value = handle_diacr(value);
-
+	if (diacr) {
+                v = handle_diacr(value);
+                if (kbd->kbdmode == VC_UNICODE) {
+                        to_utf8(v & 0xFFFF);
+                        return;
+                }
+            
+                /* 
+                 * this makes at least latin-1 compose chars work 
+                 * even when using unicode keymap in non-unicode mode
+		 */
+		value = v & 0xFF; 
+        
+        }
 	if (dead_key_next) {
 		dead_key_next = 0;
 		diacr = value;
@@ -582,18 +594,18 @@
 	if (up_flag)
 		return;
 
-	diacr = (diacr ? handle_diacr(value) : value);
+	diacr = (diacr ? (handle_diacr(value) & 0xFF) : value);
 }
 
 
 /*
  * We have a combining character DIACR here, followed by the character CH.
- * If the combination occurs in the table, return the corresponding value.
+ * If the combination occurs in the table, return the corresponding UCS2 value.
  * Otherwise, if CH is a space or equals DIACR, return DIACR.
  * Otherwise, conclude that DIACR was not combining after all,
  * queue it and return CH.
  */
-unsigned char handle_diacr(unsigned char ch)
+ushort handle_diacr(unsigned char ch)
 {
 	int d = diacr;
 	int i;
diff -Nurd linux.orig/include/linux/kd.h linux/include/linux/kd.h
--- linux.orig/include/linux/kd.h	Sun Sep 23 19:31:01 2001
+++ linux/include/linux/kd.h	Mon Oct  8 21:39:02 2001
@@ -115,7 +115,8 @@
 #define KDSKBSENT	0x4B49	/* sets one function key string entry */
 
 struct kbdiacr {
-        unsigned char diacr, base, result;
+        unsigned char diacr, base;
+        unsigned short int result; /* holds UCS2 value */
 };
 struct kbdiacrs {
         unsigned int kb_cnt;    /* number of entries in following array */

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

* Re: [PATCH] dead keys in unicode console mode
  2001-10-08 19:53 [PATCH] dead keys in unicode console mode Radovan Garabik
@ 2001-10-09  2:16 ` Guest section DW
  2001-10-09  2:25   ` H. Peter Anvin
  2001-10-09  7:28   ` Radovan Garabik
  0 siblings, 2 replies; 6+ messages in thread
From: Guest section DW @ 2001-10-09  2:16 UTC (permalink / raw)
  To: Radovan Garabik, linux-kernel; +Cc: Alan Cox

On Mon, Oct 08, 2001 at 09:53:13PM +0200, Radovan Garabik wrote:
> FWIW, this little patch makes it possible to
> use dead keys in unicode console mode.
> It is against 2.4.10, but should apply cleanly in
> broader range of kernel versions.

>  struct kbdiacr {
> -        unsigned char diacr, base, result;
> +        unsigned char diacr, base;
> +        unsigned short int result; /* holds UCS2 value */
>  };

And now all existing binaries that use the KDGKBDIACR ioctl
dump core? And all existing binaries that use the KDSKBDIACR
ioctl do very strange things?

If you want to do something like this, a new ioctl and a new
structure are necessary. If you design something new, keep
examples like Vietnamese in mind (with several accents on
one symbol). We do support that now in the 8-bit world,
but complete support of the 16-bit world still requires
some work. (And in the meantime Unicode has already gone beyond.)

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

* Re: [PATCH] dead keys in unicode console mode
  2001-10-09  2:16 ` Guest section DW
@ 2001-10-09  2:25   ` H. Peter Anvin
  2001-10-09  7:28   ` Radovan Garabik
  1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2001-10-09  2:25 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20011009041618.A6135@win.tue.nl>
By author:    Guest section DW <dwguest@win.tue.nl>
In newsgroup: linux.dev.kernel
> 
> If you want to do something like this, a new ioctl and a new
> structure are necessary. If you design something new, keep
> examples like Vietnamese in mind (with several accents on
> one symbol). We do support that now in the 8-bit world,
> but complete support of the 16-bit world still requires
> some work. (And in the meantime Unicode has already gone beyond.)
> 

Absolutely; under no circumstances should any further 16-bit
interfaces be created.  We should expect to have to expand into the
full 31-bit Unicode space.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

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

* Re: [PATCH] dead keys in unicode console mode
  2001-10-09  2:16 ` Guest section DW
  2001-10-09  2:25   ` H. Peter Anvin
@ 2001-10-09  7:28   ` Radovan Garabik
  2001-10-10 17:19     ` Pavel Machek
  1 sibling, 1 reply; 6+ messages in thread
From: Radovan Garabik @ 2001-10-09  7:28 UTC (permalink / raw)
  To: Guest section DW; +Cc: linux-kernel, Alan Cox

On Tue, Oct 09, 2001 at 04:16:18AM +0200, Guest section DW wrote:
> On Mon, Oct 08, 2001 at 09:53:13PM +0200, Radovan Garabik wrote:
> > FWIW, this little patch makes it possible to
> > use dead keys in unicode console mode.
> > It is against 2.4.10, but should apply cleanly in
> > broader range of kernel versions.
> 
> >  struct kbdiacr {
> > -        unsigned char diacr, base, result;
> > +        unsigned char diacr, base;
> > +        unsigned short int result; /* holds UCS2 value */
> >  };
> 
> And now all existing binaries that use the KDGKBDIACR ioctl
> dump core? And all existing binaries that use the KDSKBDIACR
> ioctl do very strange things?

well, of course, existing binaries need to be recompiled,
that's what sources are for...
(and because unsigned char is subset of unsigned short, 
often they do not need to be even modified - btw how many
such binaries are there except of consoletools?)

> 
> If you want to do something like this, a new ioctl and a new
> structure are necessary. If you design something new, keep

More like complete redesign of console driver would be needed.
that is what linuxconsole.sf.net tries to do

> examples like Vietnamese in mind (with several accents on
> one symbol). We do support that now in the 8-bit world,

Think about someone who wants to use Vietnamese and Slovak
together (or Slovak and Russian as I need. Or Slovak, Lithuanian
and Russian - as one my friend needs. Or French and Hungarian as 
other friend of mine needs. Or any other combination from 
different ISO-8859 worlds). I converted my linux installation
almost completely to using UTF-8, and this (dead keys) was
a full stop, and I could forget about UTF-8.

> but complete support of the 16-bit world still requires
> some work. (And in the meantime Unicode has already gone beyond.)
> 

I do not argue.

-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!

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

* Re: [PATCH] dead keys in unicode console mode
  2001-10-09  7:28   ` Radovan Garabik
@ 2001-10-10 17:19     ` Pavel Machek
  2001-10-16  8:03       ` Radovan Garabik
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2001-10-10 17:19 UTC (permalink / raw)
  To: Radovan Garabik; +Cc: Guest section DW, linux-kernel, Alan Cox

Hi!

> > And now all existing binaries that use the KDGKBDIACR ioctl
> > dump core? And all existing binaries that use the KDSKBDIACR
> > ioctl do very strange things?
> 
> well, of course, existing binaries need to be recompiled,
> that's what sources are for...

And go to hell when you boot older kernel? Not an option. Add new ioctl.

								Pavel

-- 
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.


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

* Re: [PATCH] dead keys in unicode console mode
  2001-10-10 17:19     ` Pavel Machek
@ 2001-10-16  8:03       ` Radovan Garabik
  0 siblings, 0 replies; 6+ messages in thread
From: Radovan Garabik @ 2001-10-16  8:03 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Guest section DW, linux-kernel, Alan Cox

On Wed, Oct 10, 2001 at 05:19:34PM +0000, Pavel Machek wrote:
> Hi!
> 
> > > And now all existing binaries that use the KDGKBDIACR ioctl
> > > dump core? And all existing binaries that use the KDSKBDIACR
> > > ioctl do very strange things?
> > 
> > well, of course, existing binaries need to be recompiled,
> > that's what sources are for...
> 
> And go to hell when you boot older kernel? 

Uh, why? KDSKBDIACR ioctl checks the size of accent_table array.
(if that is what you have in mind)
All that happens is that diacritics will be messed up with 
older kernel, which is acceptable and to be expected.

> Not an option. Add new ioctl.

As it has been already said, 16-bit unicode console mode has outlived
its usefulness, and we should move to full 32 bit
support. Adding new 16-bit structures is IMHO waste of time.


-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!

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

end of thread, other threads:[~2001-10-16  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-08 19:53 [PATCH] dead keys in unicode console mode Radovan Garabik
2001-10-09  2:16 ` Guest section DW
2001-10-09  2:25   ` H. Peter Anvin
2001-10-09  7:28   ` Radovan Garabik
2001-10-10 17:19     ` Pavel Machek
2001-10-16  8:03       ` Radovan Garabik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).