lkml.org 
[lkml]   [1999]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: PATCH: sticky shift keys: bug fix and more intuitive behaviour
Date
Andries.Brouwer@cwi.nl wrote:
> I am not so happy with this conditional stuff.

Yup, already fixed.

>> + if (kbd->slockstate & ~shift_state) return;
>
> Hmm. Very ugly. And wrong besides, I think.

My reasoning is as follows:
- Ctrl-Alt-Del has become almost synonymous for "reboot"
- Ctrl and Alt are likely to be active at the same time, possibly also
as the result of a typo (PDAs: keys are heavily overloaded, so you
end up using Alt/AltGr/etc. almost as frequently as Shift.)
- usually, when realizing that one has made a a typo, the reflex is to
hit Del (or maybe Esc)

I also thought about adding a boot_it_unshifted, with its own code, but
dismissed it as too crufty.

> So many ways to avoid a reboot by mistake other than by complicating
> the keyboard driver.

Actually, as far as PDAs are concerned, it may also be acceptable simply
not to have a keystroke for reboot at all. You can always use SysRq to
get out of real trouble. (But that's another patch ;-)

Okay, so let's drop this line. New patch attached.

- Werner

---------------------------------- cut here -----------------------------------

--- linux.orig/drivers/char/keyboard.c Tue May 11 23:37:40 1999
+++ linux/drivers/char/keyboard.c Sun May 16 17:03:59 1999
@@ -279,7 +279,8 @@
u_char type;

/* the XOR below used to be an OR */
- int shift_final = shift_state ^ kbd->lockstate ^ kbd->slockstate;
+ int shift_final = (shift_state | kbd->slockstate) ^
+ kbd->lockstate;
ushort *key_map = key_maps[shift_final];

if (key_map != NULL) {
@@ -311,6 +312,7 @@
/* we have at least to update shift_state */
#if 1 /* how? two almost equivalent choices follow */
compute_shiftstate();
+ kbd->slockstate = 0; /* play it safe */
#else
keysym = U(plain_map[keycode]);
type = KTYP(keysym);
@@ -741,7 +743,7 @@
for(j=0; j<BITS_PER_LONG; j++,k++)
if(test_bit(k, key_down)) {
sym = U(plain_map[k]);
- if(KTYP(sym) == KT_SHIFT) {
+ if(KTYP(sym) == KT_SHIFT || KTYP(sym) == KT_SLOCK) {
val = KVAL(sym);
if (val == KVAL(K_CAPSSHIFT))
val = KVAL(K_SHIFT);
@@ -793,9 +795,15 @@

static void do_slock(unsigned char value, char up_flag)
{
+ do_shift(value,up_flag);
if (up_flag || rep)
return;
chg_vc_kbd_slock(kbd, value);
+ /* try to make Alt, oops, AltGr and such work */
+ if (!key_maps[kbd->lockstate ^ kbd->slockstate]) {
+ kbd->slockstate = 0;
+ chg_vc_kbd_slock(kbd, value);
+ }
}

/*
--
_________________________________________________________________________
/ Werner Almesberger, DI-ICA,EPFL,CH werner.almesberger@lrc.di.epfl.ch /
/_IN_R_131__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.029 / U:0.692 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site