Index: gtk/gtkimcontextsimple.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkimcontextsimple.c,v
retrieving revision 1.40.2.3
diff -p -u -2 -r1.40.2.3 gtkimcontextsimple.c
--- gtk/gtkimcontextsimple.c	20 May 2005 21:07:43 -0000	1.40.2.3
+++ gtk/gtkimcontextsimple.c	25 Jun 2005 23:12:11 -0000
@@ -27,4 +27,5 @@
 
 typedef struct _GtkComposeTable GtkComposeTable;
+typedef struct _GtkComposeTable32 GtkComposeTable32;
 
 struct _GtkComposeTable 
@@ -35,4 +36,11 @@ struct _GtkComposeTable 
 };
 
+struct _GtkComposeTable32
+{
+  const guint32 *data;
+  gint max_seq_len;
+  gint n_seqs;
+};
+
 /* The following table was generated from the X compose tables include with
  * XFree86 4.0 using a set of Perl scripts. Contact Owen Taylor <otaylor@redhat.com>
@@ -908,4 +916,16 @@ static const GtkComposeTable gtk_compose
 };
 
+static const guint32 gtk_compose_seqs32[] = {
+  0x01000000 | 0x09CD,	0,	0,	0,	0x09CD, /* BENGALI SIGN VIRAMA */
+  0x01000000 | 0x09CD,	0x01000000 | 0x09BE,	0,	0,	0x0986, /* BENGALI LETTER AA */
+  0x01000000 | 0x09CD,	0x01000000 | 0x09C3,	0,	0,	0x098B, /* BENGALI LETTER VOCALIC R */  
+};
+
+static const GtkComposeTable32 gtk_compose_table32 = {
+  gtk_compose_seqs32,
+  4,
+  G_N_ELEMENTS (gtk_compose_seqs32) / 5
+};
+
 static const guint16 gtk_compose_ignore[] = {
   GDK_Shift_L,
@@ -1130,4 +1150,92 @@ check_table (GtkIMContextSimple    *cont
 }
 
+static int
+compare_seq32 (const void *key, const void *value)
+{
+  int i = 0;
+  const guint *keysyms = key;
+  const guint32 *seq = value;
+
+  while (keysyms[i])
+    {
+      if (keysyms[i] < seq[i])
+	return -1;
+      else if (keysyms[i] > seq[i])
+	return 1;
+	  
+      i++;
+    }
+
+  return 0;
+}
+
+static gboolean
+check_table32 (GtkIMContextSimple      *context_simple,
+	       const GtkComposeTable32 *table,
+	       gint                     n_compose)
+{
+  gint row_stride = table->max_seq_len + 1; 
+  guint32 *seq;
+
+  /* Will never match, if the sequence in the compose buffer is longer
+   * than the sequences in the table.  Further, compare_seq (key, val)
+   * will overrun val if key is longer than val. */
+  if (n_compose > table->max_seq_len)
+    return FALSE;
+
+  seq = bsearch (context_simple->compose_buffer,
+		 table->data, table->n_seqs,
+		 sizeof (guint32) *  row_stride, 
+		 compare_seq32);
+
+  if (seq)
+    {
+      guint32 *prev_seq;
+
+      /* Back up to the first sequence that matches to make sure
+       * we find the exact match if their is one.
+       */
+      while (seq > table->data)
+	{
+	  prev_seq = seq - row_stride;
+	  if (compare_seq32 (context_simple->compose_buffer, prev_seq) != 0)
+	    break;
+	  seq = prev_seq;
+	}
+      
+      if (n_compose == table->max_seq_len ||
+	  seq[n_compose] == 0) /* complete sequence */
+	{
+	  guint32 *next_seq;
+	  gunichar value = seq[table->max_seq_len];
+
+	  
+	  /* We found a tentative match. See if there are any longer
+	   * sequences containing this subsequence
+	   */
+	  next_seq = seq + row_stride;
+	  if (next_seq < table->data + row_stride * table->n_seqs)
+	    {
+	      if (compare_seq32 (context_simple->compose_buffer, next_seq) == 0)
+		{
+		  context_simple->tentative_match = value;
+		  context_simple->tentative_match_len = n_compose;
+
+		  g_signal_emit_by_name (context_simple, "preedit_changed");
+
+		  return TRUE;
+		}
+	    }
+
+	  gtk_im_context_simple_commit_char (GTK_IM_CONTEXT (context_simple), value);
+	  context_simple->compose_buffer[0] = 0;
+	}
+      
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 /* In addition to the table-driven sequences, we allow Unicode hex
  * codes entered with Ctrl-Shift held down as specified in ISO
@@ -1398,4 +1506,7 @@ gtk_im_context_simple_filter_keypress (G
   
       if (check_table (context_simple, &gtk_compose_table, n_compose))
+        return TRUE;
+
+      if (check_table32 (context_simple, &gtk_compose_table32, n_compose))
         return TRUE;
     }
