--- vte.c.orig	2004-05-02 02:43:01.000000000 -0400
+++ vte.c	2004-06-08 23:33:08.000000000 -0400
@@ -8262,6 +8262,7 @@
 	gboolean scrolled = FALSE, steal = FALSE, modifier = FALSE, handled,
 		 suppress_meta_esc = FALSE;
 	guint keyval = 0;
+	guint16 keycode = 0;
 	gunichar keychar = 0;
 	char keybuf[VTE_UTF8_BPC];
 	GdkModifierType modifiers;
@@ -8286,6 +8287,7 @@
 	if (event->type == GDK_KEY_PRESS) {
 		/* Store a copy of the key. */
 		keyval = event->keyval;
+		keycode = event->hardware_keycode;
 		if (gdk_event_get_state((GdkEvent*)event, &modifiers)) {
 			terminal->pvt->modifiers = modifiers;
 		} else {
@@ -8537,6 +8539,27 @@
 		/* If we didn't manage to do anything, try to salvage a
 		 * printable string. */
 		if (!handled && (normal == NULL) && (special == NULL)) {
+			guint old_keyval = keyval; 
+			/* If control is down (and we don't have a character
+			   affected by Control already), see if there is one 
+			   in another group. 
+			   This is useful if one of your group remaps 
+			   essential keys like 'Z' or 'C' to something else. */
+			if ((GDK_MODIFIER_MASK & GDK_CONTROL_MASK) && (keyval >= 0x80 || keyval < 0x40)) {
+				int i;
+				GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default());
+				/* X has 4 groups, Win32 has 2 (and ignores the rest). */
+				for (i = 0; i < 4; ++i) {
+					if (gdk_keymap_translate_keyboard_state(keymap, keycode, 
+						modifiers & GDK_MODIFIER_MASK, i,
+						&keyval, NULL, NULL, NULL) && 
+						(keyval >= 0x40 && keyval < 0x80))
+						break;
+				}
+				if (i == 4)
+					keyval = old_keyval;
+			} 
+
 			/* Convert the keyval to a gunichar. */
 			keychar = gdk_keyval_to_unicode(keyval);
 			normal_length = 0;
@@ -8551,6 +8574,7 @@
 					normal = NULL;
 				}
 			}
+
 			if ((normal != NULL) &&
 			    (terminal->pvt->modifiers & GDK_CONTROL_MASK)) {
 				/* Replace characters which have "control"
@@ -8565,9 +8589,10 @@
 #ifdef VTE_DEBUG
 			if (normal && _vte_debug_on(VTE_DEBUG_EVENTS)) {
 				fprintf(stderr, "Keypress, modifiers=0x%x, "
-					"keyval=0x%x, cooked string=`%s'.\n",
+					"keyval=0x%x, old keyval=0x%x, "
+					"cooked string=`%s'.\n",
 					terminal->pvt->modifiers,
-					keyval, normal);
+					keyval, old_keyval, normal);
 			}
 #endif
 		}
