Page 1 of 1

CEF stealing focus

PostPosted: Fri Jun 01, 2018 7:37 am
by rashid301
I am working with CEF 3325-1750 build.

I have main application and notification window.
Whenever I create the notification window using CreateBrowser, it steals focus from the other applications and brings the main application in foreground.

I have implemented notification windows client_handler OnSetFocus function to return true. Using the breakpoint, I know that it is calling that function as well. But it still takes the focus.

If the main application is minimized or dialog is closed, then only the notification window takes focus.
If the main application is behind other applications, then it comes in the foreground and gets focus.

I have worked with older versions of CEF (3.2171) and returning true from OnSetFocus function did the trick. But it is no longer working. Is this a new bug?

Re: CEF stealing focus

PostPosted: Fri Jun 01, 2018 8:09 am
by amaitland

Re: CEF stealing focus

PostPosted: Fri Jun 01, 2018 8:13 am
by rashid301
Thanks for the issue link.

I tried locking LockSetForegroundWindow API work around and it worked for me.

It is mentioned here viewtopic.php?f=6&t=12205