Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't disable mouse inputs for only a window and not its contents #3368

Closed
JMS55 opened this issue Jul 29, 2020 · 3 comments
Closed

Can't disable mouse inputs for only a window and not its contents #3368

JMS55 opened this issue Jul 29, 2020 · 3 comments
Labels

Comments

@JMS55
Copy link

JMS55 commented Jul 29, 2020

You should be able to disable mouse inputs for windows, but not their contents.

I'm using an window with no background, non resizeable, can't move it, no title, etc for my UI, like so:
image

The issue is that the window captures mouse input in the space to the right of the "Brush Size" text, since there's technically an invisible background there. Here's what it looks like with the background showing:
image

Using the no mouse input flag fixes this, but also makes it so that you can't interact with any of the buttons or widgets either. I want a mode like no mouse input, but only applying to the window itself, and not it's contents.

@JMS55
Copy link
Author

JMS55 commented Jul 29, 2020

I suppose this could be fixed by splitting each row into a separate window for now.

ocornut added a commit that referenced this issue Jul 29, 2020
@ocornut ocornut added the inputs label Jul 30, 2020
@ocornut
Copy link
Owner

ocornut commented Jul 30, 2020

Hello @JMS55,

It's a little difficult with the current hovering scheme. We decide of the "hovered window" at the beginning of the frame, based on first rectangle hit on the front-to-back list of window, and then lots of interactions are filtered early based on this hovered window.

The sort of pass-through you mention would require much more involved hit-testing for each widget, and I honestly wouldn't know how to implement it efficiently at this point.

Some thoughts for work-arounds:

  • A. You could split each row into a separate window as you mention (would work but not ideal as keyboard/gamepad navigation won't easily be able to cross-over from one to the other).
  • B. There's a specific mechanism used the docking system which allows to register a rectangular hole in window to become input pass-through. I just merged that code in master (c7f5876) yesterday and if you call SetWindowHitTestHole() (declared in imgui_internal.h) you can register that rectangle yourself and it'll have the desired effect. It's a little bit manual but should work.

The hit test callbacks discussed in #1512 would similarly require you to know where those holes are, so I think using (B) should be sufficient for you.

Omar

@JMS55
Copy link
Author

JMS55 commented Jul 30, 2020

Thank you for the information. (B) seems like it will work, with (A) as a work-around until imgui publishes a release and imgui-rs updates to it.

Feel free to close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants