Windows: Fix assignment of keyboard focus (issue #1248).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1643 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
199a3faafe
commit
d8aed5b52d
|
@ -1689,6 +1689,15 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||||
|
|
||||||
if (web_contents_.get())
|
if (web_contents_.get())
|
||||||
web_contents_->GetView()->Focus();
|
web_contents_->GetView()->Focus();
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
if (!IsWindowRenderingDisabled()) {
|
||||||
|
// When windowed rendering is used in combination with Aura on Windows we
|
||||||
|
// need to explicitly set focus to the native window handle. Otherwise,
|
||||||
|
// the window doesn't get keyboard focus.
|
||||||
|
PlatformSetViewFocus();
|
||||||
|
}
|
||||||
|
#endif // defined(OS_WIN)
|
||||||
} else {
|
} else {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
|
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
|
||||||
|
|
|
@ -456,6 +456,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||||
static LPCTSTR GetWndClass();
|
static LPCTSTR GetWndClass();
|
||||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
void PlatformSetViewFocus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the window.
|
// Create the window.
|
||||||
|
|
|
@ -32,12 +32,14 @@
|
||||||
#include "net/base/mime_util.h"
|
#include "net/base/mime_util.h"
|
||||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
||||||
#include "third_party/WebKit/public/web/win/WebInputEventFactory.h"
|
#include "third_party/WebKit/public/web/win/WebInputEventFactory.h"
|
||||||
|
#include "ui/aura/window.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
#include "ui/base/win/shell.h"
|
#include "ui/base/win/shell.h"
|
||||||
#include "ui/gfx/win/hwnd_util.h"
|
#include "ui/gfx/win/hwnd_util.h"
|
||||||
#include "ui/views/background.h"
|
#include "ui/views/background.h"
|
||||||
#include "ui/views/controls/webview/webview.h"
|
#include "ui/views/controls/webview/webview.h"
|
||||||
#include "ui/views/layout/fill_layout.h"
|
#include "ui/views/layout/fill_layout.h"
|
||||||
|
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
#include "ui/views/widget/widget_delegate.h"
|
#include "ui/views/widget/widget_delegate.h"
|
||||||
|
|
||||||
|
@ -62,6 +64,21 @@ void SetAeroGlass(HWND hWnd) {
|
||||||
DwmExtendFrameIntoClientArea(hWnd, &mgMarInset);
|
DwmExtendFrameIntoClientArea(hWnd, &mgMarInset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND GetHWND(views::Widget* widget) {
|
||||||
|
gfx::NativeWindow window = widget->GetNativeWindow();
|
||||||
|
DCHECK(window);
|
||||||
|
if (!window)
|
||||||
|
return NULL;
|
||||||
|
views::DesktopWindowTreeHostWin* host =
|
||||||
|
static_cast<views::DesktopWindowTreeHostWin*>(window->GetHost());
|
||||||
|
DCHECK(host);
|
||||||
|
if (!host)
|
||||||
|
return NULL;
|
||||||
|
HWND hwnd = host->GetHWND();
|
||||||
|
DCHECK(hwnd);
|
||||||
|
return hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
|
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
|
||||||
CEF_REQUIRE_FILET();
|
CEF_REQUIRE_FILET();
|
||||||
|
|
||||||
|
@ -709,6 +726,11 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostImpl::PlatformSetViewFocus() {
|
||||||
|
if (window_widget_)
|
||||||
|
::SetFocus(GetHWND(window_widget_));
|
||||||
|
}
|
||||||
|
|
||||||
ui::PlatformCursor CefBrowserHostImpl::GetPlatformCursor(
|
ui::PlatformCursor CefBrowserHostImpl::GetPlatformCursor(
|
||||||
blink::WebCursorInfo::Type type) {
|
blink::WebCursorInfo::Type type) {
|
||||||
HMODULE module_handle = NULL;
|
HMODULE module_handle = NULL;
|
||||||
|
|
|
@ -26,6 +26,18 @@ Index: desktop_aura/desktop_window_tree_host_win.cc
|
||||||
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
|
parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget();
|
||||||
|
|
||||||
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
|
||||||
|
Index: desktop_aura/desktop_window_tree_host_win.h
|
||||||
|
===================================================================
|
||||||
|
--- desktop_aura/desktop_window_tree_host_win.h (revision 261035)
|
||||||
|
+++ desktop_aura/desktop_window_tree_host_win.h (working copy)
|
||||||
|
@@ -214,6 +214,7 @@
|
||||||
|
LPARAM l_param) OVERRIDE;
|
||||||
|
virtual bool HandleScrollEvent(const ui::ScrollEvent& event) OVERRIDE;
|
||||||
|
|
||||||
|
+ public:
|
||||||
|
Widget* GetWidget();
|
||||||
|
const Widget* GetWidget() const;
|
||||||
|
HWND GetHWND() const;
|
||||||
Index: widget.cc
|
Index: widget.cc
|
||||||
===================================================================
|
===================================================================
|
||||||
--- widget.cc (revision 261035)
|
--- widget.cc (revision 261035)
|
||||||
|
|
Loading…
Reference in New Issue