Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
8.87k stars 536 forks source link

Inputs propagating to windows in background #643

Open sylvester-prisse opened 1 month ago

sylvester-prisse commented 1 month ago

I am writing a level editor with a menu bar window at the top containing dropdown menus. When opening such a dropdown menu and clicking on an item that overlaps another window behind the dropdown menu, the click event propagates through to that window. Is there any way to prevent this from happening? Do I have to manually keep track of when a dropdown menu is opened and disable all inputs to other windows while this is the case?

For example in this screenshot I am hovering the "Find" item in the "Edit" menu and when I then click it, that click is also registered with the XY view below and in this case would deselect the currently selected object.

editor_dropdown_menu

I tried only processing inputs when the window has focus, but this doesn't help because the focus is immediately transferred to the background window when clicking.

bolt-blue commented 1 week ago

This has also been mentioned at least here (https://github.com/Immediate-Mode-UI/Nuklear/issues/250).

I've hit the same (or similar) issue myself - a button press in one window also affecting a window underneath. Not yet sure of a decent solution.

Looks like this fix (https://github.com/Immediate-Mode-UI/Nuklear/pull/14) might cover similar ground (but for buttons) but I haven't read through the code changes there to see if there might be anything related.