--- qt-2.3.1/src/kernel/qapplication.h.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qapplication.h	Thu Sep  6 20:50:17 2001
@@ -324,6 +324,10 @@
     QApplication( const QApplication & );
     QApplication &operator=( const QApplication & );
 #endif
+#if !defined(NO_XIM) // by bumchul
+public:
+    static void setInputStyle(const char *);
+#endif
 };
 
 
--- qt-2.3.1/src/kernel/qapplication_x11.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qapplication_x11.cpp	Thu Sep  6 20:50:17 2001
@@ -155,6 +155,10 @@
 #include <strings.h>
 #endif
 
+#if !defined(NO_XIM)
+#include "qxim.h"
+#endif
+
 #if defined(_OS_IRIX_)
 // Please add comments! Which version of Irix?
 // Why <bstring.h> instead of <strings.h>?
@@ -429,7 +433,9 @@
 #if !defined(NO_XIM)
 XIM	qt_xim = 0;
 XIMStyle qt_xim_style = 0;
-static XIMStyle xim_preferred_style = XIMPreeditPosition | XIMStatusNothing;
+//static XIMStyle xim_preferred_style = XIMPreeditPosition | XIMStatusNothing;
+// by bumchul OnTheSpot is default
+static XIMStyle xim_preferred_style = XIMPreeditCallbacks | XIMStatusNothing; 
 #endif
 static int composingKeycode=0;
 static QTextCodec * input_mapper = 0;
@@ -562,13 +568,31 @@
     QWidgetList *list= qApp->topLevelWidgets();
     QWidgetListIt it(*list);
     while(it.current()) {
-	it.current()->topData()->xic=0;
+	//it.current()->topData()->xic=0;  
+	// by bumchul
+	it.current()->deleteXIC();
 	++it;
     }
     delete list;
 #endif
 }
 
+#if !defined(NO_XIM) // by bumchul
+void QApplication::setInputStyle(const char *str)
+{
+    QCString s = QCString(str).lower();
+   
+    if ( s == "onthespot" )
+        qt_xim_style = XIMPreeditCallbacks | XIMStatusNothing;
+    else if ( s == "overthespot" )
+        qt_xim_style = XIMPreeditPosition | XIMStatusNothing;
+    else if ( s == "offthespot" )
+        qt_xim_style = XIMPreeditArea | XIMStatusArea;
+    else if ( s == "root" )
+        qt_xim_style = XIMPreeditNothing | XIMStatusNothing;
+}
+#endif
+
 
 /*****************************************************************************
   Default X error handlers
@@ -1156,6 +1180,17 @@
 #endif
 }
 
+void qt_create_xim()
+{
+#ifdef USE_X11R6_XIM
+    XRegisterIMInstantiateCallback( appDpy, 0 , 0, 0,
+	    (XIMProc)QApplication::create_xim,
+	    0);
+#else
+    QApplication::create_xim();
+#endif
+}
+
 void qt_init_internal( int *argcptr, char **argv, Display *display )
 {
     if ( display ) {
@@ -1245,7 +1280,10 @@
 	    } else if ( arg == "-inputstyle" ) {
 		if ( ++i < argc ) {
 		    QCString s = QCString(argv[i]).lower();
-		    if ( s == "overthespot" )
+			if ( s == "onthespot" ) // by bumchul
+            xim_preferred_style = XIMPreeditCallbacks |
+                          XIMStatusNothing;
+		    else if ( s == "overthespot" )
 			xim_preferred_style = XIMPreeditPosition |
 					      XIMStatusNothing;
 		    else if ( s == "offthespot" )
@@ -1441,15 +1479,21 @@
 	else if ( XSetLocaleModifiers (ximServerName.ascii()) == 0 )
 	    qWarning( "Qt: Cannot set locale modifiers: %s",
 		      ximServerName.ascii());
+	else if ( XSetLocaleModifiers ("") == 0 )
+	    qWarning("Qt: Cannot set locale modifiers");
+	    /*
 	else if ( !noxim )
 	    XRegisterIMInstantiateCallback( appDpy, 0 , 0, 0,
 					    (XIMProc)QApplication::create_xim,
 					    0);
+	    */
 #else
 	else if ( XSetLocaleModifiers ("") == 0 )
 	    qWarning("Qt: Cannot set locale modifiers");
+	    /*
 	else if ( !noxim )
 	    QApplication::create_xim();
+	    */
 #endif
 #endif
 
@@ -4333,12 +4377,22 @@
 	    QTLWExtra*  xd = tlw->topData();
 	    if ( xd->xic ) {
 		mb=TRUE;
+		/*
 		count = XmbLookupString( (XIC)(xd->xic), &((XEvent*)event)->xkey,
 					 chars.data(), chars.size(), &key, &status );
+		*/
+		// by bumchul
+		count =  ((QXIMIC *)xd->xic)->LookupString(&((XEvent*)event)->xkey,
+					chars, &key, &status );
 		if ( status == XBufferOverflow ) {
 		    chars.resize(count+1);
+			/*
 		    count = XmbLookupString( (XIC)(xd->xic), &((XEvent*)event)->xkey,
 					 chars.data(), chars.size(), &key, &status );
+			*/
+			// by bumchul
+			count =  ((QXIMIC *)xd->xic)->LookupString(&((XEvent*)event)->xkey,
+					 chars, &key, &status );
 		}
 	    }
 	}
@@ -4649,6 +4703,19 @@
 		return TRUE;
 	}
     }
+#if !defined(NO_XIM)
+    // by bumchul Event Handling...
+    if(qt_xim_style & XIMPreeditCallbacks)
+    {
+        QWidget* tlw = topLevelWidget();
+		QTLWExtra*  xd = tlw->topData();
+        if ( xd->xic ) {
+        	//debug("event queue(e) : %s\n",e.text().local8Bit().data());
+            if(((QXIMIC *)xd->xic)->QueueKeyPressEvent(new QKeyEvent(type, code, ascii, state, text, autor, QMAX(count, int(text.length())))))
+                return TRUE;
+        }
+    }
+#endif
     return QApplication::sendEvent( this, &e );
 }
 
--- qt-2.3.1/src/kernel/qwidget.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qwidget.cpp	Thu Sep  6 20:50:17 2001
@@ -3879,6 +3879,9 @@
 	    break;
 
 	case QEvent::MouseButtonPress:
+#ifndef NO_XIM // by bumchul
+        resetXIC();
+#endif
 	    mousePressEvent( (QMouseEvent*)e );
 	    break;
 
@@ -3937,8 +3940,12 @@
 	    break;
 
 	case QEvent::FocusIn:
-	    setFontSys();
 	    focusInEvent( (QFocusEvent*)e );
+	    setFontSys(); // change step by bumchul
+#ifndef NO_XIM // by bumchul
+        resetXIC();
+        setFocusWidget();
+#endif
 	    break;
 
 	case QEvent::FocusOut:
@@ -4951,9 +4958,9 @@
     }
     if ( topData()->normalGeometry.width() < 0 )
 	topData()->normalGeometry = QRect( pos(), size() );
