pacificIT / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 1 forks source link

When calling SetFocus(true), cef doesn't fire OnSetFocus event on windows (on mac it does) #563

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Implement OnSetFocus
2. Call SetFocus(true)

What is the expected output? What do you see instead?
Expected: OnSetFocus has to be called
I see: It works on mac. It doesn't work on windows.

What version of the product are you using? On what operating system?
revision 567

Focus handler is called on windows from CefBrowserWindow's wndproc, case 
WM_SETFOCUS. When calling SetFocus(true), focus is sent directly to 
WebViewHost, not reaching CefBrowserWindow's WM_SETFOCUS.
On mac, handler is called on becomeFirstResponder.

Patch consists of a handler call before setting focus to the webview. It is 
implemented only on windows.

Original issue reported on code.google.com by iohan...@gmail.com on 2 Apr 2012 at 2:55

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 559 has been merged into this issue.

Original comment by magreenb...@gmail.com on 2 Apr 2012 at 3:16

GoogleCodeExporter commented 9 years ago
@iohanson: To clarify, are you:

1. Calling SetFocus(true) in response to the OnSetFocus callback, or
2. Calling SetFocus(true) separately and just returning true from the 
OnSetFocus callback?

Original comment by magreenb...@gmail.com on 2 Apr 2012 at 3:57

GoogleCodeExporter commented 9 years ago
Revision 568 executes the CefFocusHandler::OnSetFocus callback for calls to 
CefBrowser::SetFocus and mouse clicks on the view. Also protects against 
re-entrancy of OnSetFocus if SetFocus is called from inside the callback.

Original comment by magreenb...@gmail.com on 2 Apr 2012 at 4:30

GoogleCodeExporter commented 9 years ago
I am calling SetFocus(true) separately and just returning true from the 
OnSetFocus callback.
Thanks.

Original comment by iohan...@gmail.com on 2 Apr 2012 at 4:41

GoogleCodeExporter commented 9 years ago
I've reviewed the fix and I think that on mac for a SetFocus(true) call, 
OnSetFocus handler will be called twice : the first time from within SetFocus 
function and the second time from becomeFirstResponter event.

Original comment by iohan...@gmail.com on 2 Apr 2012 at 4:57

GoogleCodeExporter commented 9 years ago
@comment#5: Yes, I think this is true. I guess we can add a property to 
BrowserWebView that guards the call to makeFirstResponder in 
browser_impl_mac.mm CefBrowserImpl::UIT_SetFocus and then check the property 
from becomeFirstResponder before executing the OnSetFocus callback again.

Original comment by magreenb...@gmail.com on 2 Apr 2012 at 5:07

GoogleCodeExporter commented 9 years ago
Revision 569 avoids calling OnSetFocus multiple times.

Original comment by magreenb...@gmail.com on 2 Apr 2012 at 7:06

GoogleCodeExporter commented 9 years ago
Added to 1024 and 963 branches in revision 626 and revision 627 respectively.

Original comment by magreenb...@gmail.com on 16 May 2012 at 5:04

GoogleCodeExporter commented 9 years ago
Changes from libcef/browser_impl_win.cc (rev 568) regarding focus issue are 
missing in 1024 branch.

Original comment by iohan...@gmail.com on 22 May 2012 at 2:52

GoogleCodeExporter commented 9 years ago
@comment#9: Thanks, fixed in revision 637.

Original comment by magreenb...@gmail.com on 22 May 2012 at 3:29