Grabbing Keyboard Input without Selecting the Window?

Is there any way for SDL to grab input form the keyboard even if the SDL window is not selected? It probably sounds odd, but what I’m trying to do is essentially attach SDL to a window not created by me or my code, but rather someone else’s, and then use SDL for input. It would seem odd, though, to have the SDL window hidden (it’s entirely used for input, so it’s hidden), and then have the other application not selected but still update.

Has anyone ever made it so that Keyboard input would still update without the window being selected? Gamepads/Joysticks work without the window being selected (I didn’t set any hint to enable this), so is there some way to enable it for the keyboard?

I don’t think that what you ask is possible, and a little too sneaky
to fully work everywhere.
What you could do instead is create a SDL context after the window was
created, eg using http://wiki.libsdl.org/SDL_CreateWindowFrom

Cheers,
VittorioOn Mon, Oct 14, 2013 at 7:47 PM, Zalerinian wrote:

Is there any way for SDL to grab input form the keyboard even if the SDL
window is not selected? It probably sounds odd, but what I’m trying to do is
essentially attach SDL to a window not created by me or my code, but rather
someone else’s, and then use SDL for input. It would seem odd, though, to
have the SDL window hidden (it’s entirely used for input, so it’s hidden),
and then have the other application not selected but still update.

Has anyone ever made it so that Keyboard input would still update without
the window being selected? Gamepads/Joysticks work without the window being
selected (I didn’t set any hint to enable this), so is there some way to
enable it for the keyboard?