Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 893d9bab84a8fa4a4dd6d5e6575c2f4f > files > 2

libX11-1.0.3-11.el5_7.1.src.rpm

diff -up libX11-1.0.3/modules/im/ximcp/imDefIc.c.bug-221186 libX11-1.0.3/modules/im/ximcp/imDefIc.c
--- libX11-1.0.3/modules/im/ximcp/imDefIc.c.bug-221186	2011-09-06 14:58:43.000000000 -0400
+++ libX11-1.0.3/modules/im/ximcp/imDefIc.c	2011-09-06 14:58:49.514000483 -0400
@@ -952,6 +952,32 @@ _XimProtoSetFocus(
     MARK_FOCUSED(ic);
 
     _XimRegisterFilter(ic);
+
+    /*
+     * If the FABRICATED flag is ON here, it means that the commited
+     * string from input method server has not been passed to a client.
+     * In this case, a special key press event (keycode=0) (to let 
+     * client program know a commited string is available) has been
+     * removed from client's X event queue accidentally due to timing
+     * issue of register/unregister filters.
+     * The following logic generate a syntheic key press event and 
+     * put it back to the client's X event queue.
+     */
+    if (IS_FABLICATED(ic)) {
+        Xim             im = ic->core.im;
+        XKeyEvent       ev;
+    
+	/* Create a syntheic event for processing commited string */
+        ev.type = KeyPress;
+        ev.send_event = False;
+        ev.display = im->core.display;
+        ev.window = ic->core.focus_window;
+        ev.keycode = 0;
+        ev.state = 0;
+
+        XPutBackEvent(im->core.display, (XEvent *)&ev);
+    }
+
     return;
 }