Determine when a node is (un)reachable for mouse events

I have a sub-scene that uses the mouse input in the Captured mode, but I want the mode to reset when other nodes or controls appear over it and take over the mouse input. How wouild one approach detecting when a sub-scene becomes unreachable for the mouse events?

Only thing I could think of so far is sending fake mouse events and track when they stop reaching the sub-scene, but using fake events causes all sorts of problems. I hope there is a better less hacky way to do this.

Why not just use a boolean to control wether the mouse should be captured?

How do I know when to reset the boolean?

Provide more information on what you are doing. There is no way to guess what your scene looks like and what you are trying to accomplish.

Ended up using _input and _unhandled_input together, this way I can detect if mouse events are generated but no longer reach the node. At this point I doubt there is a better way.
Anyway, thanks.