Click-through window

I wanted to create a game overlay.

I decided it would be best to make a window with SDL_WINDOW_OPENGL and SDL_WINDOW_BORDLESS flags when the programs detects the process of the game open.

Code:
// Get the display’s screen size.
SDL_DisplayMode display_mode;

SDL_GetCurrentDisplayMode(0, &display_mode);

this->screen_width  = display_mode.w;
this->screen_height = display_mode.h;
// Create our window.
this->window = SDL_CreateWindow(
    "OverlayGL",
    SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
    this->screen_width, this->screen_height,
    SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS
);

if(this->window == nullptr) {
    std::cout   << "[SDL]: Could not create window!"<< std::endl
                << "[SDL]: " << SDL_GetError() << std::endl;
    return false;
}

^ This is the code.

What happens when the main loop detects the process, it creates the window, transparent, cool, but I can’t click on anything in the game.
C++ console still detects key and mouse events but the game doesn’t.

Anyway to tell the SDL window to get the mouse and keyboard events but also send those events to the game window as well?[/code]

I know that such problems are usually solved by focus. Give focus to SDL window, and it accepts events, take focus from it, and it will not. How is it solved in SDL i don’t know though, i don’t know so much about SDL.------------------------
kiss_sdl - Simple universal GUI widget toolkit for SDL https://github.com/actsl/kiss_sdl

Damn SDL needs to be unfocused to accomplish what I want to do.
The point is to get mouse motion event to get the mouse pointer location so when the person overlays the mouse over a certain area the GUI for the overlay app pops up…

I guess you’re archiving something like Steam overlay… right ?

What about… recieving an event at the overlay. Convert it to the target windows’s coordinate. And then push that event to the target windows ? It sounds a bit messy though.

http://www.overwolf.com/

^ Almost exactly like this one.
Except just not publicly released, just for fun and experimenting.

Anyone else has suggestions? Is it possible?

SDL doesn’t support this in its own API. I don’t think it should, either.

On Windows, you can get the window handle from the game and use SendInput(). I’m not familiar enough with other OSes and windowing systems to tell you how to do them.------------------------
Nate Fries

Nathaniel J Fries wrote:

SDL doesn’t support this in its own API. I don’t think it should, either.

On Windows, you can get the window handle from the game and use SendInput(). I’m not familiar enough with other OSes and windowing systems to tell you how to do them.

I disagree, I feel it would be an extremely useful option.
But I found a way to get around it, I just create a window for each image, set the window to the size of the window, bam, hacky transparent program.
I think this feature should be implemented, allow the window to be click through transparent.

window to the size of the image*