mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-09 08:38:41 +01:00
Windows: Fix focus/blur handling (issue #1677)
This commit is contained in:
parent
5f0720e096
commit
3010ee1ce6
@ -49,7 +49,9 @@ patches = [
|
|||||||
{
|
{
|
||||||
# Allow specification of a parent window handle for Widget creation.
|
# Allow specification of a parent window handle for Widget creation.
|
||||||
# https://code.google.com/p/chromiumembedded/issues/detail?id=180
|
# https://code.google.com/p/chromiumembedded/issues/detail?id=180
|
||||||
'name': 'views_widget_180',
|
# Fix focus/blur handling on Windows.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/1677
|
||||||
|
'name': 'views_widget_180_1677',
|
||||||
'path': '../ui/views/widget/',
|
'path': '../ui/views/widget/',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -182,4 +184,11 @@ patches = [
|
|||||||
'name': 'hwnd_message_handler_1481',
|
'name': 'hwnd_message_handler_1481',
|
||||||
'path': '../ui/views/win/',
|
'path': '../ui/views/win/',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# Fix focus/blur handling on Windows.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/1677
|
||||||
|
# https://codereview.chromium.org/1135063002 (reverted)
|
||||||
|
'name': 'aura_window_1677',
|
||||||
|
'path': '../ui/aura/',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
32
patch/patches/aura_window_1677.patch
Normal file
32
patch/patches/aura_window_1677.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
diff --git window.cc window.cc
|
||||||
|
index 0c021f8..ec62e3e 100644
|
||||||
|
--- window.cc
|
||||||
|
+++ window.cc
|
||||||
|
@@ -637,6 +637,12 @@ void Window::Focus() {
|
||||||
|
client->FocusWindow(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void Window::Blur() {
|
||||||
|
+ client::FocusClient* client = client::GetFocusClient(this);
|
||||||
|
+ DCHECK(client);
|
||||||
|
+ client->FocusWindow(NULL);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
bool Window::HasFocus() const {
|
||||||
|
client::FocusClient* client = client::GetFocusClient(this);
|
||||||
|
return client && client->GetFocusedWindow() == this;
|
||||||
|
diff --git window.h window.h
|
||||||
|
index 749a66a..229a867 100644
|
||||||
|
--- window.h
|
||||||
|
+++ window.h
|
||||||
|
@@ -262,8 +262,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
||||||
|
// that has a delegate set). The toplevel window may be |this|.
|
||||||
|
Window* GetToplevelWindow();
|
||||||
|
|
||||||
|
- // Claims focus.
|
||||||
|
+ // Claims or relinquishes the claim to focus.
|
||||||
|
void Focus();
|
||||||
|
+ void Blur();
|
||||||
|
|
||||||
|
// Returns true if the Window is currently the focused window.
|
||||||
|
bool HasFocus() const;
|
@ -12,7 +12,7 @@ index a8e088c..838b6a0 100644
|
|||||||
return host ? host->GetAcceleratedWidget() : NULL;
|
return host ? host->GetAcceleratedWidget() : NULL;
|
||||||
}
|
}
|
||||||
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
|
diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc
|
||||||
index 93b3c5b..e0e505e 100644
|
index 93b3c5b..a0940ce 100644
|
||||||
--- desktop_aura/desktop_window_tree_host_win.cc
|
--- desktop_aura/desktop_window_tree_host_win.cc
|
||||||
+++ desktop_aura/desktop_window_tree_host_win.cc
|
+++ desktop_aura/desktop_window_tree_host_win.cc
|
||||||
@@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
|
@@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
|
||||||
@ -26,7 +26,7 @@ index 93b3c5b..e0e505e 100644
|
|||||||
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);
|
||||||
@@ -793,6 +795,7 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
|
@@ -793,10 +795,12 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
|
||||||
|
|
||||||
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
|
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
|
||||||
// TODO(beng): inform the native_widget_delegate_.
|
// TODO(beng): inform the native_widget_delegate_.
|
||||||
@ -34,6 +34,11 @@ index 93b3c5b..e0e505e 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) {
|
void DesktopWindowTreeHostWin::HandleNativeBlur(HWND focused_window) {
|
||||||
|
// TODO(beng): inform the native_widget_delegate_.
|
||||||
|
+ GetWidget()->GetNativeWindow()->Blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
|
||||||
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
|
diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc
|
||||||
index a56deb7..a5e8422 100644
|
index a56deb7..a5e8422 100644
|
||||||
--- desktop_aura/desktop_window_tree_host_x11.cc
|
--- desktop_aura/desktop_window_tree_host_x11.cc
|
Loading…
x
Reference in New Issue
Block a user