static nsIUnicodeDecoder *decoder = nsnull; if (!decoder) { decoder = open_unicode_decoder(); } if (decoder && (!kevent.keyCode)) {
if (nsGtkIMEHelper::GetSingleton() && (!kevent.keyCode)) {
gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p){  nsKeyEvent kevent;  nsWindow* win = (nsWindow*)p;  // work around for annoying things.  if (event->keyval == GDK_Tab)    if (event->state & GDK_CONTROL_MASK)      if (event->state & GDK_MOD1_MASK)        return PR_FALSE;  // Don't pass shift, control and alt as key press events  if (event->keyval == GDK_Shift_L      || event->keyval == GDK_Shift_R      || event->keyval == GDK_Control_L      || event->keyval == GDK_Control_R)    return PR_TRUE;  win->AddRef();  //  // First, dispatch the Key event as a virtual key down event  //  InitKeyEvent(event, p, kevent, NS_KEY_DOWN);  win->OnKey(kevent);   //  // Second, dispatch the Key event as a key press event w/ a Unicode  //  character code.  Note we have to check for modifier keys, since  // gtk returns a character value for them  //  if (event->length) {    static nsIUnicodeDecoder *decoder = nsnull;    if (!decoder) {      decoder = open_unicode_decoder();    }    if (decoder && (!kevent.keyCode)) {      nsEventStatus status;      composition_start(event, win, &status);      composition_draw(event, win, decoder, &status);      composition_end(event, win, &status);    } else {      InitKeyPressEvent(event,p, kevent);      win->OnKey(kevent);      nsEventStatus status;      composition_start(event, win, &status);      composition_end(event, win, &status);    }  } else { // for Home/End/Up/Down/Left/Right/PageUp/PageDown key    InitKeyPressEvent(event,p, kevent);    win->OnKey(kevent);  }  win->Release();  if (w)  {    gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");  }  return PR_TRUE;}