Odd Input Issue with a new InputDevice

I’m building a game that requires more than 4 players be controlled. So I’ve added my own InputDevice that utilizes the SDL2 API to give both better support for non-xb360/xb1 controllers as well as supporting more than 4 controllers.

The input device is working fine EXCEPT on the initial set of button presses. My InputDevice get’s the press and passes it via the MessangeHandler. In the logs I see the following:

2020.01.12-17.55.11:629][ 37]LogSlate: New Slate User Created. User Index 10, Is Virtual User: 0
[2020.01.12-17.55.11:629][ 37]LogSlate: Slate User Registered. User Index 10, Is Virtual User: 0

So Slate is seeing the input BUT, it’s not making it to my GameViewportClient that’s overwatching all input to detect new players. If I click on the main viewport, everything starts working until I press a button on controller 2, then the whole process starts over again (requiring a click on the viewport, etc).

I’ve seen this with multiple XInput game pads as well though once you re-click on the viewport, the remaining gamepads work as expected.

FWIW: The WidgetReflector says focus is pointed at the initial SViewport when this happens. Anyone have any ideas?

For what it’s worth this happens because when slate auto-creates the virtual user for the new controller id it doesn’t set focus to anything. So input is just ignored until focus is set via some other action. The solution is to just create the slate virtual user beforehand and force it’s user focus to the GameViewport.