|
XCIN Mail-list
|
| Indexed By Date: [Previous] [Next] | Indexed By Thread: [Previous] [Next] |
| Subject: | Qt-1.44 XIM patch |
| From: | Tung-Han Hsieh <thhsieh@linux.org.tw> |
| Date: | Sun, 18 Jul 1999 23:39:32 +0800 |
| To: | xcin@linux.org.tw |
| Reply-To: | xcin@linux.org.tw |
Hi,
³o¬O·sªº patch, ²{¦b KDE kedit ªº XIM ³¡¤À¥i¥H»¡¡u´X¥G¡v¥¿±`¤F¡A
¥]¬A¥i¥Hª½±µ¦Û xcin-2.5 ¿é¤J¤¤¤å¡B xcin-2.5 Ãö±¼©Î¦A±Ò°Êµ¥³£¤£·|
¨Ï kedit ±¾±¼¤F¡C
¥Ñ©ó§Ú¹ï Qt ¤£¤Ó¼ô¡A§K±j°µ¤F³o¨Ç patch Ãø«O¤£·|¤Þ¤J·sªº bug, ©Î
°§C Qt 즳ªº®Ä¯à¡A¦]¦¹§Ú§Æ±æ°ª¤â̦pªG¦³ªÅªº¸Ü¯àÀ°¦£¬Ý¤@¤U³oÓ
patch (gamete ¥S¡A¦³¿³½ì¶Ü? :-))
¥Ø«e§Ú¸Õªºµ²ªG¡A kedit ¬O°ÝÃD³Ì¤Öªº¡A konsole ¦b§Úªº¾÷¾¹¶]¤£°_¨Ó
(¦ü¥G¬O QFont::load ªº°ÝÃD¡A¬O©Ò»P§Úªº patch ¦³ÃöÁ٫ݬd), ¦Ó knote
¥i¥H¨Ï¥Î XIM, ¦ýµLªk¶¶§Qµ²§ô¡A¤£ª¾¹D¬O¨ºùتº bug? «Ý¬d ....
·Qn¸ÕÅ窺ªB¤Í¡A½Ð§ì¦^ qt-1.44-8CLE.src.rpm, °µ¦nùØÀY´£¨Ñªº¤TÓ
patch ¤§«á¡A¦A¨Ó apply §Ú©³¤U³oÓ patch ¡Cn°õ¦æ kedit ®É¡A½Ð¨Ì
·Ó¥H¤Uªº¨BÆJ:
export LANG=zh_TW.Big5
export XMODIFIERS="@im=xcin"
kedit &
patch ¤º®e¦p«á (ª`·N§Ú¬O¥Î·Æ¹« cut & copy ªº¡A³¡ tab ¦r¤¸·|¥¢¯u)¡C
T.H.Hsieh
=====================================================================
diff --unified -r qt-1.44.orig/src/kernel/qapplication_x11.cpp qt-1.44/src/kerne
l/qapplication_x11.cpp
--- qt-1.44.orig/src/kernel/qapplication_x11.cpp Sun Jul 18 22:13:18 1999
+++ qt-1.44/src/kernel/qapplication_x11.cpp Sun Jul 18 22:18:17 1999
@@ -473,6 +473,32 @@
qt_init() - initializes Qt for X11
*****************************************************************************/
+static void
+destroy_callback_func(XIM current_ic, XPointer client_data, XPointer call_data)
+{
+ xim = NULL;
+#ifdef DBG
+ printf("destroy_callback_func\n");
+#endif
+}
+
+static void
+im_callback(Display *display, XPointer client_data, XPointer call_data)
+{
+ XIMCallback destroy;
+
+ if (! (xim = XOpenIM(appDpy, NULL, NULL, NULL))) {
+#ifdef DBG
+ printf(_("Cannot open the connection to XIM server.\n"));
+#endif
+ return;
+ }
+ destroy.callback = destroy_callback_func;
+ destroy.client_data = NULL;
+ XSetIMValues(xim, XNDestroyCallback, &destroy, NULL);
+// QWidget::setInputMethodEnabled( True );
+}
+
static void qt_init_internal( int *argcptr, char **argv, Display *display )
{
if ( display ) {
@@ -683,15 +719,15 @@
#if !defined(NO_XIM)
if ( XSupportsLocale() &&
( qstrlen(XSetLocaleModifiers( "" )) ||
- qstrlen(XSetLocaleModifiers( "@im=none" ) ) ) )
+ qstrlen(XSetLocaleModifiers( "@im=none" ) ) ) ) {
+ if (XRegisterIMInstantiateCallback(
+ appDpy, NULL, NULL, NULL, im_callback, NULL) != True) {
#ifdef DBG
- {
-#endif
- xim = XOpenIM( appDpy, 0, 0, 0 );
-#ifdef DBG
- printf("XOpenIM() -> 0x%x\n", xim);
- }
+ printf(_("XRegisterIMInstantiateCallback false.\n"));
#endif
+ xim = 0;
+ }
+ }
else
xim = 0;
#endif
@@ -1837,6 +1873,8 @@
if ( quit_now ) // quit between events
return FALSE;
XNextEvent( appDpy, &event ); // get next event
+ if (XFilterEvent(&event, None) == True)
+ return FALSE;
nevents++;
if ( x11ProcessEvent( &event ) == 1 )
@@ -1941,9 +1979,11 @@
else if ( f )
f = (QETWidget*)f->topLevelWidget();
}
+/*
if ( XFilterEvent( (XEvent*)event, f ? f->winId() : None ) ) {
return 1;
}
+*/
#endif
#endif
@@ -2052,6 +2092,15 @@
if ( !qApp->focus_widget || qApp->focus_widget != w ) { // short-circ
if ( qApp->focus_widget ) {
// Inconsistent messages from X. Force a focus out.
+ if (! xim)
+ qApp->focus_widget->setInputMethodEnabled(FALSE);
+ else if (qApp->focus_widget->isInputMethodEnabled() == FALSE) {
+ qApp->focus_widget->setInputMethodStyle(
+ QWidget::IMSNothing, QWidget::IMSNothing);
+ if (qApp->focus_widget->isInputMethodEnabled() == FALSE)
+ qApp->focus_widget->setInputMethodEnabled(TRUE);
+ }
+
#if !defined(NO_XIM)
if ( /*xim && */qApp->focus_widget->isInputMethodEnabled() ) {
QWExtra *ed = qApp->focus_widget->extraData();
@@ -2079,6 +2128,15 @@
}
if ( w && (w->isFocusEnabled() || w->isTopLevel()) ) {
qApp->focus_widget = w;
+ if (! xim)
+ w->setInputMethodEnabled(FALSE);
+ else if (w->isInputMethodEnabled() == FALSE) {
+ w->setInputMethodStyle(
+ QWidget::IMSNothing, QWidget::IMSNothing);
+ if (w->isInputMethodEnabled() == FALSE)
+ w->setInputMethodEnabled(TRUE);
+ }
+
#if !defined(NO_XIM)
if ( /*xim && */w->isInputMethodEnabled() ) {
QWExtra *ed = w->extraData();
@@ -2119,6 +2177,14 @@
#endif
if ( focus_widget ) {
#if !defined(NO_XIM)
+ if (! xim)
+ focus_widget->setInputMethodEnabled(FALSE);
+ else if (focus_widget->isInputMethodEnabled() == FALSE)
+ focus_widget->setInputMethodStyle(
+ QWidget::IMSNothing, QWidget::IMSNothing);
+ if (focus_widget->isInputMethodEnabled() == FALSE)
+ focus_widget->setInputMethodEnabled(TRUE);
+
if ( /*xim && */focus_widget->isInputMethodEnabled() ) {
QWExtra *ed = focus_widget->extraData();
if ( ed && ed->xic ) {
@@ -3187,7 +3253,15 @@
printf("KeyPress : keycode 0x%x\n");
#endif
XIC xic = 0;
- if ( xim && isInputMethodEnabled() ) {
+
+ if (! xim)
+ setInputMethodEnabled(FALSE);
+ else if (isInputMethodEnabled() == FALSE)
+ setInputMethodStyle(QWidget::IMSNothing, QWidget::IMSNothing);
+ if (isInputMethodEnabled() == FALSE)
+ setInputMethodEnabled(TRUE);
+
+ if ( /*xim && */isInputMethodEnabled() ) {
QWExtra * xd = extraData();
if ( xd ) {
xic = (XIC)(xd->xic);
@@ -3195,10 +3269,12 @@
}
if ( xic ) {
#ifndef XIM_FILTER_ALL
+/*
if ( XFilterEvent( (XEvent*)event, winId() ) ) {
composingKeycode = keycode; // ### not documented in xlib
return TRUE;
}
+*/
#endif
count = XmbLookupString( xic, &((XEvent*)event)->xkey,
ascii, sizeof(asciiBuf), &key, &status );
diff --unified -r qt-1.44.orig/src/kernel/qwidget_x11.cpp qt-1.44/src/kernel/qwi
dget_x11.cpp
--- qt-1.44.orig/src/kernel/qwidget_x11.cpp Sun Jul 18 22:13:14 1999
+++ qt-1.44/src/kernel/qwidget_x11.cpp Sun Jul 18 21:40:01 1999
@@ -1156,6 +1156,13 @@
#endif
XIM xim = qt_xim();
if ( xim == 0 ) {
+ // disable input method
+ if (! enable) {
+ clearWFlags( WInputMethod );
+ if (extra)
+ extra->xic = 0;
+ return TRUE;
+ }
return FALSE;
}
diff --unified -r qt-1.44.orig/src/widgets/qmultilinedit.cpp qt-1.44/src/widgets
/qmultilinedit.cpp
--- qt-1.44.orig/src/widgets/qmultilinedit.cpp Sun Jul 18 22:13:15 1999
+++ qt-1.44/src/widgets/qmultilinedit.cpp Fri Jul 16 23:05:43 1999
@@ -256,8 +256,8 @@
blinkTimer = 0;
scrollTimer = 0;
#if !defined(NO_XIM)
-// setInputMethodStyle( IMSNothing, IMSNothing );
- setInputMethodStyle( IMSPosition, IMSNothing );
+ setInputMethodStyle( IMSNothing, IMSNothing );
+// setInputMethodStyle( IMSPosition, IMSNothing );
// setInputMethodStyle( IMSArea, IMSArea );
setInputMethodEnabled( TRUE );
#endif
| Indexed By Date | Previous: |
XIM patch for qt-1.44 From: Tung-Han Hsieh <thhsieh@linux.org.tw> |
|---|---|---|
| Next: |
Re: Qt-1.44 XIM patch From: ²ø©úõ <b4614225@ms.cc.ntu.edu.tw> |
|
| Indexed By Thread | Previous: |
XIM patch for qt-1.44 From: Tung-Han Hsieh <thhsieh@linux.org.tw> |
| Next: |
Re: Qt-1.44 XIM patch From: ²ø©úõ <b4614225@ms.cc.ntu.edu.tw> |