Blame SOURCES/dont-forward-keycode-0.patch

f20033
diff -up libX11-1.6.3/modules/im/ximcp/imDefFlt.c.jx libX11-1.6.3/modules/im/ximcp/imDefFlt.c
f20033
--- libX11-1.6.3/modules/im/ximcp/imDefFlt.c.jx	2015-03-09 18:28:45.000000000 -0400
f20033
+++ libX11-1.6.3/modules/im/ximcp/imDefFlt.c	2015-03-10 12:32:31.912149644 -0400
f20033
@@ -142,7 +142,7 @@ _XimProtoKeypressFilter(
f20033
 {
f20033
     Xim		im = (Xim)ic->core.im;
f20033
 
f20033
-    if (IS_FABRICATED(im)) {
f20033
+    if ((ev->keycode == 0) || IS_FABRICATED(im)) {
f20033
 	_XimPendingFilter(ic);
f20033
 	UNMARK_FABRICATED(im);
f20033
 	return NOTFILTERD;
f20033
diff -up libX11-1.6.3/modules/im/ximcp/imDefLkup.c.jx libX11-1.6.3/modules/im/ximcp/imDefLkup.c
f20033
--- libX11-1.6.3/modules/im/ximcp/imDefLkup.c.jx	2015-03-09 18:28:45.000000000 -0400
f20033
+++ libX11-1.6.3/modules/im/ximcp/imDefLkup.c	2015-03-10 12:32:31.911149637 -0400
f20033
@@ -332,6 +332,17 @@ _XimForwardEvent(
f20033
     XEvent	*ev,
f20033
     Bool	 sync)
f20033
 {
f20033
+    /*
f20033
+     * Don't forward a key event which has keycode=0.
f20033
+     * keycode=0 is reserved for special purpose to let Xmb/wcLookupString()
f20033
+     * functions know that there is a commited string available from IM.
f20033
+     */
f20033
+    if (((ev->type == KeyPress) || (ev->type == KeyRelease))) {
f20033
+        if (((XKeyEvent *)ev)->keycode == 0) {
f20033
+            return True;
f20033
+        }
f20033
+    }
f20033
+
f20033
 #ifdef EXT_FORWARD
f20033
     if (((ev->type == KeyPress) || (ev->type == KeyRelease)))
f20033
 	if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync))
f20033
@@ -604,6 +615,19 @@ _XimUnregCommitInfo(
f20033
     Xfree(info->keysym);
f20033
     ic->private.proto.commit_info = info->next;
f20033
     Xfree(info);
f20033
+
f20033
+    /*
f20033
+     * "Commit" uses fabricated flag to process a commited string
f20033
+     * from IM engine.  
f20033
+     * Turn off the fabricated flag here (unregister the commited
f20033
+     * information function). Otherwise, next regular key press
f20033
+     * event will be ignored at _XimProtoKeypressFilter() and it
f20033
+     * will not be passed to IM engine.
f20033
+     */
f20033
+    if (IS_FABRICATED(ic)) {
f20033
+        UNMARK_FABRICATED(ic);
f20033
+    }
f20033
+
f20033
     return;
f20033
 }
f20033