ellis@cadillac.siemens.COM (Ellis Cohen) (10/14/87)
WARNING TO APPLICATION WRITERS EVENTS GENERATED BY XSendEvent FORCE ON THE THE MOST SIGNIFICANT BIT OF THE EVENT CODE XSendEvent can be used to send events to a client and these can masquerade as real X events. XSendEvent is useful for scripts -- as a way of playing back canned demos. The Siemens RTL Tiled Window Manager uses XSendEvent in a different way -- it (optionally) uses XSendEvent to send key presses typed while the cursor is in the window header on to the client (acting as if the cursor were in the client's window). The X server sends the event on to the client, but forces on the most significant bit of the event code. Unfortunately, many existing clients are oblivious to this part of the protocol and may work incorrectly in situations where XSendEvent is used. For example, the code XNextEvent( screen->display, &event ); if ( event.type == KeyPress ) ... will not work correctly if the KeyPress was produced by XSendEvent. If the application wants to work the same regardless of whether the event was real or not, its code should look like XNextEvent( screen->display, &event ); event.type &= 0177; /* Mask out XSendEvent indication */ if ( event.type == KeyPress ) ... Those applications using XtDispatchEvent need to do the same thing, since the version of XtDispatch on the release tape does not mask out the high order bit. We have had to patch a number of applications in this way including emacs and xterm. Ellis Cohen Siemens RTL Tiled Window Project (609) 734-6524 ellis.cohen@a.gp.cs.cmu.edu