-    reparent( 0, WType_TopLevel | WStyle_Customize | WStyle_NoBorderEx |
+    reparent( 0, WType_TopLevel | WStyle_Customize | WStyle_NoBorderEx | WStyle_StaysOnTop |
 	      // preserve some widget flags
-	      (getWFlags() & 0xffff0000),
+	      (getWFlags() & 0xfffe0000),
 	      QPoint(0,0) );
     topData()->fullscreen = 1;
     resize( qApp->desktop()->size() );
--- qt-2.3.1/src/kernel/qwidget.h.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qwidget.h	Thu Sep  6 20:50:17 2001
@@ -615,6 +615,17 @@
     void setPalette( const QPalette &, bool iReallyMeanIt );
 #endif
     void setFont( const QFont &, bool iReallyMeanIt );
+
+#ifndef NO_XIM // by bumchul
+private:
+    void createXIC();
+    void deleteXIC();
+
+public:
+    void resetXIC();
+    void setFocusWidget();
+	void dispatchKeyPressEvent();
+#endif
 };
 
 
@@ -836,7 +847,7 @@
     uint     dnd : 1; 				// DND properties installed
     uint     uspos : 1;                         // User defined position
     uint     ussize : 1;                        // User defined size
-    void    *xic;				// XIM Input Context
+    void    *xic;					// XIM Input Context
 #endif
 #if defined(_WS_QWS_) && !defined ( QT_NO_QWS_MANAGER )
     QRegion decor_allocated_region;		// decoration allocated region
--- qt-2.3.1/src/kernel/qwidget_x11.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qwidget_x11.cpp	Thu Sep  6 20:50:17 2001
@@ -50,6 +50,11 @@
 #include "qtextcodec.h"
 #include "qt_x11.h"
 
+#if !defined(NO_XIM) // by bumchul
+#include "qxim.h"
+#endif
+
+
 // NOT REVISED
 
 void qt_enter_modal( QWidget * );		// defined in qapplication_x11.cpp
@@ -105,7 +110,9 @@
 	    FocusChangeMask |
 	    ExposureMask |
 	    PropertyChangeMask |
-	    StructureNotifyMask | SubstructureRedirectMask
+	    // StructureNotifyMask | SubstructureRedirectMask
+		// by bumchul for mapping preedit window
+		StructureNotifyMask 
 	);
 
 const uint stdDesktopEventMask =			// X event mask
@@ -632,6 +639,8 @@
     return QPoint( x, y );
 }
 
+extern void qt_create_xim();
+
 /*!
   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
@@ -655,7 +664,13 @@
 #ifndef NO_XIM
     if ( text ) {
 	QWidget* tlw = topLevelWidget();
-	if ( tlw->extra && tlw->extra->topextra &&
+
+	QTLWExtra*  xd = tlw->topData();
+	if ( !qt_xim ) qt_create_xim();
+	if ( !xd->xic ) // by bumchul
+		createXIC();	
+
+	if ( qt_xim && tlw->extra && tlw->extra->topextra &&
 	     tlw->extra->topextra->xic ) {
 	    QPoint p( x, y ); // ### use mapTo()
 	    QWidget * w = this;
@@ -664,6 +679,7 @@
 		p = w->mapToParent( p );
 		w = w->parentWidget();
 	    }
+		/*
 	    XPoint spot;
 	    spot.x = p.x();
 	    spot.y = p.y()+height;
@@ -672,6 +688,9 @@
 	    preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, (char *) 0);
 	    XSetICValues(xic, XNPreeditAttributes, preedit_attr, (char *) 0);
 	    XFree(preedit_attr);
+		*/
+		((QXIMIC *)tlw->extra->topextra->xic)->SetPreeditSpotLocation(p.x(),
+                p.y()+height); // by bumchul
 	}
     }
 #endif
@@ -722,12 +741,13 @@
 {
 #ifndef NO_XIM
     QWidget* tlw = topLevelWidget();
+
     if ( tlw->extra && tlw->extra->topextra && tlw->extra->topextra->xic ) {
-	XIC xic = (XIC)tlw->extra->topextra->xic;
 
 	XFontSet fontset = xic_fontset( fontMetrics().fontSet(),
 					font().pointSize());
 
+	/*
 	XVaNestedList preedit_att = XVaCreateNestedList( 0, XNFontSet, fontset,
 							 (char *) NULL );
 	XVaNestedList status_att = XVaCreateNestedList( 0, XNFontSet, fontset,
@@ -740,6 +760,8 @@
 
 	XFree(preedit_att);
 	XFree(status_att);
+	*/
+	((QXIMIC *)tlw->extra->topextra->xic)->SetPreeditFont(fontset); // by bumchul
     }
 #endif
 }
