Is there anyway to lock/unlock immediately on change MouseLockMode?

Hi, I’m trying to make lock mouse option on UserSettings. But when I changed this and apply them, It doesn’t work proper.

I’ve called UGameViewportClient::SetMouseLockMode(EMouseLockMode).
But when I finished changed to EMouseLockMode::LockAlways from EMouseLockMode::DoNotLock, It needs to click viewport once to lock mouse cursor.
And when I finished on opposite case, I needs to RMB click once to unlock mouse cursor.
But after that, it works fine.

Is there anyway to lock/unlock immediately on change MouseLockMode?

Hi again, I found UGameViewportClient::ReceivedFocus(FViewport) and UGameViewportClient::LostFocus(FViewport) and other some options in UGameViewportClient and FViewport. But I doesn’t solve with window focus. And, again, of course, hope anyone help me how to solve this problem please.