[4.8 - Bug] GameViewportClient ReceivedFocus and LostFocus no longer called in standalone windowed apps.
Heya, After upgrading to 4.8, we are no longer getting ReceivedFocus and LostFocus being called in our GameViewportClient. I tested in ContentExamples on the release branch of vanilla unreal and it appears to be a problem with Unreal.
It seems to work as intended when I run in single process and tab between unreal windows.
I think we don't get ReceivedFocus events is because in SlateApplication.cpp in SetUserFocus we hit this line:
But when we go to another process/switch back from another process the OldFocusedWidget is the last widget we focused inside our process instead of being set to some invalid value when we leave the window entirely. I'm guessing that's just because we never fire any sort of LostFocus/SetUserFocus stuff when the window is deactivated.
After looking into this, can I assume that you're using alt-tab or something of the sort to simulate losing focus on the window? For me, if I use alt-tab, the breakpoint doesn't trigger but if I use Shift+F1 (Which will lose focus and bring up the hardware cursor) the breakpoint triggers immediately. Can you give this a try? In this case, I'm not quite sure if that is intended to work that way with standalone applications so I'll be looking into that point.
Something to add, please be sure that you're attaching the debugger to the standalone game's process when debugging. The reason why is that it is counted as a separate process which means it'll never be picked up by the debugger if you're launching the editor in debug without also attaching to the standalone application.
Have a good weekend!
answered Sep 04 '15 at 10:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here