git: 9front

Download patch

ref: ad46ee309f42eb2fa32974a7b6f884089b36f009
parent: f5ca49c4cae3154e77f3336f32bde34620bf99d7
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sat May 28 12:34:14 EDT 2011

kbdfs: ignore compose sequence if ctl was pressed

--- a/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -441,13 +441,13 @@
 		case Kcaps:
 		case Knum:
 		case Kshift:
-		case Kctl:
 		case Kaltgr:
-			/* ignore these special keys */
+			/* ignore modifiers */
 			continue;
 
+		case Kctl:
 		case Kalt:
-			/* latin escape! */
+			/* composing escapes */
 			return 1;
 		}
 		return 0;
@@ -463,25 +463,40 @@
 runeproc(void *)
 {
 	static struct {
-		char	*ld;		/* must be seen before using this conversion */
-		char	*si;		/* options for last input characters */
-		Rune	*so;		/* the corresponding Rune for each si entry */
+		char	*ld;	/* must be seen before using this conversion */
+		char	*si;	/* options for last input characters */
+		Rune	*so;	/* the corresponding Rune for each si entry */
 	} tab[] = {
 #include "latin1.h"
 	};
 	Rune r, rr;
 	int i, j;
+	int ctl;
 
 	threadsetname("runeproc");
 
+	ctl = 0;
 	while((i = nextrune(rawchan, &r)) >= 0){
 		if(i == 0){
+			ctl = 0;
 Forward:
 			send(runechan, &r);
 			continue;
 		}
 
-		/* latin sequence */
+		if(r == Kctl){
+			ctl = 1;
+			continue;
+		}
+
+		/*
+		 * emulators like qemu and vmware use Ctrl+Alt to lock
+		 * keyboard input so dont confuse them for a compose
+		 * sequence.
+		 */
+		if(r != Kalt || ctl)
+			continue;
+
 		if(nextrune(rawchan, &r))
 			continue;
 
@@ -500,7 +515,7 @@
 				else
 					break;
 			}
-			if(i == 4 && r > 0)
+			if(i == 4 && r)
 				goto Forward;
 		} else {
 			if(nextrune(rawchan, &rr))
--