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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 67063: Fix for bug where mouse-wheel closes menus (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/gfx/gdi_util.h" 8 #include "base/gfx/gdi_util.h"
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 } 868 }
869 } 869 }
870 870
871 render_widget_host_->ForwardKeyboardEvent( 871 render_widget_host_->ForwardKeyboardEvent(
872 NativeWebKeyboardEvent(m_hWnd, message, wparam, lparam)); 872 NativeWebKeyboardEvent(m_hWnd, message, wparam, lparam));
873 return 0; 873 return 0;
874 } 874 }
875 875
876 LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, 876 LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam,
877 LPARAM lparam, BOOL& handled) { 877 LPARAM lparam, BOOL& handled) {
878 // Forward the mouse-wheel message to the window under the mouse if it belongs
879 // to us.
880 if (message == WM_MOUSEWHEEL &&
881 views::RerouteMouseWheel(m_hWnd, wparam, lparam)) {
882 handled = TRUE;
883 return 0;
884 }
885
878 // Workaround for Thinkpad mousewheel driver. We get mouse wheel/scroll 886 // Workaround for Thinkpad mousewheel driver. We get mouse wheel/scroll
879 // messages even if we are not in the foreground. So here we check if 887 // messages even if we are not in the foreground. So here we check if
880 // we have any owned popup windows in the foreground and dismiss them. 888 // we have any owned popup windows in the foreground and dismiss them.
881 if (m_hWnd != GetForegroundWindow()) { 889 if (m_hWnd != GetForegroundWindow()) {
882 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT); 890 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT);
883 EnumThreadWindows( 891 EnumThreadWindows(
884 GetCurrentThreadId(), 892 GetCurrentThreadId(),
885 DismissOwnedPopups, 893 DismissOwnedPopups,
886 reinterpret_cast<LPARAM>(toplevel_hwnd)); 894 reinterpret_cast<LPARAM>(toplevel_hwnd));
887 } 895 }
888 896
889 // Forward the mouse-wheel message to the window under the mouse if it belongs
890 // to us.
891 if (message == WM_MOUSEWHEEL &&
892 views::RerouteMouseWheel(m_hWnd, wparam, lparam)) {
893 handled = TRUE;
894 return 0;
895 }
896
897 // This is a bit of a hack, but will work for now since we don't want to 897 // This is a bit of a hack, but will work for now since we don't want to
898 // pollute this object with WebContents-specific functionality... 898 // pollute this object with WebContents-specific functionality...
899 bool handled_by_webcontents = false; 899 bool handled_by_webcontents = false;
900 if (GetParent()) { 900 if (GetParent()) {
901 // Use a special reflected message to break recursion. If we send 901 // Use a special reflected message to break recursion. If we send
902 // WM_MOUSEWHEEL, the focus manager subclass of web contents will 902 // WM_MOUSEWHEEL, the focus manager subclass of web contents will
903 // route it back here. 903 // route it back here.
904 MSG new_message = {0}; 904 MSG new_message = {0};
905 new_message.hwnd = m_hWnd; 905 new_message.hwnd = m_hWnd;
906 new_message.message = message; 906 new_message.message = message;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 // WM_LBUTTONDOWN. 1090 // WM_LBUTTONDOWN.
1091 SetFocus(); 1091 SetFocus();
1092 } 1092 }
1093 } 1093 }
1094 1094
1095 void RenderWidgetHostViewWin::ShutdownHost() { 1095 void RenderWidgetHostViewWin::ShutdownHost() {
1096 shutdown_factory_.RevokeAll(); 1096 shutdown_factory_.RevokeAll();
1097 render_widget_host_->Shutdown(); 1097 render_widget_host_->Shutdown();
1098 // Do not touch any members at this point, |this| has been deleted. 1098 // Do not touch any members at this point, |this| has been deleted.
1099 } 1099 }
OLDNEW
« 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