Fix out of order key events in Chrome on Linux.
The ibus-gtk layer was using XPutBackEvent which pushes an event to the
top of the X event queue. The problem with this is that if the gtk event
loop processes more than one event before the X event loop executes the
X message pump will see the events in reverse order.
Fix this by using XSendEvent which sends the event to the display and puts
it at the end of the list. However; it appears that the wire protocol for
XKeyEvent has 16 bits of accuracy defined for the state variable; yet the
struct is 32 bits for that field. While the state variable ends up still
being correct when you use XPutBackEvent because it is just an in process
copy; the XSendEvent is a serialization to the XServer and results in loss
of precision. To get around this pack the high bits that are used into
an empty field that is used.
BUG=524084
Review URL: https://codereview.chromium.org/
1302373006
Cr-Commit-Position: refs/heads/master@{#346194}