Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[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.

Repro steps:

  1. Set Breakpoints in ReceivedFocus and LostFocus in GameViewportClient.cpp

  2. Launch as Standalone Game

  3. Alt-tab into/out of the window

  4. No breakpoints hit

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:

 if (WidgetToFocus.Widget == OldFocusedWidget)

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.

Product Version: UE 4.8
more ▼

asked Aug 28 '15 at 04:11 PM in Bug Reports

avatar image

703 40 32 123

avatar image mrooney Aug 31 '15 at 02:06 PM

Sorry for bumping, but just wanted to make sure this got visibility, since it looks like an engine bug.

avatar image mrooney Sep 01 '15 at 06:53 PM

Any help at all would be appreciated :S

avatar image mrooney Sep 02 '15 at 07:05 PM

Bumping again. This is a major issue for us since we use the ReceivedFocus and LostFocus functions to trigger muting game audio in WWise, and our audio can't be demoed easily without them.

avatar image Matthew J Sep 04 '15 at 09:51 PM

Hello mrooney,

Thank you for reporting this issue. I'll be looking into this issue and I'll get back to you when I have it reported or if I need more information. Also, I moved this post to Bug Reports due to it being a bug report. When it comes to bumping threads, please don't bump without extra information of some sort more frequently than 3 days at a time.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hello mrooney,

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!

Matthew Clark

more ▼

answered Sep 04 '15 at 10:36 PM

avatar image mrooney Sep 07 '15 at 12:16 AM

Heya, Yep that's pretty much what I'm doing. Any idea why alt-tab wouldn't do that? If someone's running my game windowed alt tab is usually the most common way to go to other windows.

Anyway, let me know what you hear about the intended functionality or where else I would do this kind of stuff if this function is working as intended.

Also, totally sorry I posted this in the wrong spot. I didn't know there was another spot for it :p Probably would have gotten a reply a lot faster over there too <_<

Have a good holiday!

edit: Just to follow up because I forgot to mention something. I made a thread on the forums a while ago also on the same topic, but it includes a potential workaround that I'm unsure about.


Just wanted to mention it in case it's relevant to you.

avatar image Matthew J Sep 08 '15 at 07:05 PM

Hi mrooney,

I haven't had a chance to test it myself but have you tested to see if losing focus with alt-tab works for a packaged game? There are a few things different about a standalone app than a packaged version which could explain it.

As far as the workaround you mentioned, it looks like it involves editing source code. In this case, if it is something that seems like it'd be helpful for everyone, please feel free to make a pull request on Github and we could take a look to see if it should be integrated into the engine itself.

Since the weekend just ended I'll be getting back to looking into the original problem right now (Alt-tab not working for standalone) and I'll get back to you soon about that.

avatar image mrooney Sep 08 '15 at 08:28 PM

Aloha, It seemed to not get called in a packaged build either.

For the source change, I'm not 100% certain if the fix is actually the best solution, or if it's just a solution that happened to work with some unintended knock on effects. Would it still be an ok idea to submit it as a pull request and then it can just be denied if it's not the way it should actually be fixed?

avatar image Matthew J Sep 09 '15 at 06:50 PM

Yes, all pull requests are reviewed for their compatibility and how they'll affect other things before being approved, so there is no harm in submitting a pull request that may not be perfect.

avatar image mrooney Sep 09 '15 at 07:11 PM

Groovy, thanks. I'll do that later. Let me know if you hear anything else new :)

avatar image Matthew J Sep 09 '15 at 09:42 PM

Hello mrooney,

I've placed a bug into our system for alt-tab not calling these functions. For your reference, the bug number is UE-20926. As I'm not 100% sure if this is intended functionality I can't promise that there will be a fix, but I'll be sure to update you here if there are any updates to the bug's status.

Have a good day!

avatar image mrooney Sep 15 '15 at 07:24 PM

Just to update, finally got around to making the pull request here.

Thanks again for your help :)

edit: Is there a way to disable new comments causing questions to be unanswered? o.O

avatar image Matthew J Sep 15 '15 at 09:20 PM

Unfortunately no, but if it comes down to that, I can set to answered myself. :)

avatar image Matthew J Jan 25 '16 at 04:07 PM

Hello mrooney,

I'd like to let you know that this bug report was just verified as fixed in one of our latest internal builds and the fix should be coming soon. It's too early to say if it'll be in 4.11, but it should be shortly after if not.

avatar image mrooney Jan 25 '16 at 07:29 PM

Awesome. I think we're locked into our current version, but do you know where I might be able to find the change on github so I can just put it into our version? Thanks for following up. Really appreciate it :)

avatar image Matthew J Jan 25 '16 at 08:03 PM

I can give you the Github commit, but please be aware that we just discovered that there was an issue that this change introduced that causes the editor to crash when opening the Level Blueprint, so use it at your own risk. It's currently been backed out and will need to receive another fix.


avatar image mrooney Jan 25 '16 at 09:23 PM

This is quite the emotional roller coaster ;)

avatar image Matthew J Jan 25 '16 at 09:26 PM

Agreed, I'll be sure to let you know whenever another fix has been entered and link the commit for you.

avatar image mrooney Jan 25 '16 at 09:28 PM

Merci. Appreciated as always :)

avatar image Matthew J Feb 23 '16 at 06:54 PM

Hello mrooney,

A fix has gone in for this that fixes the problem with Alt+Tab not triggering the LostFocus function. You can find the Github commit here: https://github.com/EpicGames/UnrealEngine/commit/526fd956e9d05905093a08a900aa3beb7107eaf1


avatar image mrooney Feb 24 '16 at 04:41 PM

WOO! Awesome! I appreciate all your help/keeping me updated. :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question