How to force mouse focus / unfocus on PlayerController

Hi,

I play around a lot with the bShowMouseCursor flag in PlayerController. But if I set it to false, click and move the mouse before setting it to true again, I keep getting input events. I would like to reset the “pressed” state.

How can I do that ? ie ensure that hiding the cursos forces the focus, and displaying it forces the un-focus.

Thanks