@@ -2128,6 +2150,11 @@
 void QWidget::createTLSysExtra()
 {
 #ifndef NO_XIM
+	/* for Test by bumchul
+	QWidget* tlw = topLevelWidget();
+	debug("createTLSysExtra - %s's winId : %#lx , tlw(%s)'s winId : %#lx\n",className(), winId(), tlw->className(), tlw->winId());
+	*/
+	/* remove by bumchul
     if ( qt_xim ) {
 	XPoint spot; spot.x = 1; spot.y = 1; // dummmy
 
@@ -2155,6 +2182,8 @@
     } else {
 	extra->topextra->xic = 0;
     }
+	*/
+	extra->topextra->xic = 0;
 #else
     extra->topextra->xic = 0;
 #endif
@@ -2164,13 +2193,69 @@
 {
 #ifndef NO_XIM
     if (extra->topextra->xic) {
+	/*
 	XUnsetICFocus( (XIC) extra->topextra->xic );
 	XDestroyIC( (XIC) extra->topextra->xic );
 	extra->topextra->xic = 0;
+	*/
+	// by bumchul
+		deleteXIC();		
     }
 #endif
 }
 
+#ifndef NO_XIM
+void QWidget::createXIC()
+{
+	QWidget* tlw = topLevelWidget();
+    if ( qt_xim ) {
+		XFontSet fontset = xic_fontset(fontMetrics().fontSet(), font().pointSize());
+		if(!tlw->extra->topextra->xic) {
+			//debug("createXIC - %s's winId : %#lx , tlw(%s)'s winId : %#lx\n",className(), winId(), tlw->className(), tlw->winId());
+			tlw->extra->topextra->xic = (void *)QXIMIC::GetQXIC(tlw, fontset);
+		}
+    } else {
+		tlw->extra->topextra->xic = 0;
+    }
+}
+
+void QWidget::deleteXIC()
+{
+    if (extra->topextra->xic) {
+        delete ((QXIMIC *)extra->topextra->xic);
+        extra->topextra->xic = 0;
+    }
+}
+
+void QWidget::resetXIC()
+{
+	if(qt_xim_style & XIMPreeditCallbacks ) {
+    	QWidget* tlw = topLevelWidget();
+    		if ( tlw->extra->topextra->xic ) {
+				//debug("resetXIC - winId : %#lx , tlw's winId : %#lx\n",winId(), tlw->winId());
+				((QXIMIC *)tlw->extra->topextra->xic)->ResetIC();
+		}
+	}
+}
+
+void QWidget::setFocusWidget()
+{
+    QWidget* tlw = topLevelWidget();
+    if ( tlw->extra->topextra->xic ) {
+		//debug("setFocusWidget - winId : %#lx , tlw's winId : %#lx\n",winId(), tlw->winId());
+		((QXIMIC *)tlw->extra->topextra->xic)->SetFocusWidget(this);
+	}
+}
+
+void QWidget::dispatchKeyPressEvent()
+{
+    QWidget* tlw = topLevelWidget();
+    if ( tlw->extra->topextra->xic ) {
+		((QXIMIC *)tlw->extra->topextra->xic)->DispatchKeyPressEvent(this);
+	}
+}
+
+#endif
 
 /*!
   Returns TRUE if drop events are enabled for this widget.
--- qt-2.3.1/src/kernel/qxim.cpp.mizi	Thu Sep  6 20:50:17 2001
+++ qt-2.3.1/src/kernel/qxim.cpp	Thu Sep  6 20:50:17 2001
@@ -0,0 +1,529 @@
+/****************************************************************************
+** $Id: qt/src/kernel/qxim.cpp   2.1.0   edited 2000-05-22 $
+**
+** Implementation of QXIM class
+**
+** Created : 20000522
+**
+** Copyright (C) 2000 Mizi Research, Inc. AS.  All rights reserved.
+**
+** Contributor(s):
+** Bumchul Kim <bumchul@mizi.com>
+**
+*****************************************************************************/
+
+#ifndef NO_XIM
+#include <stdlib.h>
+#include "qwidget.h"
+#include "qxim.h"
+#include "qximevent.h"
+#include "qapplication.h"
+
+extern XIM qt_xim;
+extern XIMStyle qt_xim_style;
+
+QXIMPreeditDrawData::QXIMPreeditDrawData()
+{
+	qCaret = 0;
+	qChangeFirst = 0;
+	qChangeLength = 0;
+	qPreeditString = QString();
+	qResetString = QString();
+}
+
+QXIMPreeditDrawData::~QXIMPreeditDrawData()
+{
+	qCaret = 0;
+	qChangeFirst = 0;
+	qChangeLength = 0;
+	delete qPreeditString;
+	delete qResetString;
+}
+
+void QXIMPreeditDrawData::SetPreeditString(const XIMText* txt, 
+						const int caret,
+						const int changefirst, 
+						const int changelength)
+{
+	char *str = 0; 
+	int len = 0; 
+
+	if (txt) {
+		if(txt->encoding_is_wchar) {
+			if(	txt->string.wide_char) {
+				int length = wcstombs(NULL, txt->string.wide_char, txt->length);
+				if(length != -1) {
+					str = new char [length + 1];
+					wcstombs(str, txt->string.wide_char, length);
+					str[length] = 0;
+					
+				}
+			}
+		} else {
+			str = txt->string.multi_byte;
+		}
+		len = txt->length;
+	}
+	if(str) {
+		//debug("preeditStr : %s\n", str);
+	 	qPreeditString = QString::fromLocal8Bit(str); 	
+		//debug("qPreeditString : %s\n", qPreeditString.local8Bit().data());
+
+		if (txt && txt->encoding_is_wchar) {
+			delete [] str;
+		}
+	}
+
+	qCaret = caret;
+	qChangeFirst = changefirst;
+	qChangeLength = changelength;
+
+		
+	if (qPreeditString.length() != len) {
+		//debug("qPreeditString.length : %d, len : %d\n", qPreeditString.length(), len);
+		qPreeditString.truncate(0);
+	}
+}
+
+QString
+QXIMPreeditDrawData::GetPreeditString() const {
+	return qPreeditString; 
+}
+
+void QXIMPreeditDrawData::SetResetString(const char * ch) 
+{
+	if(ch && ch[0]) {
+		qResetString = QString::fromLocal8Bit(ch);
+		//debug("ResetIC String : %s\n", qResetString.local8Bit().data());	
+	}
+}
+
+QString
+QXIMPreeditDrawData::GetResetString() const {
+	return qResetString; 
+}
+
+void QXIMPreeditDrawData::Reset()
+{
+	qCaret = 0;
+	qChangeFirst = 0;
+	qChangeLength = 0;
+	qPreeditString.truncate(0);
+	qResetString.truncate(0);
+} 
+
+QXIMIC::QXIMIC(QWidget *widget, XFontSet fontset)
+{
+	XPoint spot_location;
+	XRectangle preedit_area;
+	XVaNestedList preedit_attr = 0;
+
+	qFocusWidget = 0;	
+	qIC = 0;
+	qPreeditDrawData = 0;	
+
+	QWidget *qtWindow = widget;
+
+	if (!qt_xim) return;
+
+	if(!(qt_xim_style & XIMPreeditCallbacks)) {
+		preedit_area.x = 0;
+		preedit_area.y = 0;
+		preedit_area.width = qtWindow->width();
+		preedit_area.height = qtWindow->height();
+
+		if(qt_xim_style & XIMPreeditArea) {
+			preedit_attr = XVaCreateNestedList (0,
+								XNArea, &preedit_area,
+								XNFontSet, fontset,
+								0);
+		}
+		else if(qt_xim_style & XIMPreeditPosition) {
+			spot_location.x = 1;
+			spot_location.y = 1;
+			
+			preedit_attr = XVaCreateNestedList (0,
+								XNArea, &preedit_area,
+								XNFontSet, fontset,
+								XNSpotLocation, &spot_location,
+								0);
+		}
+	}
+
+	if(preedit_attr != NULL) {
+		//debug("CreateIC : Overthespot\n");
+		qIC = XCreateIC(qt_xim,
+				XNInputStyle, qt_xim_style,
+				XNClientWindow, qtWindow->winId(),
+				XNFocusWindow, qtWindow->winId(),  
+				XNPreeditAttributes, preedit_attr,
+                NULL);
+	}
+	else  {
+		//debug("CreateIC : Onthespot\n");
+		qIC = XCreateIC(qt_xim,
+				XNInputStyle, qt_xim_style,
+				XNClientWindow, qtWindow->winId(),
+				XNFocusWindow, qtWindow->winId(),  
+                NULL);
+	}
+
+	if (preedit_attr)
+    	XFree (preedit_attr);
+
+	if(qt_xim_style & XIMPreeditCallbacks) {
+
+    	QXIMCallback preedit_start_cb;
+    	QXIMCallback preedit_draw_cb;
+    	QXIMCallback preedit_done_cb;
+
+		preedit_start_cb.client_data = (char *)this;		
+		preedit_start_cb.callback = preedit_start_cbproc;
+		preedit_draw_cb.client_data = (char *)this;
+		preedit_draw_cb.callback = preedit_draw_cbproc;		
+		preedit_done_cb.client_data = (char *)this;
+		preedit_done_cb.callback = preedit_done_cbproc;		
+		preedit_attr = XVaCreateNestedList(0,
+				XNPreeditStartCallback, &preedit_start_cb,
+				XNPreeditDrawCallback, &preedit_draw_cb,
+				XNPreeditDoneCallback, &preedit_done_cb, 0);
+		XSetICValues(qIC, XNPreeditAttributes, preedit_attr, 0);
+		XFree(preedit_attr);
+	}
+	QKeyPressEventList = 0;
+} 
+
+int
+QXIMIC::preedit_start_cbproc(XIC xic, XPointer client_data,
+                                 XPointer call_data)
+{
+	QXIMIC *thisQXIC = (QXIMIC*)client_data;
+	if (!thisQXIC) return 0;
+
+	QWidget *widget = thisQXIC->qFocusWidget;		
+	if (!widget) return 0;
+
+	//debug("QXIMIC::preedit_start_cbproc winId: %#lx", widget->winId());
+
+	if (!thisQXIC->qPreeditDrawData) {
+		thisQXIC->qPreeditDrawData =	new QXIMPreeditDrawData(); 			
+	}
+	thisQXIC->qPreeditDrawData->Reset();
+
+	QXIMStartEvent ev = QXIMStartEvent();
+	QApplication::sendEvent( widget, &ev);	
+
+	return 0;
+}
+
+int
+QXIMIC::preedit_draw_cbproc(XIC xic, XPointer client_data,
+                                XPointer call_data_p)
+{
+	QXIMIC *thisQXIC = (QXIMIC*)client_data;
+	if (!thisQXIC) return 0;
+
+	QWidget *widget = thisQXIC->qFocusWidget;		
+	if (!widget) return 0;
+
+	//debug("QXIMIC::preedit_draw_cbproc winId: %#lx", widget->winId());
+
+	XIMPreeditDrawCallbackStruct *call_data = 
+		(XIMPreeditDrawCallbackStruct *) call_data_p;
+	XIMText *text = (XIMText *) call_data->text;				
+
+	if (!thisQXIC->qPreeditDrawData) {
+    	thisQXIC->qPreeditDrawData = new QXIMPreeditDrawData();
+  	}
+
+	int len = thisQXIC->qPreeditDrawData->GetResetString().length();
+
+	//debug("ResetString len : %d\n", len);
+
+	if(len) {
+		if(len == call_data->chg_length)
+			thisQXIC->qPreeditDrawData->Reset();		
+				return 0;
+	}
+
+	thisQXIC->qPreeditDrawData->SetPreeditString(text,	
+                                      call_data->caret,
+                                      call_data->chg_first,
+                                      call_data->chg_length);
+
+	QXIMDrawEvent ev = QXIMDrawEvent(
+		thisQXIC->qPreeditDrawData->GetPreeditString(),
+		thisQXIC->qPreeditDrawData->GetCaret(),
+		thisQXIC->qPreeditDrawData->GetChangeFirst(),
+		thisQXIC->qPreeditDrawData->GetChangeLength());
+	QApplication::sendEvent( widget, &ev );	
+			
+	return 0;	
+}
+
+int
+QXIMIC::preedit_done_cbproc(XIC xic, XPointer client_data,
+                                XPointer call_data_p)
+{
+	QXIMIC *thisQXIC = (QXIMIC*)client_data;
+	if (!thisQXIC) return 0;
+
+	QWidget *widget = thisQXIC->qFocusWidget;		
+	if (!widget) return 0;
+
+	//debug("QXIMIC::preedit_done_cbproc winId: %#lx", widget->winId());
+
+	QXIMDoneEvent ev = QXIMDoneEvent();
+	QApplication::sendEvent( widget, &ev);	
+
+	return 0;
+}
+	
+QWidget *
+QXIMIC::GetFocusWidget()
+{
+	return qFocusWidget;
+}
+
+void
+QXIMIC::SetFocusWidget(QWidget * widget)
+{
+	qFocusWidget = widget;
+			
+	if (qIC)
+		XSetICFocus (qIC);
+							 		
+	if(qt_xim_style & XIMPreeditPosition) {
+		SetPreeditArea(0, 0,
+			widget->width(),
+			widget->height());
+	}
+}
+
+void
+QXIMIC::UnsetFocusWidget()
+{
+	if (qIC)
+		XUnsetICFocus(qIC);
+}
+
+QXIMIC *QXIMIC::GetQXIC(QWidget * widget, XFontSet fontset)
+{
+	QXIMIC *newqxic = new QXIMIC(widget, fontset);
+	if (!newqxic->qIC) {
+		delete newqxic;
+		return NULL;
+	}
+	return newqxic;
+}
+
+QXIMIC::~QXIMIC()
+{
+	if (qPreeditDrawData) {
+		delete qPreeditDrawData;
+	}
+
+	if (qIC) {
+		XUnsetICFocus(qIC);
+		XDestroyIC(qIC);
+	}
+
+	qIC = 0;
+	qPreeditDrawData = 0;
+	qFocusWidget = 0;
+}
+
+XFontSet
+QXIMIC::GetPreeditFont() 
+{
+		return qPreeditFontset;
+}
+
+void
+QXIMIC::SetPreeditFont(XFontSet fontset) 
+{
+
+	XVaNestedList preedit_att = XVaCreateNestedList( 0, XNFontSet, fontset,
+                             NULL );
+
+	XSetICValues( qIC,
+              XNPreeditAttributes, preedit_att,
+              0 );
+
+	XFree(preedit_att);
+}
+
+typedef struct {
+	char *name;
+	XPoint *value;
+} QXIMArg;
+
+void
+QXIMIC::SetPreeditSpotLocation(unsigned long x, unsigned long y) {
+	XPoint	point;
+	QXIMArg arg[2] = {{NULL, NULL}, {NULL, NULL}};
+
+	point.x = x;
+	point.y = y;
+
+	arg->name = XNSpotLocation;
+	arg->value = &point;
+
+	XSetICValues(qIC, XNPreeditAttributes, arg, NULL);
+}
+
+void
+QXIMIC::SetPreeditArea(int x, int y, int w, int h) {
+	XRectangle rect;
+	QXIMArg arg[2] = {{NULL, NULL}, {NULL, NULL}};
+
+	rect.x = x;
+	rect.y = y;
+	rect.width = w;
+	rect.height = h;
+
+	arg->name = XNArea;
+	arg->value = (XPoint *)&rect;	
+
+	XSetICValues(qIC, XNPreeditAttributes, arg, NULL);
+}
+
+bool
+QXIMIC::IsPreeditEnable()
+{
+	if(qt_xim_style & XIMPreeditCallbacks) {
+		if(qPreeditDrawData && qPreeditDrawData->GetPreeditString().length()) { 
+			return TRUE;
+		}
+	} else {
+		XIMPreeditState preedit_state = XIMPreeditUnKnown;
+		XVaNestedList preedit_attr;
+		bool ret = FALSE; 
+
+		preedit_attr = XVaCreateNestedList(0,
+						XNPreeditAttributes, preedit_state,
+						0);
+
+		if(!XGetICValues(qIC,
+						XNPreeditAttributes, preedit_attr,
+						NULL)) {
+			if(preedit_state == XIMPreeditEnable) {
+				ret = TRUE;
+			}
+
+		} else {
+			ret = TRUE;
+		}
+		XFree(preedit_attr);
+		return ret;
+	}
+	return FALSE;
+}		
+
+void 
+QXIMIC::ResetIC()
+{
+	if (IsPreeditEnable() == FALSE) {
+		//debug("is not preediting\n");
+		return;
+	}	    	
+
+	if(!qPreeditDrawData) {
+		qPreeditDrawData = new QXIMPreeditDrawData(); 
+	}
+	qPreeditDrawData->Reset();
+
+	XIMPreeditState preedit_state = XIMPreeditUnKnown;
+	XVaNestedList preedit_attr;
+	bool state = FALSE;
+	preedit_attr = XVaCreateNestedList(0,
+						XNPreeditState, &preedit_state,
+						NULL);
+
+	if(!XGetICValues(qIC,
+					XNPreeditAttributes, preedit_attr,
+					NULL)) {
+		state = TRUE;	
+	}	
+	XFree(preedit_attr);
+
+	char *uncommitted_str = XmbResetIC(qIC);
+
+	qPreeditDrawData->SetResetString(uncommitted_str);
+
+	//debug("XIMPreeditState : %d\n", preedit_state);
+	preedit_attr = XVaCreateNestedList(0,
+							XNPreeditState, preedit_state,
+							0);
+
+	if(state) {
+		XSetICValues(qIC,	
+					XNPreeditAttributes, preedit_attr,
+					NULL);
+	}
+	XFree(preedit_attr);
+}	
+
+int
+QXIMIC::LookupString(XKeyEvent* event, QCString chars, KeySym* key, Status* status) 
+{
+	int count = 0;
+
+	if ( qt_xim ) {
+		if (qIC) {
+			count = XmbLookupString(qIC, event, chars.data(), chars.size(), key, status);				
+			if( (*status) == XBufferOverflow ) {		
+				chars.resize(count+1);
+				count = XmbLookupString(qIC, event, chars.data(), chars.size(), key, status); 
+			}
+		}
+	}
+	
+	return count;
+}
+
+bool 
+QXIMIC::QueueKeyPressEvent(QKeyEvent *event)
+{
+	if (IsPreeditEnable() == FALSE) {
+		delete event;
+		return FALSE;
+	}
+
+	if( !QKeyPressEventList ) {
+		QKeyPressEventList = new QList<QKeyEvent>;
+		//QKeyPressEventList->setAutoDelete( TRUE );
+	}	
+
+	QKeyPressEventList->append(event);
+	
+	/*
+	debug("queue event's text : %s\n",event->text().local8Bit().data());
+	debug("Queue QKeyPressEventList count : %d, pointer : %ld\n", QKeyPressEventList->count (), event);
+	*/
+	return TRUE;
+}
+
+void 
+QXIMIC::DispatchKeyPressEvent(QWidget *widget)
+{
+	int i = 0;
+	if(QKeyPressEventList) {
+		QKeyEvent *event = QKeyPressEventList->first();
+		while(event) {
+			/*
+			debug("Dispatch QKeyPressEventList count : %d(%d), pointer : %ld\n", i, QKeyPressEventList->count(), event);
+			debug("event's text : %s\n",event->text().local8Bit().data());
+			*/
+			QApplication::sendEvent(widget, event);
+			QKeyPressEventList->remove(event);
+			delete event;
+			event = QKeyPressEventList->first(); 
+			i++;
+		}	
+	}
+	delete QKeyPressEventList;
+	QKeyPressEventList = 0;
+}
+
+#endif // NO_XIM
--- qt-2.3.1/src/kernel/qxim.h.mizi	Thu Sep  6 20:50:17 2001
+++ qt-2.3.1/src/kernel/qxim.h	Thu Sep  6 20:50:17 2001
@@ -0,0 +1,96 @@
+/****************************************************************************
+** $Id: qt/src/kernel/qxim.h   2.1.0   edited 2000-05-18 $
+**
+** Definition of QXIM class
+**
+** Created : 20000518
+**
+** Copyright (C) 2000 Mizi Research, Inc. AS.  All rights reserved.
+**
+** Contributor(s):
+** Bumchul Kim <bumchul@mizi.com>
+**
+*****************************************************************************/
+
+#ifndef NO_XIM
+#ifndef QXIM_H
+#define QXIM_H
+
+#include "qt_x11.h"
+#include "qlist.h"
+
+class QXIMPreeditDrawData {
+private:
+	int 		qCaret;		// ?
+	int			qChangeFirst;
+	int			qChangeLength;
+
+	QString		qPreeditString;		// pointer�� �׽�Ʈ...
+	QString		qResetString;
+
+public:
+	QXIMPreeditDrawData();
+	~QXIMPreeditDrawData();		
+
+	int GetCaret() {return qCaret;};	
+	int GetChangeFirst() {return qChangeFirst;};	
+	int GetChangeLength() {return qChangeLength;};	
+
+	void SetPreeditString(const XIMText*, const int, const int, const int);
+	QString GetPreeditString() const;
+
+	void SetResetString(const char*);
+	QString GetResetString() const;
+
+	void Reset();
+};	 					   		
+
+class QWidget;
+class QEvent;
+
+static QList<QKeyEvent> *QKeyPressEventList;
+
+typedef int (*QXIMProc)(XIC, XPointer, XPointer);
+typedef struct {
+  XPointer client_data;
+  QXIMProc callback;
+} QXIMCallback;
+
+class QXIMIC {
+ private:
+	XIC qIC;
+	QXIMPreeditDrawData *qPreeditDrawData;
+	XFontSet qPreeditFontset;
+	QWidget *qFocusWidget;
+
+	QXIMIC(QWidget*, XFontSet);
+
+	static int preedit_start_cbproc(XIC, XPointer, XPointer);
+	static int preedit_draw_cbproc(XIC, XPointer, XPointer);
+	static int preedit_done_cbproc(XIC, XPointer, XPointer);
+
+ public:
+	~QXIMIC();
+	static QXIMIC *GetQXIC(QWidget*, XFontSet);
+	QXIMPreeditDrawData *GetPreeditDrawData() {return qPreeditDrawData;}	
+
+	void SetFocusWidget(QWidget *);
+	QWidget* GetFocusWidget();
+	void UnsetFocusWidget();
+
+	XFontSet GetPreeditFont();
+	void SetPreeditFont(XFontSet);
+
+	void SetPreeditSpotLocation(unsigned long, unsigned long);
+	void SetPreeditArea(int, int, int, int);
+
+	bool IsPreeditEnable();
+	void ResetIC();
+
+	int LookupString(XKeyEvent*, QCString, KeySym*, Status*);
+	bool QueueKeyPressEvent(QKeyEvent*);
+	void DispatchKeyPressEvent(QWidget*); 
+};
+
+#endif  // QXIM_H
+#endif	// NO_XIM
--- qt-2.3.1/src/kernel/qximevent.h.mizi	Thu Sep  6 20:50:17 2001
+++ qt-2.3.1/src/kernel/qximevent.h	Thu Sep  6 20:50:17 2001
@@ -0,0 +1,62 @@
+/****************************************************************************
+** $Id: qt/src/kernel/qximevent.h   2.1.0   edited 2000-08-10 $
+**
+** Definition of QXIMEvent class
+**
+** Created : 20000810
+**
+** Copyright (C) 2000 Mizi Research, Inc. AS.  All rights reserved.
+**
+** Contributor(s):
+** Bumchul Kim <bumchul@mizi.com>
+**
+*****************************************************************************/
+
+#ifndef NO_XIM
+#ifndef QXIMEVENT_H
+#define QXIMEVENT_H
+
+#include "qevent.h"
+
+#define QXIMDRAWEVENT 	500	
+#define QXIMSTARTEVENT  501	
+#define QXIMDONEEVENT   502	
+
+class QXIMDrawEvent : public QEvent {
+	int caret;
+	int chg_first;
+	int chg_length;
+	QString string;
+
+public:
+	QXIMDrawEvent(const QString& text, int car, int fst, int len ) : 
+		QEvent((QEvent::Type)QXIMDRAWEVENT),
+		caret(car),
+		chg_first(fst),
+		chg_length(len),
+		string(text)
+	{ }
+
+	int getCaret() const { return caret; }
+	int getChangeFirst() const { return chg_first; } 
+	int getChangeLength() const { return chg_length; }
+	QString getString() const { return string; }
+};
+
+class QXIMDoneEvent : public QEvent {
+
+public:
+	QXIMDoneEvent() : QEvent((QEvent::Type)QXIMDONEEVENT)
+	{ }
+};	
+
+class QXIMStartEvent : public QEvent {
+
+public:
+	QXIMStartEvent() : QEvent((QEvent::Type)QXIMSTARTEVENT)
+	{ }
+};	
+
+#endif  // QXIMEVENT_H
+#endif  // NO_XIM
+
--- qt-2.3.1/src/kernel/qclipboard_x11.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qclipboard_x11.cpp	Thu Sep  6 20:50:17 2001
@@ -349,6 +349,26 @@
 	    
 	    XFree( (char*)data );
 	}
