-rename the "KS_GROUP_Ascii" key symbol category to "Plain" because

this is what it meant all the time -- it includes characters >127
-delegate translation of all key symbols >127 to the terminal emulation
 layer -- formerly everything non-special was passed to the tty subsystem
 directly, involving truncation to a "char", which effectively meant
 some ISO-1 assumption
This commit is contained in:
drochner 2010-01-28 22:36:19 +00:00
parent e8ef955492
commit 25fb8de00b
7 changed files with 44 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.127 2010/01/08 19:51:11 dyoung Exp $ */
/* $NetBSD: wsdisplay.c,v 1.128 2010/01/28 22:36:19 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.127 2010/01/08 19:51:11 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.128 2010/01/28 22:36:19 drochner Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_wsmsgattrs.h"
@ -1672,13 +1672,13 @@ wsdisplay_kbdinput(device_t dv, keysym_t ks)
tp = scr->scr_tty;
if (KS_GROUP(ks) == KS_GROUP_Ascii)
if (KS_GROUP(ks) == KS_GROUP_Plain && KS_VALUE(ks) <= 0x7f)
(*tp->t_linesw->l_rint)(KS_VALUE(ks), tp);
else if (WSSCREEN_HAS_EMULATOR(scr)) {
count = (*scr->scr_dconf->wsemul->translate)
(scr->scr_dconf->wsemulcookie, ks, &dp);
while (count-- > 0)
(*tp->t_linesw->l_rint)(*dp++, tp);
(*tp->t_linesw->l_rint)((unsigned char)(*dp++), tp);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_dumb.c,v 1.14 2006/11/16 01:33:31 christos Exp $ */
/* $NetBSD: wsemul_dumb.c,v 1.15 2010/01/28 22:36:19 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.14 2006/11/16 01:33:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.15 2010/01/28 22:36:19 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.14 2006/11/16 01:33:31 christos Ex
#include <dev/wscons/wsdisplayvar.h>
#include <dev/wscons/wsemulvar.h>
#include <dev/wscons/ascii.h>
#include <dev/wscons/wsksymdef.h>
void *wsemul_dumb_cnattach(const struct wsscreen_descr *, void *,
int, int, long);
@ -203,6 +204,14 @@ int
wsemul_dumb_translate(void *cookie, keysym_t in,
const char **out)
{
static char c;
if (KS_GROUP(in) == KS_GROUP_Plain) {
/* allow ISO-1 */
c = KS_VALUE(in);
*out = &c;
return (1);
}
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_sun.c,v 1.26 2006/11/16 01:33:31 christos Exp $ */
/* $NetBSD: wsemul_sun.c,v 1.27 2010/01/28 22:36:19 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -33,7 +33,7 @@
/* XXX DESCRIPTION/SOURCE OF INFORMATION */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.26 2006/11/16 01:33:31 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.27 2010/01/28 22:36:19 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -545,6 +545,13 @@ wsemul_sun_translate(void *cookie, keysym_t in, const char **out)
{
static char c;
if (KS_GROUP(in) == KS_GROUP_Plain) {
/* allow ISO-1 */
c = KS_VALUE(in);
*out = &c;
return (1);
}
if (KS_GROUP(in) == KS_GROUP_Keypad && (in & 0x80) == 0) {
c = in & 0xff; /* turn into ASCII */
*out = &c;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsemul_vt100_keys.c,v 1.9 2005/12/11 12:24:12 christos Exp $ */
/* $NetBSD: wsemul_vt100_keys.c,v 1.10 2010/01/28 22:36:19 drochner Exp $ */
/*
* Copyright (c) 1998
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_keys.c,v 1.9 2005/12/11 12:24:12 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_keys.c,v 1.10 2010/01/28 22:36:19 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -87,6 +87,12 @@ wsemul_vt100_translate(void *cookie, keysym_t in, const char **out)
struct wsemul_vt100_emuldata *edp = cookie;
static char c;
if (KS_GROUP(in) == KS_GROUP_Plain) {
/* catch ISO-1 */
c = KS_VALUE(in);
*out = &c;
return (1);
}
if (in >= KS_f1 && in <= KS_f20) {
*out = vt100_fkeys[in - KS_f1];
return (5);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbd.c,v 1.125 2010/01/13 05:08:24 macallan Exp $ */
/* $NetBSD: wskbd.c,v 1.126 2010/01/28 22:36:19 drochner Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -105,7 +105,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.125 2010/01/13 05:08:24 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.126 2010/01/28 22:36:19 drochner Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -761,7 +761,7 @@ wskbd_rawinput(device_t dev, u_char *tbuf, int len)
if (sc->sc_base.me_dispdv != NULL)
for (i = 0; i < len; i++)
wsdisplay_kbdinput(sc->sc_base.me_dispdv, tbuf[i]);
/* this is KS_GROUP_Ascii */
/* this is KS_GROUP_Plain */
#endif
}
#endif /* WSDISPLAY_COMPAT_RAWKBD */
@ -1392,7 +1392,7 @@ wskbd_cngetc(dev_t dev)
for(;;) {
if (num-- > 0) {
ks = wskbd_console_data.t_symbols[pos++];
if (KS_GROUP(ks) == KS_GROUP_Ascii)
if (KS_GROUP(ks) == KS_GROUP_Plain)
return (KS_VALUE(ks));
} else {
(*wskbd_console_data.t_consops->getc)
@ -1794,7 +1794,7 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
res = KS_voidSymbol;
switch (KS_GROUP(ksym)) {
case KS_GROUP_Ascii:
case KS_GROUP_Plain:
case KS_GROUP_Keypad:
case KS_GROUP_Function:
res = ksym;
@ -1835,7 +1835,7 @@ wskbd_translate(struct wskbd_internal *id, u_int type, int value)
update_leds(id);
/* We are done, return the symbol */
if (KS_GROUP(res) == KS_GROUP_Ascii) {
if (KS_GROUP(res) == KS_GROUP_Plain) {
if (MOD_ONESET(id, MOD_ANYCONTROL)) {
if ((res >= KS_at && res <= KS_z) || res == KS_space)
res = res & 0x1f;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbdutil.c,v 1.16 2009/04/06 17:32:09 mkirby Exp $ */
/* $NetBSD: wskbdutil.c,v 1.17 2010/01/28 22:36:19 drochner Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wskbdutil.c,v 1.16 2009/04/06 17:32:09 mkirby Exp $");
__KERNEL_RCSID(0, "$NetBSD: wskbdutil.c,v 1.17 2010/01/28 22:36:19 drochner Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -354,7 +354,7 @@ ksym_upcase(keysym_t ksym)
if (ksym >= KS_f1 && ksym <= KS_f20)
return(KS_F1 - KS_f1 + ksym);
if (KS_GROUP(ksym) == KS_GROUP_Ascii && ksym <= 0xff &&
if (KS_GROUP(ksym) == KS_GROUP_Plain && ksym <= 0xff &&
latin1_to_upper[ksym] != 0x00)
return(latin1_to_upper[ksym]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsksymdef.h,v 1.63 2009/04/06 17:32:09 mkirby Exp $ */
/* $NetBSD: wsksymdef.h,v 1.64 2010/01/28 22:36:19 drochner Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -601,7 +601,7 @@
#define KS_GROUP_Command 0xf400U
#define KS_GROUP_Internal 0xf500U
#define KS_GROUP_Dead 0xf801U /* not encoded in keysym */
#define KS_GROUP_Ascii 0xf802U /* not encoded in keysym */
#define KS_GROUP_Plain 0xf802U /* not encoded in keysym */
#define KS_GROUP_Keycode 0xf803U /* not encoded in keysym */
#define KS_NUMKEYCODES 0x1000
@ -610,7 +610,7 @@
#define KS_GROUP(k) ((k) >= 0x0300 && (k) < 0x0370 ? KS_GROUP_Dead : \
(((k) & 0xf000) == 0xe000 ? KS_GROUP_Keycode : \
(((k) & 0xf800) == 0xf000 ? ((k) & 0xff00) : \
KS_GROUP_Ascii)))
KS_GROUP_Plain)))
#define KS_VALUE(k) (((k) & 0xf000) == 0xe000 ? ((k) & 0x0fff) : \
(((k) & 0xf800) == 0xf000 ? ((k) & 0x00ff) : (k)))