XSendEvent + KeyEvent question - Xwindows

This is a discussion on XSendEvent + KeyEvent question - Xwindows ; Hi there. Is it possible to do the following. (So far I have been unsuccessful to do it). Let's say you have a text editor open(or maybe openoffice word). I'm trying to do a VNC type thing where a remote ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: XSendEvent + KeyEvent question

  1. XSendEvent + KeyEvent question

    Hi there.
    Is it possible to do the following. (So far I have been unsuccessful to do
    it).
    Let's say you have a text editor open(or maybe openoffice word). I'm trying
    to do a VNC type thing where a remote user can type text into this
    application BUT also that a local user can interact, this way both users can
    type and edit the "document" simulatneuosly. Of course I don't mean
    typing/editing at the same time, but so that the one person can allow the
    other remote person to edit on his machine.

    By using XRecord on the "server" side I can capture the window and export
    that image to the client side...it works great. But now on the client side,
    whenever this window has focus I capture the keypresses and send it back to
    the server side so that the server side can render the text and send me back
    a new image. The problem is in injecting these keypresses into the server
    side. Via XRecord I can get the details about the window/application I want
    to send the keypresses to, I fill in a KeyPressEvent struct and then
    XSendEvent. XSendEvent returns positive....but nothing gets rendered in the
    window!

    VNC and the other protocols use XNEST to do this, so their approach is
    totally different. Is there another way I can do this? Tell the remote
    xserver to render text in a specific window/application??

    Thanks
    YT



  2. Re: XSendEvent + KeyEvent question

    "YT" writes:

    > The problem is in injecting these keypresses into the server
    > side. Via XRecord I can get the details about the window/application I want
    > to send the keypresses to, I fill in a KeyPressEvent struct and then
    > XSendEvent. XSendEvent returns positive....but nothing gets rendered in the
    > window!


    XSendEvent marks the event as synthetic. The editor program is
    probably ignoring synthetic events. If I understand correctly,
    XTestFakeInput can generate non-synthetic events; however the
    server may refuse this request from untrusted clients.

    Alternatively, if you just want to edit the same text on multiple
    displays, you could use Emacs, which supports this natively.

  3. Re: XSendEvent + KeyEvent question

    YT wrote:
    >Hi there.
    >Is it possible to do the following. (So far I have been unsuccessful to do
    >it).
    >Let's say you have a text editor open(or maybe openoffice word). I'm trying
    >to do a VNC type thing where a remote user can type text into this
    >application BUT also that a local user can interact, this way both users can
    >type and edit the "document" simulatneuosly. Of course I don't mean
    >typing/editing at the same time, but so that the one person can allow the
    >other remote person to edit on his machine.
    >
    >By using XRecord on the "server" side I can capture the window and export
    >that image to the client side...it works great. But now on the client side,
    >whenever this window has focus I capture the keypresses and send it back to
    >the server side so that the server side can render the text and send me back
    >a new image. The problem is in injecting these keypresses into the server
    >side. Via XRecord I can get the details about the window/application I want
    >to send the keypresses to, I fill in a KeyPressEvent struct and then
    >XSendEvent. XSendEvent returns positive....but nothing gets rendered in the
    >window!
    >
    >VNC and the other protocols use XNEST to do this, so their approach is
    >totally different. Is there another way I can do this? Tell the remote
    >xserver to render text in a specific window/application??
    >
    >Thanks
    >YT


    xmx does this as a proxy; that is, the applications connect to the
    proxy and the proxy connects to the real X servers.

    This configuration is symmetric in the sense that all servers are
    equal. Your xrecord/xtest approach has the `initial' server distinct
    from the others, and this probably makes the logic more complicated.
    Indeed, I'm not even sure that you can handle things like grabs or
    selections properly.

    The proxy approach also allows the `screen' program feature of being
    able to disconnect temporarily from an application. This is popular
    with those who choose operating systems that crash frequently.


+ Reply to Thread