CefFocusHandler issue.

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CefFocusHandler issue.

Postby king » Mon Dec 24, 2018 1:22 am

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
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: CefFocusHandler issue.

Postby Czarek » Mon Dec 24, 2018 3:13 am

What OS and CEF version? Does it reproduce in cefclient?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CefFocusHandler issue.

Postby king » Mon Dec 24, 2018 4:07 am

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.
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: CefFocusHandler issue.

Postby magreenblatt » Mon Dec 24, 2018 5:18 am

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.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefFocusHandler issue.

Postby king » Wed Sep 18, 2019 4:06 am

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??
king
Techie
 
Posts: 18
Joined: Wed Nov 14, 2018 3:41 am

Re: CefFocusHandler issue.

Postby magreenblatt » Wed Sep 18, 2019 5:46 am

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.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], yutou15 and 44 guests