+
+	// see if we read multibyte text data
+	static Atom xa_compound = *qt_xdnd_str_to_atom( "COMPOUND_TEXT" );
+	if (*format == 8 && *type == xa_compound) {
+	    XTextProperty textprop;
+	    textprop.encoding = *type;
+	    textprop.format = *format;
+	    textprop.nitems = offset;
+	    textprop.value = (unsigned char *) buffer->data();
+
+	    char **list_ret = 0;
+	    int count;
+	    if (XmbTextPropertyToTextList(dpy, &textprop, &list_ret, &count)
+		== Success && count && list_ret) {
+		offset = strlen(list_ret[0]);
+		buffer->resize(offset + (nullterm ? 1 : 0));
+		memcpy(buffer->data(), list_ret[0], offset);
+	    }
+	    if (list_ret) XFreeStringList(list_ret);
+	}
 	
 	// zero-terminate (for text)
        	if (nullterm)
@@ -519,6 +539,9 @@
 	    QByteArray data;
 	    static Atom xa_targets = *qt_xdnd_str_to_atom( "TARGETS" );
 	    static Atom xa_multiple = *qt_xdnd_str_to_atom( "MULTIPLE" );
+	    static Atom xa_utf8 = *qt_xdnd_str_to_atom( "UTF8_STRING" );
+	    static Atom xa_compound = *qt_xdnd_str_to_atom( "COMPOUND_TEXT" );
+	    static Atom xa_text = *qt_xdnd_str_to_atom( "TEXT" );
 	    struct AtomPair { Atom target; Atom property; } *multi = 0;
 	    int nmulti = 0;
 	    int imulti = -1;
@@ -554,7 +577,7 @@
 		    while (d->source()->format(atoms)) atoms++;
 		    if (d->source()->provides("image/ppm")) atoms++;
 		    if (d->source()->provides("image/pbm")) atoms++;
-		    if (d->source()->provides("text/plain")) atoms++;
+		    if (d->source()->provides("text/plain")) atoms+=3;
 
 #ifdef QT_CLIPBOARD_DEBUG
 		    qDebug("qclipboard_x11.cpp:%d: %d provided types", __LINE__, atoms);
@@ -582,8 +605,11 @@
 			atarget[n++] = XA_PIXMAP;
 		    if ( d->source()->provides("image/pbm") )
 			atarget[n++] = XA_BITMAP;
-		    if ( d->source()->provides("text/plain") )
+		    if ( d->source()->provides("text/plain") ) {
+			atarget[n++] = xa_utf8;
+			atarget[n++] = xa_compound;
 			atarget[n++] = XA_STRING;
+		    }
 
 #ifdef QT_CLIPBOARD_DEBUG
 		    for (int index = 0; index < n; index++) {
@@ -605,6 +631,32 @@
 		    bool already_done = FALSE;
 		    if ( target == XA_STRING) {
 			fmt = "text/plain";
+		    } else if ( target == xa_compound || target == xa_text) {
+			fmt = "COMPOUND_TEXT";
+			data = d->source()->encodedData(fmt);
+			char *list[] = { data.data() };
+			XICCEncodingStyle style;
+			if (target == xa_compound) {
+			    style = XCompoundTextStyle;
+			} else {
+			    style = XStdICCTextStyle;
+			}
+
+			XTextProperty textprop;
+			if (XmbTextListToTextProperty(dpy, list, 1, style,
+						    &textprop) == Success) {
+			    data.duplicate((const char *) textprop.value,
+					    textprop.nitems);
+			    XFree(textprop.value);
+			    XChangeProperty(dpy, req->requestor, property,
+                                            xa_compound,
+					    8, PropModeReplace,
+					    (unsigned char *) data.data(),
+					    data.size());
+			    evt.xselection.property = property;
+			    already_done = TRUE;
+			}
+
 		    } else if ( target == XA_PIXMAP ) {
 			fmt = "image/ppm";
 			data = d->source()->encodedData(fmt);
@@ -706,6 +758,47 @@
     // TODO: record these once
     static Atom xa_targets = *qt_xdnd_str_to_atom( "TARGETS" );
     QByteArray targets = getDataInFormat(xa_targets);
+
+    Atom* target = (Atom*)targets.data();
+    int natoms = targets.size()/sizeof(Atom);
+
+    static Atom xa_utf8 = *qt_xdnd_str_to_atom( "UTF8_STRING" );
+    static Atom xa_compound = *qt_xdnd_str_to_atom( "COMPOUND_TEXT" );
+    static Atom xa_text = *qt_xdnd_str_to_atom( "TEXT" );
+
+    int n_utf8 = -1;
+    int n_compound = -1;
+    int dn = 0;
+    for (int i = 0; i < natoms; i++) {
+	if (target[i] == xa_utf8) {
+	    n_utf8 = i;
+	    dn++;
+	}
+	if (target[i] == xa_compound) {
+	    n_compound = i;
+	    dn++;
+	}
+    }
+    if (dn > 0) {
+	int maxn = (n_utf8 > n_compound) ? n_utf8 : n_compound;
+	int minn = (n_utf8 < n_compound) ? n_utf8 : n_compound;
+	for (int i = 0; i < maxn; i++) {
+	    if (target[i] == XA_STRING || target[i] == xa_text ||
+		target[i] == xa_compound) {
+		int k = 1;
+		for (int j = maxn; j > i + (dn - 1); j--) {
+		    if (j-k == minn) {
+			k++;
+		    }
+		    target[j] = target[j-k];
+		}
+		if (n_utf8 >= 0) target[i++] = xa_utf8;
+		if (n_compound >= 0) target[i++] = xa_compound;
+		break;
+	    }
+	}
+    }
+
     if ( targets.size()/sizeof(Atom) > (uint)n ) {
 	Atom* target = (Atom*)targets.data();
 	if ( *target == XA_PIXMAP )
--- qt-2.3.1/src/kernel/qdragobject.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qdragobject.cpp	Thu Sep  6 20:50:17 2001
@@ -669,6 +669,10 @@
 	    // Don't include NUL in size (QCString::resize() adds NUL)
 	    ((QByteArray&)r).resize(r.length());
 	}
+    } else if ( 0==qstricmp(mime,"UTF8_STRING") ) {
+	r = d->txt.utf8();
+    } else if ( 0==qstricmp(mime,"COMPOUND_TEXT") ) {
+	r = d->txt.local8Bit();
     }
     return r;
 }
@@ -732,6 +736,24 @@
 			return TRUE;
 		    }
 		}
+	    }
+	} else if ( 0==qstricmp(mime,"UTF8_STRING")) {
+	    QByteArray payload;
+	    payload = e->encodedData(mime);
+	    // qDebug("QTextDrag::decode(): UTF8_STRING %d", payload.size());
+	    if ( payload.size() ) {
+		str = QString::fromUtf8(payload, payload.size());
+		subtype = "plain;charset=UTF-8";
+		return TRUE;
+	    }
+	} else if ( 0==qstricmp(mime,"COMPOUND_TEXT")) {
+	    QByteArray payload;
+	    payload = e->encodedData(mime);
+	    // qDebug("QTextDrag::decode(): COMPOUND_TEXT %d", payload.size());
+	    if ( payload.size() ) {
+		str = QString::fromLocal8Bit(payload, payload.size());
+		subtype = "plain";
+		return TRUE;
 	    }
 	}
     }
--- qt-2.3.1/src/kernel/qfontdatabase.cpp.mizi	Wed Jun 13 17:53:46 2001
+++ qt-2.3.1/src/kernel/qfontdatabase.cpp	Thu Sep  6 20:50:17 2001
@@ -59,6 +59,18 @@
 #ifdef _WS_X11_
 #include "qt_x11.h"
 
