Getting SDL to capture the input of another window in X11

Hi,

I was hoping someone on here would be able to tell me how get SDL to
capture the input of another X window (same application)?
Basically, i am using TinyPTC for my graphics library at the moment.
However, this has no input facility. I would like to use SDL to capture
the input from my TinyPTC window (and use it for sound and timing too
while i’m at it).
Someone said this could be done, they just didn’t know how. I know i
have to call some X11 function to get the ID of the window, and then
feed that into SDL somehow, but i couldn’t find anything on it.

Thanks for any help,

Hi,

I was hoping someone on here would be able to tell me how get SDL to
capture the input of another X window (same application)?
Basically, i am using TinyPTC for my graphics library at the moment.
However, this has no input facility. I would like to use SDL to capture
the input from my TinyPTC window (and use it for sound and timing too
while i’m at it).
Someone said this could be done, they just didn’t know how. I know i
have to call some X11 function to get the ID of the window, and then
feed that into SDL somehow, but i couldn’t find anything on it.

That only works for graphics, it assumes that you’re managing the input
for the window.

Did you know that SDL has a PTC emulation library that’s roughly the same
speed as PTC (as of a year or so ago)?

Check out: http://www.libsdl.org/projects/PTC/

Oh, that’s funny. I took a look at the TinyPTC page, and what the project
above is emulating is the OpenPTC API, but TinyPTC has an SDL version. :slight_smile:

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

That only works for graphics, it assumes that you’re managing the
input for the window.

I’m slightly confused. So you’re saying it’s impossible to process input
of a window that isn’t opened by SDL itself?

Okay, i’ll have to look into the PTC emulation then… what do you mean
by /roughly/ the same speed? I guess i’ll have to do a comparison of the
two.
Never used PTC, i am hoping it’ll just be the same as TinyPTC but with
lots of extras i don’t neccesarily have to use…

Thanks,

That only works for graphics, it assumes that you’re managing the
input for the window.

I’m slightly confused. So you’re saying it’s impossible to process input
of a window that isn’t opened by SDL itself?

I’m saying if the window isn’t opened by SDL, then SDL assumes there’s
some other library managing input from that window.

Okay, i’ll have to look into the PTC emulation then… what do you mean
by /roughly/ the same speed? I guess i’ll have to do a comparison of the
two.
Never used PTC, i am hoping it’ll just be the same as TinyPTC but with
lots of extras i don’t neccesarily have to use…

Actually, if you go to the TinyPTC page, there’s a version of TinyPTC that’s
built on top of SDL - the same API, but you get all the features of SDL if
you want them. When you unpack it it’s just 3 tiny files, and you can edit
them to change how the input handling works. :slight_smile:

TinyPTC HomePage: http://www.gaffer.org/tinyptc/

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment