OLD | NEW |
---|---|
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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "webkit/glue/webinputevent.h" | 7 #include "webkit/glue/webinputevent.h" |
8 | 8 |
9 #include "webkit/glue/event_conversion.h" | 9 #include "webkit/glue/event_conversion.h" |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 break; | 165 break; |
166 case SB_PAGEDOWN: | 166 case SB_PAGEDOWN: |
167 wheel_delta = -kPageScroll * WHEEL_DELTA; | 167 wheel_delta = -kPageScroll * WHEEL_DELTA; |
168 break; | 168 break; |
169 // TODO(joshia): Handle SB_THUMBPOSITION and SB_THUMBTRACK | 169 // TODO(joshia): Handle SB_THUMBPOSITION and SB_THUMBTRACK |
170 // for compeleteness | 170 // for compeleteness |
171 default: | 171 default: |
172 break; | 172 break; |
173 } | 173 } |
174 | 174 |
175 // Windows sends the following messages for tilt-wheel events. | |
176 // * Tilt a mousewheel (left) | |
177 // message == WM_HSCROLL, wparam == SB_LINELEFT (== SB_LINEUP). | |
178 // * Tilt a mousewheel (right) | |
179 // message == WM_HSCROLL, wparam == SB_LINERIGHT (== SB_LINEDOWN). | |
180 // To convert these events to the shift + mousewheel ones, we do not only | |
181 // add a shift but also change the signs of their |wheel_delta| values. | |
182 if (WM_HSCROLL == message) { | |
Peter Kasting
2008/11/10 19:00:29
I still don't think this can possibly be the right
| |
183 key_state |= MK_SHIFT; | |
184 wheel_delta = -wheel_delta; | |
185 } | |
186 | |
187 // Use GetAsyncKeyState for key state since we are synthesizing | 175 // Use GetAsyncKeyState for key state since we are synthesizing |
188 // the input | 176 // the input |
189 get_key_state = GetAsyncKeyState; | 177 get_key_state = GetAsyncKeyState; |
190 } else { | 178 } else { |
179 // TODO(hbono): we should add a new variable which indicates scroll | |
180 // direction and remove this key_state hack. | |
181 if (WM_MOUSEHWHEEL == message) | |
182 key_state |= MK_SHIFT; | |
191 | 183 |
192 global_x = static_cast<short>(LOWORD(lparam)); | 184 global_x = static_cast<short>(LOWORD(lparam)); |
193 global_y = static_cast<short>(HIWORD(lparam)); | 185 global_y = static_cast<short>(HIWORD(lparam)); |
194 } | 186 } |
195 | 187 |
196 POINT client_point = { global_x, global_y }; | 188 POINT client_point = { global_x, global_y }; |
197 ScreenToClient(hwnd, &client_point); | 189 ScreenToClient(hwnd, &client_point); |
198 x = client_point.x; | 190 x = client_point.x; |
199 y = client_point.y; | 191 y = client_point.y; |
200 | 192 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 modifiers |= CTRL_KEY; | 289 modifiers |= CTRL_KEY; |
298 if (GetKeyState(VK_MENU) & 0x8000) | 290 if (GetKeyState(VK_MENU) & 0x8000) |
299 modifiers |= (ALT_KEY | META_KEY); | 291 modifiers |= (ALT_KEY | META_KEY); |
300 | 292 |
301 if (LOWORD(lparam) > 1) | 293 if (LOWORD(lparam) > 1) |
302 modifiers |= IS_AUTO_REPEAT; | 294 modifiers |= IS_AUTO_REPEAT; |
303 | 295 |
304 // TODO(darin): figure out if we should set IS_KEYPAD | 296 // TODO(darin): figure out if we should set IS_KEYPAD |
305 } | 297 } |
306 | 298 |
OLD | NEW |