Page 1 of 1

CefFocusHandler issue.

PostPosted: Mon Dec 24, 2018 1:22 am
by king
Hi everybody.
I provided my own cefclient implementation which implements CefFocusHandler.
I expect that everytime I click out of the browser CefFocusHandler::OnTakeFocus would be called and when i click back into the browser, CefFocusHandler::OnSetFocus would be called. But it turned out now the case.
first time I clicked in the browser OnSetFocus is called, click out, OnTakeFocus is NOT called and when i clicked back OnSetFocus is not called, instead OnGotFocus is called. Anyone could explain this wierd behavior??
I tried BrowserHost::SetFocus(false) as well, it seems that BroswerHost::SetFocus simple returns if i pass in false as parameter and not doing anything. Is this a bug???? Should not it make the browser loose the focus so that when i click back again OnSetFocus would be called??

thanks

Re: CefFocusHandler issue.

PostPosted: Mon Dec 24, 2018 3:13 am
by Czarek
What OS and CEF version? Does it reproduce in cefclient?

Re: CefFocusHandler issue.

PostPosted: Mon Dec 24, 2018 4:07 am
by king
Czarek wrote:What OS and CEF version? Does it reproduce in cefclient?

It is Linux and i am using the latest cef version. and you can see from the source code here https://gitlab.collabora.com/web/cef/bl ... nux.cc:150
it really does not do anything when you pass false.

Re: CefFocusHandler issue.

PostPosted: Mon Dec 24, 2018 5:18 am
by magreenblatt
The callback behavior sounds correct based on the CefFocusHandler documentation, and SetFocus(false) intentionally does nothing in windowed mode. You can test on Windows/macOS to verify consistency across platforms.

Re: CefFocusHandler issue.

PostPosted: Wed Sep 18, 2019 4:06 am
by king
magreenblatt wrote:The callback behavior sounds correct based on the CefFocusHandler documentation, and SetFocus(false) intentionally does nothing in windowed mode. You can test on Windows/macOS to verify consistency across platforms.

Then how am i supposed to know when the user clicked outside the browser and when it clicks in??

Re: CefFocusHandler issue.

PostPosted: Wed Sep 18, 2019 5:46 am
by magreenblatt
king wrote:
magreenblatt wrote:The callback behavior sounds correct based on the CefFocusHandler documentation, and SetFocus(false) intentionally does nothing in windowed mode. You can test on Windows/macOS to verify consistency across platforms.

Then how am i supposed to know when the user clicked outside the browser and when it clicks in??

The OS delivers focus notifications to the window that gains/loses focus. Inside the browser window you can get the notifications via JavaScript.