Mouselook and my tool windows

My main view uses the middle button to toggle mouselook. When you press it goes into mouselook mode, when you release it goes out of mouselook mode.

But if one of my tool windows is at or near the center of the screen, then when in mouselook, the mouse is transported to the center, over that tool window, and it is the tool window (a tcastleshape) that receives the release callback instead of the main view. This leaves me stuck in mouselook mode. Is there a way to lock all interface events to the MainViewport when it is in mouselook mode?

Hm, we have a mechanism already to “capture” input – if you handle “Press” event for a mouse button over some control (make sure to return true from the Press override to let CGE know it is handled), then we make sure that that control will receive the Release event, even if at the point of release the mouse is over something else. It was written looking at X (Unix window system) similar mechanism.

So, obviously it fails for some reason for your case – because, from the description, it should exactly deal with your problem.

Can you make a testcase to reproduce the problem? I will happily take a look :slight_smile:

It doesn’t happen with other sorts of clicks… if I right click and drag to move the view around and the mouse goes over the window, it doesn’t do anything unexpected. But the middle click and drag with mouselook behaves differently. Perhaps this has to do with mouselook centering the mouse? The window is also handling middle click events for a mouselook on the building in its view.