patch-2.3.3 linux/drivers/char/keyboard.c

Next file: linux/drivers/char/pcxx.c
Previous file: linux/drivers/char/h8.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.2/linux/drivers/char/keyboard.c linux/drivers/char/keyboard.c
@@ -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);
@@ -472,6 +474,7 @@
 
 static void boot_it(void)
 {
+	if (kbd->slockstate & ~shift_state) return;
 	ctrl_alt_del();
 }
 
@@ -741,7 +744,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 +796,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);
+	}
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)