Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1163)

Unified Diff: chrome/browser/render_widget_host_view_win.cc

Issue 10004: Ensure that windowed plugins get focus during WM_MOUSEACTIVATE. This fixes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/render_widget_host_view_win.cc
===================================================================
--- chrome/browser/render_widget_host_view_win.cc (revision 5147)
+++ chrome/browser/render_widget_host_view_win.cc (working copy)
@@ -779,25 +779,27 @@
LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM,
BOOL& handled) {
- // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin
- // child window. This is to ensure that keyboard events are received
- // by the plugin. The correct way to fix this would be send over
- // an event to the renderer which would then eventually send over
- // a setFocus call to the plugin widget. This would ensure that
- // the renderer (webkit) knows about the plugin widget receiving
- // focus.
- // TODO(iyengar) Do the right thing as per the above comment.
- POINT cursor_pos = {0};
- ::GetCursorPos(&cursor_pos);
- MapWindowPoints(m_hWnd, &cursor_pos, 1);
- HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos);
- if (::IsWindow(child_window)) {
- ::SetFocus(child_window);
- return MA_NOACTIVATE;
- } else {
- handled = FALSE;
- return MA_ACTIVATE;
+ HWND focus_window = GetFocus();
+ if (!::IsWindow(focus_window) || !IsChild(focus_window)) {
+ // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin
+ // child window. This is to ensure that keyboard events are received
+ // by the plugin. The correct way to fix this would be send over
+ // an event to the renderer which would then eventually send over
+ // a setFocus call to the plugin widget. This would ensure that
+ // the renderer (webkit) knows about the plugin widget receiving
+ // focus.
+ // TODO(iyengar) Do the right thing as per the above comment.
+ POINT cursor_pos = {0};
+ ::GetCursorPos(&cursor_pos);
+ ::ScreenToClient(m_hWnd, &cursor_pos);
+ HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos);
+ if (::IsWindow(child_window)) {
+ ::SetFocus(child_window);
+ return MA_NOACTIVATE;
+ }
}
+ handled = FALSE;
+ return MA_ACTIVATE;
}
LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698