It just trigger GainedFocus event when losing focus.
My solution is add flag SWP_NOACTIVATE but I have no idea, if it's good idea.
void WindowImplWin32::setPosition(const Vector2i& position)
{
SetWindowPos(m_handle, NULL, position.x, position.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
void WindowImplWin32::setSize(const Vector2u& size)
{
// SetWindowPos wants the total size of the window (including title bar and borders),
// so we have to compute it
RECT rectangle = {0, 0, static_cast<long>(size.x), static_cast<long>(size.y)};
AdjustWindowRect(&rectangle, GetWindowLong(m_handle, GWL_STYLE), false);
int width = rectangle.right - rectangle.left;
int height = rectangle.bottom - rectangle.top;
SetWindowPos(m_handle, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}