cmd/devdraw: clear keyboard state on lost focus.

See https://bitbucket.org/rsc/plan9port/issue/128/alt-button-sticks-in-acme-sometimes-after

R=rsc
https://codereview.appspot.com/11453043
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 73171a9..c49c9cd 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -40,6 +40,7 @@
 Richard Miller <millerresearch@gmail.com>
 Rob Kroeger <robkroeger@gmail.com>
 Rob Pike <robpike@gmail.com>
+Roger Peppe <rogpeppe@gmail.com>
 Russ Cox <rsc@swtch.com>
 Sean McKean <smckean83@gmail.com>
 Shenghou Ma <minux.ma@gmail.com>
diff --git a/src/cmd/devdraw/x11-srv.c b/src/cmd/devdraw/x11-srv.c
index 04ecabe..b934391 100644
--- a/src/cmd/devdraw/x11-srv.c
+++ b/src/cmd/devdraw/x11-srv.c
@@ -619,6 +619,12 @@
 		break;
 	
 	case FocusOut:
+		/*
+		 * Some key combinations (e.g. Alt-Tab) can cause us
+		 * to see the key down event without the key up event,
+		 * so clear out the keyboard state when we lose the focus.
+		 */
+		kstate = 0;
 		abortcompose();
 		break;