--- src/command.c.orig	Tue Apr 17 10:27:59 2001
+++ src/command.c	Tue Apr 17 10:31:19 2001
@@ -2128,11 +2128,17 @@
     static int      bypass_keystate = 0;
     int             reportmode;
     static int      csrO = 0;	/* Hops - csr offset in thumb/slider      */
+    int             k_status;
+    char            kbuf[256];
 
 /*        to give proper Scroll behaviour */
     switch (ev->type) {
     case KeyPress:
-	lookup_key(ev);
+	k_status = send_key(Xdisplay, TermWin.parent, &ev->xkey, kbuf);
+	if (!k_status)
+	     lookup_key(ev);
+        else if (kbuf[0])
+	    tt_write(kbuf, strlen(kbuf));
 	break;
 
     case ClientMessage:
@@ -2197,6 +2203,7 @@
 
     case FocusIn:
 	if (!TermWin.focus) {
+	    send_FocusIn(Xdisplay, TermWin.parent);
 	    TermWin.focus = 1;
 #ifdef OFF_FOCUS_FADING
 	    if( rs_fade != NULL )
