diff -uNr dia-0.88.1.orig/app/disp_callbacks.c dia-0.88.1/app/disp_callbacks.c
--- dia-0.88.1.orig/app/disp_callbacks.c	Tue May  1 09:55:36 2001
+++ dia-0.88.1/app/disp_callbacks.c	Sat Sep 22 18:56:45 2001
@@ -209,11 +209,6 @@
   GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
   gtk_widget_draw_focus(widget);
 
-#ifdef USE_XIM
-  if (ddisp->ic)
-    gdk_im_begin(ddisp->ic, widget->window);
-#endif
-
   return FALSE;
 }
 
@@ -234,10 +229,6 @@
   GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
   gtk_widget_draw_focus (widget);
 
-#ifdef USE_XIM
-  gdk_im_end ();
-#endif
-
   return return_val;
 }
 
@@ -250,8 +241,30 @@
   g_return_if_fail(data != NULL);
 
   ddisp = (DDisplay *)data;
+}
+
+void
+ddisplay_unrealize (GtkWidget *widget, gpointer data)
+{
+  DDisplay *ddisp;
+  
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (data != NULL);
+
+  ddisp = (DDisplay *) data;
+}
 
 #ifdef USE_XIM
+void
+ddisplay_canvas_realize(GtkWidget *widget, gpointer data)
+{
+  DDisplay *ddisp;
+
+  g_return_if_fail(widget != NULL);
+  g_return_if_fail(data != NULL);
+
+  ddisp = (DDisplay *)data;
+
   if (gdk_im_ready() && (ddisp->ic_attr = gdk_ic_attr_new()) != NULL) {
     gint width, height;
     GdkColormap *colormap;
@@ -310,11 +323,10 @@
 	gdk_im_begin(ddisp->ic, widget->window);
     }
   }
-#endif
 }
 
 void
-ddisplay_unrealize (GtkWidget *widget, gpointer data)
+ddisplay_canvas_unrealize (GtkWidget *widget, gpointer data)
 {
   DDisplay *ddisp;
   
@@ -323,18 +335,14 @@
 
   ddisp = (DDisplay *) data;
 
-#ifdef USE_XIM
   if (ddisp->ic)
     gdk_ic_destroy (ddisp->ic);
   ddisp->ic = NULL;
   if (ddisp->ic_attr)
     gdk_ic_attr_destroy (ddisp->ic_attr);
   ddisp->ic_attr = NULL;
-#endif
- 
 }
 
-#ifdef USE_XIM
 static void
 set_input_dialog(DDisplay *ddisp, int x, int y)
 {
@@ -365,6 +373,9 @@
   GdkEventExpose *eevent;
   GdkEventMotion *mevent;
   GdkEventButton *bevent;
+#ifdef USE_XIM
+  GdkEventFocus *fevent;
+#endif
   GdkEventKey *kevent;
   gint tx, ty;
   GdkModifierType tmask;
@@ -419,6 +430,15 @@
 
     case GDK_FOCUS_CHANGE:
       diagram_update_menu_sensitivity(ddisp->diagram);
+#ifdef USE_XIM
+      fevent = (GdkEventFocus *) event;
+      if (fevent->in) {
+        if (ddisp->ic)
+          gdk_im_begin(ddisp->ic, canvas->window);
+	  } else {
+        gdk_im_end ();
+	  }
+#endif
       break;
       
     case GDK_2BUTTON_PRESS:
diff -uNr dia-0.88.1.orig/app/disp_callbacks.h dia-0.88.1/app/disp_callbacks.h
--- dia-0.88.1.orig/app/disp_callbacks.h	Sun Nov 26 00:27:34 2000
+++ dia-0.88.1/app/disp_callbacks.h	Sat Sep 22 18:57:06 2001
@@ -33,6 +33,10 @@
 			       gpointer data);
 void ddisplay_realize (GtkWidget *widget, gpointer data);
 void ddisplay_unrealize (GtkWidget *widget, gpointer data);
+#ifdef USE_XIM
+void ddisplay_canvas_realize (GtkWidget *widget, gpointer data);
+void ddisplay_canvas_unrealize (GtkWidget *widget, gpointer data);
+#endif
 
 gint ddisplay_canvas_events (GtkWidget *, GdkEvent *, DDisplay *ddisp);
 void ddisplay_popup_menu(DDisplay *ddisp, GdkEventButton *event);
diff -uNr dia-0.88.1.orig/app/interface.c dia-0.88.1/app/interface.c
--- dia-0.88.1.orig/app/interface.c	Mon Mar 26 10:05:16 2001
+++ dia-0.88.1/app/interface.c	Sat Sep 22 18:56:12 2001
@@ -344,6 +344,14 @@
   gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "event",
 		      (GtkSignalFunc) ddisplay_canvas_events,
 		      ddisp);
+#ifdef USE_XIM
+  gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "realize",
+                      GTK_SIGNAL_FUNC (ddisplay_canvas_realize),
+                      ddisp);
+  gtk_signal_connect (GTK_OBJECT (ddisp->canvas), "unrealize",
+                      GTK_SIGNAL_FUNC (ddisplay_canvas_unrealize),
+                      ddisp);
+#endif
 
   gtk_drag_dest_set(ddisp->canvas, GTK_DEST_DEFAULT_ALL,
 		    create_object_targets, 1, GDK_ACTION_COPY);
diff -uNr dia-0.88.1.orig/po/ja.po dia-0.88.1/po/ja.po
--- dia-0.88.1.orig/po/ja.po	Sat Mar 17 00:21:23 2001
+++ dia-0.88.1/po/ja.po	Sat Sep 22 17:58:31 2001
@@ -1040,7 +1040,7 @@
 
 #: app/menus.c:307
 msgid "/View/Diagram Properties"
-msgstr "/¥À¥¤¥¢¥í¥°(_D)/¥×¥í¥Ñ¥Æ¥£(_P)"
+msgstr "/É½¼¨(_V)/¥À¥¤¥¢¥í¥°¤Î¥×¥í¥Ñ¥Æ¥£(_P)"
 
 #: app/menus.c:309
 msgid "/View/_AntiAliased"