+#ifdef QT_XFT
+static bool need_helvetica = true;
+static bool need_times = true;
+QString fakeName(QString const &family)
+{
+	if(family.lower() == "helvetica" && need_helvetica)
+		return "Nimbus Sans L";
+	else if(family.lower() == "times" && need_times)
+		return "Nimbus Roman No9 L";
+	return family;
+};
+#endif
 
 static const int fontFields = 14;
 
@@ -425,7 +437,7 @@
 {
     QFont::CharSet charSet = getCharSet( parent()->name() );  // ### fttb
 
-    QFont f( family, pointSize, weight(), italic() );
+    QFont f( fakeName(family), pointSize, weight(), italic() );
     f.setCharSet( charSet );
     f.setFixedPitch(isFixedPitch());
     return f;
@@ -1210,10 +1222,53 @@
 		printf ("families ");
 		XftFontSetPrint (families);
 #endif
-		for (family_i = 0; family_i < families->nfont; family_i++) {
-		    if (XftPatternGetString (families->fonts[family_i],
+		// EVIL hack: We want to have the standard fonts (helvetica,
+		// times) available in xft mode even though we don't have
+		// scalable versions.
+		// Make sure they get in the list; the correct face will
+		// be chosen because of aliases in XftConfig.
+		for (family_i = 0; family_i < families->nfont; family_i++)
+		{
+			XftPatternGetString(families->fonts[family_i], XFT_FAMILY, 0, &family_name);
+			if(QString(family_name).lower() == "helvetica")
+				need_helvetica=false;
+			else if(QString(family_name).lower() == "times")
+				need_times=false;
+		}
+		int nfonts=families->nfont;
+		if(need_helvetica)
+			nfonts++;
+		if(need_times)
+			nfonts++;
+		XftPattern *fonts[nfonts];
+		for (family_i = 0; family_i < families->nfont; family_i++)
+			fonts[family_i]=families->fonts[family_i];
+		if(need_helvetica) {
+			fonts[family_i]=new XftPattern;
+			fonts[family_i++]->num=-1;
+		}
+		if(need_times) {
+			fonts[family_i]=new XftPattern;
+			fonts[family_i]->num=-2;
+	        }
+		for (family_i = 0; family_i < nfonts; family_i++) {
+		    bool ok=false;
+		    if (fonts[family_i]->num >= 0) {
+		    	if (XftPatternGetString (fonts[family_i],
 					     XFT_FAMILY, 0, &family_name) ==
-			XftResultMatch) {
+			    XftResultMatch) {
+			        ok=true;
+		   	}
+		    } else {
+			if(fonts[family_i]->num == -1) {
+				family_name="helvetica";
+				ok=true;
+			} else if(fonts[family_i]->num == -2) {
+				family_name="times";
+				ok=true;
+			}
+		    }
+		    if(ok) {
 			QtFontFamily *family = new QtFontFamily ( foundry, family_name);
 			CHECK_PTR (family);
 			foundry->addFamily (family);
@@ -2501,7 +2556,7 @@
 QStringList QFontDatabase::charSets( const QString &family,
                                            bool onlyForLocale ) const
 {
-    const QtFontFamily *fam = d->family( family );
+    const QtFontFamily *fam = d->family( fakeName(family) );
     return fam ? fam->charSets( onlyForLocale ) : emptyList;
 }
 
--- qt-2.3.1/src/opengl/qgl.cpp.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/opengl/qgl.cpp	Thu Sep  6 20:50:17 2001
@@ -35,6 +35,31 @@
 **
 **********************************************************************/
 
+#define weak_extern(symbol) asm (".weak " #symbol);
+ 
+weak_extern(glXQueryServerString);
+weak_extern(glColor3ub);
+weak_extern(glIndexi);
+weak_extern(glFlush);
+weak_extern(glXQueryExtension);
+weak_extern(glViewport);
+weak_extern(glXDestroyGLXPixmap);
+weak_extern(glDrawBuffer);
+weak_extern(glXMakeCurrent);
+weak_extern(glXQueryExtensionsString);
+weak_extern(glXChooseVisual);
+weak_extern(glXDestroyContext);
+weak_extern(glXWaitX);
+weak_extern(glClearColor);
+weak_extern(glClearIndex);
+weak_extern(glXGetClientString);
+weak_extern(XmuLookupStandardColormap);
+weak_extern(glXIsDirect);
+weak_extern(glXSwapBuffers);
+weak_extern(glXCreateContext);
+weak_extern(glXGetConfig);
+weak_extern(glXCreateGLXPixmap);
+
 #include "qgl.h"
 #include <qpixmap.h>
 #include <qpaintdevicemetrics.h>
--- qt-2.3.1/src/opengl/qgl_x11.cpp.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/opengl/qgl_x11.cpp	Thu Sep  6 20:50:17 2001
@@ -35,6 +35,31 @@
 **
 **********************************************************************/
 
+#define weak_extern(symbol) asm (".weak " #symbol);
+ 
+weak_extern(glXQueryServerString);
+weak_extern(glColor3ub);
+weak_extern(glIndexi);
+weak_extern(glFlush);
+weak_extern(glXQueryExtension);
+weak_extern(glViewport);
+weak_extern(glXDestroyGLXPixmap);
+weak_extern(glDrawBuffer);
+weak_extern(glXMakeCurrent);
+weak_extern(glXQueryExtensionsString);
+weak_extern(glXChooseVisual);
+weak_extern(glXDestroyContext);
+weak_extern(glXWaitX);
+weak_extern(glClearColor);
+weak_extern(glClearIndex);
+weak_extern(glXGetClientString);
+weak_extern(XmuLookupStandardColormap);
+weak_extern(glXIsDirect);
+weak_extern(glXSwapBuffers);
+weak_extern(glXCreateContext);
+weak_extern(glXGetConfig);
+weak_extern(glXCreateGLXPixmap);
+
 #include "qgl.h"
 
 #if defined(Q_GLX)
--- qt-2.3.1/src/tools/qeuckrcodec.cpp.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/tools/qeuckrcodec.cpp	Thu Sep  6 20:50:17 2001
@@ -157,6 +157,7 @@
   QString result;
   for (int i=0; i<len; i++) {
     uchar ch = chars[i];
+	if(ch == 0) break;
     if ( ch < 0x80 ) {
       // ASCII
       result += QChar(ch);
@@ -276,6 +277,7 @@
     QString result;
     for (int i=0; i<len; i++) {
       uchar ch = chars[i];
+	  if(ch == 0) break;
       switch (nbuf) {
       case 0:
 	if ( ch < 0x80 ) {
--- qt-2.3.1/src/tools/qstring.cpp.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/tools/qstring.cpp	Thu Sep  6 20:50:17 2001
@@ -13974,7 +13974,7 @@
 {
     char *end;
 
-    QCString a = latin1();
+    QCString a = local8Bit();
 
     double val = strtod( a.data() ? a.data() : "", &end );
     if ( ok )
--- qt-2.3.1/src/widgets/qlineedit.cpp.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/widgets/qlineedit.cpp	Thu Sep  6 20:50:17 2001
@@ -844,7 +844,24 @@
 	    }
 	}
     }
+#ifndef NO_XIM // by bumchul
+    if ( !QWidget::event(e) ) {
+        if ( e->type() == QXIMDRAWEVENT) {
+            return xim_preedit_draw( (QXIMDrawEvent*)e );
+        }
+        else if( e->type() == QXIMSTARTEVENT) {
+            return xim_preedit_start( (QXIMStartEvent*)e );
+        }
+        else if( e->type() == QXIMDONEEVENT) {
+            return xim_preedit_done( (QXIMDoneEvent*)e );
+        }
+        return FALSE;
+    } else {
+        return TRUE;
+    }
+#else
     return QWidget::event( e );
+#endif
 }
 
 
@@ -2003,6 +2020,42 @@
     d->undo = TRUE;
     d->needundo = TRUE;
 }
+
+#ifndef NO_XIM // by bumchul
+
+bool QLineEdit::xim_preedit_start(QXIMStartEvent* e)
+{
+    //debug("QLineEdit::xim_preedit_start");
+	return TRUE;
+}
+
+bool QLineEdit::xim_preedit_draw(QXIMDrawEvent* e)
+{
+    //debug("QLineEdit::xim_preedit_draw");
+    int chg_first = e->getChangeFirst();
+    int chg_length = e->getChangeLength();
+    QString str = e->getString();
+
+    //debug("%d %d %s %d\n", chg_first, chg_length, str.local8Bit().data(), str.length());
+
+    setUpdatesEnabled( FALSE );
+    for(int i = 0; i<chg_length; i++) backspace ();
+    insert(str);
+
+    dispatchKeyPressEvent();
+
+    setUpdatesEnabled( TRUE );
+    repaint();
+	return TRUE;
+}      
+
+bool QLineEdit::xim_preedit_done(QXIMDoneEvent* e)
+{
+    //debug("QLineEdit::xim_preedit_done");
+	return TRUE;
+}
+
+#endif // NO_XIM
 #endif
 
 
--- qt-2.3.1/src/widgets/qlineedit.h.mizi	Wed Jun 13 17:53:47 2001
+++ qt-2.3.1/src/widgets/qlineedit.h	Thu Sep  6 20:50:17 2001
@@ -47,6 +47,9 @@
 #ifndef QT_H
 #include "qwidget.h"
 #include "qstring.h"
+#ifndef NO_XIM // by bumchul
+#include "qximevent.h"
+#endif // NO_XIM 
 #endif // QT_H
 
 #ifndef QT_NO_LINEEDIT
@@ -214,6 +217,13 @@
 #if defined(Q_DISABLE_COPY)
     QLineEdit( const QLineEdit & );
     QLineEdit &operator=( const QLineEdit & );
+#endif
+
+#ifndef NO_XIM // by bumchul
+public:
+    bool xim_preedit_start(QXIMStartEvent* e);
+    bool xim_preedit_draw(QXIMDrawEvent* e);
+    bool xim_preedit_done(QXIMDoneEvent* e);
 #endif
 };
 
--- qt-2.3.1/src/widgets/qmultilineedit.cpp.mizi	Wed Jun 13 17:53:48 2001
+++ qt-2.3.1/src/widgets/qmultilineedit.cpp	Thu Sep  6 20:50:17 2001
@@ -4184,8 +4184,61 @@
 	    }
 	}
     }
+#ifndef NO_XIM // by bumchul
+	if ( !QWidget::event(e) ) {
+		if ( e->type() == QXIMDRAWEVENT) {
+			return xim_preedit_draw( (QXIMDrawEvent*)e );
+		}
+		else if( e->type() == QXIMSTARTEVENT) {
+			return xim_preedit_start( (QXIMStartEvent*)e );
+		}
+		else if( e->type() == QXIMDONEEVENT) {
+			return xim_preedit_done( (QXIMDoneEvent*)e );
+		}
+		return FALSE;
+	} else {
+		return TRUE;
+    }
+#else
     return QWidget::event( e );
+#endif
 }
+
+#ifndef NO_XIM // by bumchul
+
+bool QMultiLineEdit::xim_preedit_start(QXIMStartEvent* e)
+{
+    //debug("QMultiLineEdit::xim_preedit_start");
+	return TRUE;
+}
+
+bool QMultiLineEdit::xim_preedit_draw(QXIMDrawEvent* e)
+{
+    //debug("QMultiLineEdit::xim_preedit_draw");
+    int chg_first = e->getChangeFirst();
+    int chg_length = e->getChangeLength();
+    QString str = e->getString();
+
+    //debug("%d %d %s %d\n", chg_first, chg_length, str.local8Bit().data(), str.length());
+
+    setUpdatesEnabled( FALSE );
+    for(int i = 0; i<chg_length; i++) backspace ();
+    insert(str);
+
+    dispatchKeyPressEvent();
+
+    setUpdatesEnabled( TRUE );
+    repaint();
+	return TRUE;
+}      
+
+bool QMultiLineEdit::xim_preedit_done(QXIMDoneEvent* e)
+{
+    //debug("QMultiLineEdit::xim_preedit_done");
+	return TRUE;
+}
+
+#endif // NO_XIM
 
 /*! \reimp
 */
--- qt-2.3.1/src/widgets/qmultilineedit.h.mizi	Wed Jun 13 17:53:48 2001
+++ qt-2.3.1/src/widgets/qmultilineedit.h	Thu Sep  6 20:50:17 2001
@@ -42,6 +42,9 @@
 #include "qtableview.h"
 #include "qstring.h"
 #include "qlist.h"
+#ifndef NO_XIM // by bumchul
+#include "qximevent.h"
+#endif // NO_XIM
 #endif // QT_H
 
 #ifndef QT_NO_MULTILINEEDIT
@@ -344,6 +347,12 @@
 #if defined(Q_DISABLE_COPY)
     QMultiLineEdit( const QMultiLineEdit & );
     QMultiLineEdit &operator=( const QMultiLineEdit & );
+#endif
+#ifndef NO_XIM // by bumchul
+public:
+    bool xim_preedit_start(QXIMStartEvent* e);
+    bool xim_preedit_draw(QXIMDrawEvent* e);
+    bool xim_preedit_done(QXIMDoneEvent* e);
 #endif
 };
 
--- qt-2.3.1/src/widgets/qvalidator.cpp.mizi	Wed Jun 13 17:53:48 2001
+++ qt-2.3.1/src/widgets/qvalidator.cpp	Thu Sep  6 20:50:17 2001
@@ -317,6 +317,13 @@
   Constructs a validator object which accepts all doubles.
 */
 
+#undef HUGE_VAL
+#  define HUGE_VAL \
+  (__extension__                                                              \
+   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
+    { __l: 0x7ff0000000000000ULL }).__d)
+
+
 QDoubleValidator::QDoubleValidator( QWidget * parent, const char *name )
     : QValidator( parent, name )
 {
--- qt-2.3.1/src/Makefile.in.mizi	Wed Jun 13 17:57:02 2001
+++ qt-2.3.1/src/Makefile.in	Thu Sep  6 20:50:17 2001
@@ -132,6 +132,7 @@
 		kernel/qregion_x11.o \
 		kernel/qsound_x11.o \
 		kernel/qwidget_x11.o \
+		kernel/qxim.o \
 		kernel/qnpsupport.o \
 		kernel/qwidgetcreate_x11.o \
 		kernel/qabstractlayout.o \
