diff -urN qt-2.3.0.orig/src/kernel/qwidget_x11.cpp qt-2.3.0/src/kernel/qwidget_x11.cpp
--- qt-2.3.0.orig/src/kernel/qwidget_x11.cpp	Tue Mar  6 03:09:36 2001
+++ qt-2.3.0/src/kernel/qwidget_x11.cpp	Fri Mar  9 18:17:31 2001
@@ -624,6 +624,8 @@
     return QPoint( x, y );
 }
 
+static XFontSet xic_fontset(void* qfs, int pt);
+
 /*!
   When a widget gets focus, it should call setMicroFocusHint for some
   appropriate position and size - \a x, \a y and \a w by \a h.  This
@@ -647,23 +649,48 @@
 #ifndef NO_XIM
     if ( text ) {
 	QWidget* tlw = topLevelWidget();
-	if ( tlw->extra && tlw->extra->topextra &&
-	     tlw->extra->topextra->xic ) {
-	    QPoint p( x, y ); // ### use mapTo()
+	if ( qt_xim && tlw->extra && tlw->extra->topextra ) {
+	    QPoint p; // ### use mapTo()
 	    QWidget * w = this;
-	    QWidget * tlw = topLevelWidget();
 	    while ( w != tlw ) {
 		p = w->mapToParent( p );
 		w = w->parentWidget();
 	    }
-	    XPoint spot;
-	    spot.x = p.x();
-	    spot.y = p.y()+height;
+	    XPoint spot = { p.x()+x, p.y()+y+height };
+	    XRectangle pre = { p.x(), p.y(), this->width(), this->height() };
+
 	    XIC xic = (XIC)tlw->extra->topextra->xic;
-	    XVaNestedList preedit_attr;
-	    preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, 0);
-	    XSetICValues(xic, XNPreeditAttributes, preedit_attr, 0);
-	    XFree(preedit_attr);
+	    if ( !xic ) {
+		XFontSet fontset = xic_fontset( fontMetrics().fontSet(),
+ 						font().pointSize());
+
+		XVaNestedList preedit_attr = XVaCreateNestedList(0,
+				XNFontSet     , fontset,
+				XNSpotLocation, &spot  ,
+				XNArea        , &pre   ,
+				NULL);
+		XVaNestedList status_attr = XVaCreateNestedList(0,
+				XNFontSet, fontset,
+				NULL);
+		xic = XCreateIC( qt_xim,
+				XNInputStyle       , qt_xim_style,
+				XNClientWindow     , tlw->winId(),
+				XNFocusWindow      , tlw->winId(),
+				XNPreeditAttributes, preedit_attr,
+				XNStatusAttributes , status_attr ,
+				0 );
+		XFree( preedit_attr );
+		XFree(  status_attr );
+		if ( xic ) XSetICFocus( xic );
+		tlw->extra->topextra->xic = (void*)xic;
+	    } else {
+		XVaNestedList preedit_attr = XVaCreateNestedList(0,
+				XNSpotLocation, &spot,
+				XNArea        , &pre ,
+				NULL);
+		XSetICValues( xic, XNPreeditAttributes, preedit_attr, 0 );
+		XFree( preedit_attr );
+	    }
 	}
     }
 #endif
@@ -2114,6 +2141,7 @@
 void QWidget::createTLSysExtra()
 {
 #ifndef NO_XIM
+/*
     if ( qt_xim ) {
 	XPoint spot; spot.x = 1; spot.y = 1; // dummmy
 
@@ -2139,6 +2167,7 @@
 	XFree(status_att);
 
     } else {
+*/  {
 	extra->topextra->xic = 0;
     }
 #else
