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

Side by Side Diff: ui/base/win/mouse_wheel_util.cc

Issue 7753025: Move the mouse wheel utils from views to ui\base\win, to get rid of some views dependencies in co... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « ui/base/win/mouse_wheel_util.h ('k') | ui/ui.gyp » ('j') | 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) 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 "views/focus/focus_util_win.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"
11 #include "ui/base/win/hwnd_util.h" 11 #include "ui/base/win/hwnd_util.h"
12 12
13 using ui::ViewProp; 13 namespace ui {
14
15 namespace views {
16 14
17 // Property used to indicate the HWND supports having mouse wheel messages 15 // Property used to indicate the HWND supports having mouse wheel messages
18 // rerouted to it. 16 // rerouted to it.
19 static const char* const kHWNDSupportMouseWheelRerouting = 17 static const char* const kHWNDSupportMouseWheelRerouting =
20 "__HWND_MW_REROUTE_OK"; 18 "__HWND_MW_REROUTE_OK";
21 19
22 static bool WindowSupportsRerouteMouseWheel(HWND window) { 20 static bool WindowSupportsRerouteMouseWheel(HWND window) {
23 while (GetWindowLong(window, GWL_STYLE) & WS_CHILD) { 21 while (GetWindowLong(window, GWL_STYLE) & WS_CHILD) {
24 if (!IsWindow(window)) 22 if (!IsWindow(window))
25 break; 23 break;
26 24
27 if (reinterpret_cast<bool>( 25 if (reinterpret_cast<bool>(
28 ViewProp::GetValue(window, kHWNDSupportMouseWheelRerouting))) { 26 ViewProp::GetValue(window, kHWNDSupportMouseWheelRerouting))) {
29 return true; 27 return true;
30 } 28 }
31 window = GetParent(window); 29 window = GetParent(window);
32 } 30 }
33 return false; 31 return false;
34 } 32 }
35 33
36 static bool IsCompatibleWithMouseWheelRedirection(HWND window) { 34 static bool IsCompatibleWithMouseWheelRedirection(HWND window) {
37 std::wstring class_name = ui::GetClassName(window); 35 std::wstring class_name = GetClassName(window);
38 // Mousewheel redirection to comboboxes is a surprising and 36 // Mousewheel redirection to comboboxes is a surprising and
39 // undesireable user behavior. 37 // undesireable user behavior.
40 return !(class_name == L"ComboBox" || 38 return !(class_name == L"ComboBox" ||
41 class_name == L"ComboBoxEx32"); 39 class_name == L"ComboBoxEx32");
42 } 40 }
43 41
44 static bool CanRedirectMouseWheelFrom(HWND window) { 42 static bool CanRedirectMouseWheelFrom(HWND window) {
45 std::wstring class_name = ui::GetClassName(window); 43 std::wstring class_name = GetClassName(window);
46 44
47 // Older Thinkpad mouse wheel drivers create a window under mouse wheel 45 // Older Thinkpad mouse wheel drivers create a window under mouse wheel
48 // pointer. Detect if we are dealing with this window. In this case we 46 // pointer. Detect if we are dealing with this window. In this case we
49 // don't need to do anything as the Thinkpad mouse driver will send 47 // don't need to do anything as the Thinkpad mouse driver will send
50 // mouse wheel messages to the right window. 48 // mouse wheel messages to the right window.
51 if ((class_name == L"Syn Visual Class") || 49 if ((class_name == L"Syn Visual Class") ||
52 (class_name == L"SynTrackCursorWindowClass")) 50 (class_name == L"SynTrackCursorWindowClass"))
53 return false; 51 return false;
54 52
55 return true; 53 return true;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 109 return true;
112 } 110 }
113 // If redirection is disallowed, try the parent. 111 // If redirection is disallowed, try the parent.
114 window_under_wheel = GetAncestor(window_under_wheel, GA_PARENT); 112 window_under_wheel = GetAncestor(window_under_wheel, GA_PARENT);
115 } 113 }
116 // If we traversed back to the starting point, we should process 114 // If we traversed back to the starting point, we should process
117 // this message normally; return false. 115 // this message normally; return false.
118 return false; 116 return false;
119 } 117 }
120 118
121 } // namespace views 119 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/mouse_wheel_util.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698