Bug 2006 - XEmbed client doesn't receive key events from XIM
Summary: XEmbed client doesn't receive key events from XIM
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: All Linux (All)
: high normal
Assignee: Hidetoshi Tajima
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-03 11:54 UTC by Hidetoshi Tajima
Modified: 2005-03-06 23:54 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
test case gtk-embedder ang gtk-client (3.09 KB, application/x-gzip)
2004-12-03 11:58 UTC, Hidetoshi Tajima
no flags Details
correct mask of the xevents of send_event masks (436 bytes, patch)
2005-03-07 10:35 UTC, Hidetoshi Tajima
no flags Details | Splinter Review

Description Hidetoshi Tajima 2004-12-03 11:54:33 UTC
(For those how is unfamiliar with XEmbed, see
http://www.freedesktop.org/wiki/standards/xembed-spec)

Use the attached GTK XEmbed test. To run it, start ./gtk-embedder, then click on
"Add Active GTK+ Child", the child with text field will appear. Try to input
some text into it using different techniques, enable/disable IM - nothing helps,
you can't inputanything. The only way I found is to click by right mouse button
when IM is enabled(put focus back into embedder's textfield, press Ctrl-space,
then click into client's text field), then the window with on-screen
keyboard appears, and I am able to input English letters.

Similarly to GTK, Java 1.5.0 based applets are unable to receive any input in
the locales XIM is enabled, when they are run in the version of Mozilla with
XEmbed enabled plugins.
Comment 1 Hidetoshi Tajima 2004-12-03 11:58:33 UTC
Created attachment 1457 [details]
test case gtk-embedder ang gtk-client
Comment 2 Hidetoshi Tajima 2004-12-03 12:32:20 UTC
A suspecious code is found in xc/lib/X11/imEvToWire.c. At line 408:
 	if (((XAnyEvent *)re)->send_event)
	    event->u.u.type &= 0x80;

This converts the X events with send_event bit ON to the wired events with
uu.type = 0. Since the events that Xembedder sends to embedded clients
have the send_event bit ON, it hits this case. As the results, the wired
events sent to the XIM server are converted back to x events with type 0(zero),
and will not be processed properly. I think the above must be a typo and that
it should be:
           event->u.u.type |= 0x80;
Comment 3 Roland Mainz 2004-12-19 19:54:35 UTC
Uhm... I doubt Xlib/Xft is the right component... isn't this XIM related ?
Comment 4 Hidetoshi Tajima 2004-12-20 13:18:53 UTC
Yes, Lib/Xlib is a right category. The patch should be applied to
xc/lib/X11/imEvToWire.c.
Comment 5 Hidetoshi Tajima 2005-03-07 10:35:36 UTC
Created attachment 2031 [details] [review]
correct mask of the xevents of send_event masks

&= 0x80 operation is obviously wrong, since it resets event type field to 0,
This is most likely a typo of |= 0x80.
Comment 6 Hidetoshi Tajima 2005-03-07 10:40:01 UTC
Roland and Alan: Please review the patch and commit for me to the cvs HEAD if
it looks good.
Comment 7 Alan Coopersmith 2005-03-07 18:54:50 UTC
Patch makes sense to me, so I went ahead and committed it to head:

CVSROOT:	/cvs/xorg
Module name:	xc
Changes by:	alanc@gabe.freedesktop.org	05/03/07 18:53:36

Log message:
  2005-03-07  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* xc/lib/X11/imEvToWire.c:
  	Bugzilla Bug 2006 (https://bugs.freedesktop.org/show_bug.cgi?id=2006)
  	Patch #2031 (https://bugs.freedesktop.org/attachment.cgi?id=2031)
  	XEmbed client doesn't receive key events from XIM: Use | to set a bit,
  	not &.   Patch by Hidetoshi Tajima <hidetoshi.tajima@sun.com>.

Modified files:
      ./:
        ChangeLog 
      xc/lib/X11/:
        imEvToWire.c 
  
  Revision      Changes    Path
  1.803         +9 -1      xc/ChangeLog
  1.3           +1 -1      xc/lib/X11/imEvToWire.c


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.