mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix delivery of focus/blur events (issue #1301).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1717 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -601,7 +601,7 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (browser)
|
||||
browser->OnSetFocus(FOCUS_SOURCE_SYSTEM);
|
||||
browser->SetFocus(true);
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
@ -611,11 +611,6 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::PlatformSetViewFocus() {
|
||||
if (window_widget_)
|
||||
::SetFocus(views::HWNDForWidget(window_widget_));
|
||||
}
|
||||
|
||||
ui::PlatformCursor CefBrowserHostImpl::GetPlatformCursor(
|
||||
blink::WebCursorInfo::Type type) {
|
||||
HMODULE module_handle = NULL;
|
||||
@ -701,6 +696,25 @@ void CefBrowserHostImpl::PlatformSizeTo(int width, int height) {
|
||||
rect.bottom, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::PlatformSetFocus(bool focus) {
|
||||
if (!focus)
|
||||
return;
|
||||
|
||||
if (web_contents_) {
|
||||
// Give logical focus to the RenderWidgetHostViewAura in the views
|
||||
// hierarchy. This does not change the native keyboard focus.
|
||||
web_contents_->Focus();
|
||||
}
|
||||
|
||||
if (window_widget_) {
|
||||
// Give native focus to the DesktopNativeWidgetAura for the root window.
|
||||
// Needs to be done via the HWND so that keyboard focus is assigned
|
||||
// correctly. DesktopNativeWidgetAura will update focus state on the
|
||||
// aura::Window when WM_SETFOCUS and WM_KILLFOCUS are received.
|
||||
::SetFocus(HWNDForWidget(window_widget_));
|
||||
}
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserHostImpl::PlatformGetWindowHandle() {
|
||||
return window_info_.window;
|
||||
}
|
||||
|
Reference in New Issue
Block a user