Skip to content

Allow click-through of transparent windows, but not contents #8360

Open
@rihok

Description

Version/Branch of Dear ImGui:

Not relevant

Back-ends:

Not relevant

Compiler, OS:

Not relevant

Full config/build information:

No response

Details:

Unless I'm missing something obvious somewhere, I don't think it's currently possible to have a transparent window (ImGuiWindowFlags_NoBackground) that allows you to click-through the transparent parts. This is quite common need for overlay type windows, where you'd want the window to not capture any mouse input unless you're actually hovering over an interactive element. There's some hacks I've seen to work around this, but I think a built-in flag for this would be quite helpful.

We've used ImGuiWindowFlags_NoInputs flag on the main window, and then create child windows for individual elements and then try to detect IsWindowHovered on those, but this is quite hacky and makes it very difficult to write nice widget code.

I guess what I'm looking for is a ImGuiWindowFlags_NoTransparentInputs flag, that would ignore inputs on the window itself, but still allow inputs on all child widgets / elements.

Thanks for considering,
Riho

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("My Transparent Overlay", ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTransparentInputs);

if (ImGui::Button("My Button"))
{
    // do stuff
}

ImGui::End();

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions