Find the answer to your Linux question:
Results 1 to 2 of 2
Hi everybody I must write an application that sends the keystrokes to a browser. I found one thread in this forum called " XSendEvent to Child Windows", which suggests to ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    1

    How to know which windows are associated to a process

    Hi everybody

    I must write an application that sends the keystrokes to a browser. I
    found one thread in this forum called " XSendEvent to Child Windows",
    which suggests to me I can write my application with xlib. In fact, it
    seems that the author was almost exactly in the same situation that me.

    However, in order to be able to grabb the keystrokes an send then to a
    window, first I have identify the windows that are associated to the
    browser. My problem is that I do not know a objective form to determine
    whether a window is or associated to the browser.

    I would say that if X11 and, consequently, xlib, had a way to associate
    the windows to the process that created them, then by this way, I would
    identify the windows without ambiguities. But it seems that doc of xlib
    does not mention schemes of the sort.

    Could somebody give lights me on the matter?

    Thanks,

    LL

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    The X-WIndow system has no facility for this. In fact, there is no guarantee that the client process is even running on the same machine as the X-Window system; all the actions requested by the client can be sent over a network.

    I do this on a regular basis. I'm on machine "fred", and I'll telnet over to machine "barney" and run a client (for example, a browser) on barney, from fred. But before running that client on barney, I'll set the DISPLAY environment variable to ensure that it's the X-Window server on fred, not barney, that actually displays the windows on its screen. At no point am I in physical or visual contact with barney.

    I could use XSendEvent to send events to a window, as you plan to do. I could do that from a client running on fred, or barney, or some third system.

    So the X-Window system has no knowledge of the processes which request that windows be created, since those processes need not even be on the same host as the X-Window server (and your physical screen).
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...