4.7 Lock mouse to viewport problem

I had same issue. From this discussion, I resolved issue in my C++ project by adding one line in controller class’s SetupInputComponent function.

SetInputMode(FInputModeGameAndUI());

I found input mode change doesn’t work in constructor, so I put it in SetupInputComponent function. Now, things work as expected.

EDIT: Although this fixes issue with main window’s viewport issue, There is a strange problem where mouse cursor disappears for preview windows when click ‘play’ from BP editor window.