changeset 9:1f9e9cb00c6c

imported patch 11_kinput2-v3.1-status-update-204892.patch
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 20:07:06 +0900
parents 8b176cdf6319
children d1e9297afff9
files lib/imlib/imattr.c lib/imlib/imconv.c lib/imlib/imfuncs.h lib/imlib/imrequest.c
diffstat 4 files changed, 59 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/imlib/imattr.c	Mon Mar 08 20:07:06 2010 +0900
+++ b/lib/imlib/imattr.c	Mon Mar 08 20:07:06 2010 +0900
@@ -1851,7 +1851,7 @@
     if (mask & ATTR_MASK_PREEDIT_STATE) {
 	/* unless the client specified, we should start with disabled state. */
 	ap->set_mask |= ATTR_MASK_PREEDIT_STATE;
-	ap->reset_state = XIMPreeditDisable;
+	ap->preedit_state = XIMPreeditDisable;
     }
     if (mask & ATTR_MASK_RESET_STATE) {
 	/* the default reset state must be the initial state. */
--- a/lib/imlib/imconv.c	Mon Mar 08 20:07:06 2010 +0900
+++ b/lib/imlib/imconv.c	Mon Mar 08 20:07:06 2010 +0900
@@ -909,11 +909,20 @@
 	ICClearConversion(input_obj);
 	TRACE(("\twas converting. %d bytes left\n", num_bytes));
 
+#if 0
+	/*
+	 * IMStopConversion() seems to not work correctly while
+	 * resetting IC. So this block was moved to ximResetICProc().
+	 * If calling IMResetIC() is required in other functions,
+	 * the following block is also used in it.
+	 */
 	if (icp->common_attr.reset_state == XIMInitialState) {
 	    /* Force to end the conversion. */
 	    TRACE(("\tback to the initial state\n"));
 	    IMStopConversion(icp);
 	}
+#endif
+
     }
     return num_bytes;
 }
@@ -965,6 +974,42 @@
 
 /* ARGSUSED */
 void
+IMStatusDraw(icp)
+IMIC *icp;
+{
+    Widget input_obj;
+    OCCPreeditDrawArg arg;
+
+    TRACE(("IMStatusDraw(ic%d)\n", icp->id));
+    if (!(icp->common_attr.input_style & XIMStatusCallbacks))
+	return;
+
+
+    arg.caret = 0;         /* ignored */
+    arg.chg_first = 0;     /* ignored */
+    arg.chg_length = 0;    /* ignored */
+    arg.encoding = IMCtextAtom(icp->im->connection->proto_widget);
+    arg.format = 0;        /* set by ICGetStatusString */
+    arg.text_length = 0;   /* set by ICGetStatusString */
+    arg.text = NULL;       /* set by ICGetStatusString */
+    arg.attrs_length = 0;  /* ignored */
+    arg.attrs = NULL;      /* ignored */
+
+    if (icp->conversion) {
+	XtVaGetValues(icp->conversion, XtNinputObject, &input_obj, NULL);
+	if (ICGetStatusString(input_obj, &arg.encoding, &arg.format,
+			      &arg.text_length, &arg.text,
+			      &arg.attrs_length) == -1)
+	return;
+    }
+
+    statusDraw(icp, &arg);
+
+    XtFree((char *)arg.text);
+}
+
+/* ARGSUSED */
+void
 IMStatusDone(icp)
 IMIC *icp;
 {
--- a/lib/imlib/imfuncs.h	Mon Mar 08 20:07:06 2010 +0900
+++ b/lib/imlib/imfuncs.h	Mon Mar 08 20:07:06 2010 +0900
@@ -102,6 +102,7 @@
 extern void IMSetFocus _Pt_((IMIC *icp));
 extern void IMUnsetFocus _Pt_((IMIC *icp));
 extern void IMStatusStart _Pt_((IMIC *icp));
+extern void IMStatusDraw _Pt_((IMIC *icp));
 extern void IMStatusDone _Pt_((IMIC *icp));
 extern void IMStartForwarding _Pt_((IMIC *icp));
 extern void IMStopForwarding _Pt_((IMIC *icp));
--- a/lib/imlib/imrequest.c	Mon Mar 08 20:07:06 2010 +0900
+++ b/lib/imlib/imrequest.c	Mon Mar 08 20:07:06 2010 +0900
@@ -1351,8 +1351,20 @@
     IMPutC16(conn, (unsigned int)text_length);
     if (text_length > 0) IMPutString(conn, text, text_length);
     IMFinishRequest(conn, offset);
+    /*
+     * Send RESET_IC_REPLY 
+     */
+    IMFlush(conn);
     if (text != NULL) XtFree(text);
     icp->state &= ~IC_RESETTING;
+
+    IMStatusDraw(icp);
+   /* moved from IMResetIC() */
+    if (icp->common_attr.reset_state == XIMInitialState) {
+	/* Force to end the conversion. */
+	TRACE(("\tback to the initial state\n"));
+	IMStopConversion(icp);
+    }
 }
 
 /*- ximExtMoveProc: handle XIM_EXT_MOVE request -*/