| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "ui/base/win/mouse_wheel_util.h" | 5 #include "ui/base/win/mouse_wheel_util.h" |
| 6 | 6 |
| 7 #include <windowsx.h> | 7 #include <windowsx.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "ui/base/view_prop.h" | 10 #include "ui/base/view_prop.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } else { | 94 } else { |
| 95 // The wheel is scrolling over an unrelated window. Make sure that we | 95 // The wheel is scrolling over an unrelated window. Make sure that we |
| 96 // have marked that window as supporting mouse wheel rerouting. | 96 // have marked that window as supporting mouse wheel rerouting. |
| 97 // Otherwise, we cannot send random WM_MOUSEWHEEL messages to arbitrary | 97 // Otherwise, we cannot send random WM_MOUSEWHEEL messages to arbitrary |
| 98 // windows. So just drop the message. | 98 // windows. So just drop the message. |
| 99 if (!WindowSupportsRerouteMouseWheel(window_under_wheel)) | 99 if (!WindowSupportsRerouteMouseWheel(window_under_wheel)) |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 // If the child window is transparent, then it is not interested in |
| 105 // receiving wheel events. |
| 106 if (IsChild(window, window_under_wheel) && |
| 107 ::GetWindowLong( |
| 108 window_under_wheel, GWL_EXSTYLE) & WS_EX_TRANSPARENT) { |
| 109 return false; |
| 110 } |
| 111 |
| 104 // window_under_wheel is a Chrome window. If allowed, redirect. | 112 // window_under_wheel is a Chrome window. If allowed, redirect. |
| 105 if (IsCompatibleWithMouseWheelRedirection(window_under_wheel)) { | 113 if (IsCompatibleWithMouseWheelRedirection(window_under_wheel)) { |
| 106 base::AutoReset<bool> auto_reset_recursion_break(&recursion_break, true); | 114 base::AutoReset<bool> auto_reset_recursion_break(&recursion_break, true); |
| 107 SendMessage(window_under_wheel, WM_MOUSEWHEEL, w_param, l_param); | 115 SendMessage(window_under_wheel, WM_MOUSEWHEEL, w_param, l_param); |
| 108 return true; | 116 return true; |
| 109 } | 117 } |
| 110 // If redirection is disallowed, try the parent. | 118 // If redirection is disallowed, try the parent. |
| 111 window_under_wheel = GetAncestor(window_under_wheel, GA_PARENT); | 119 window_under_wheel = GetAncestor(window_under_wheel, GA_PARENT); |
| 112 } | 120 } |
| 113 // If we traversed back to the starting point, we should process | 121 // If we traversed back to the starting point, we should process |
| 114 // this message normally; return false. | 122 // this message normally; return false. |
| 115 return false; | 123 return false; |
| 116 } | 124 } |
| 117 | 125 |
| 118 } // namespace ui | 126 } // namespace ui |
| OLD | NEW |