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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_builders_win.cc

Issue 142253002: Added checking for higher bit being set in GetAsyncKeyState return value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/input/web_input_event_builders_win.h" 5 #include "content/browser/renderer_host/input/web_input_event_builders_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 9
10 using blink::WebInputEvent; 10 using blink::WebInputEvent;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 GetKeyStateFunction get_key_state_func; 332 GetKeyStateFunction get_key_state_func;
333 UINT key_state; 333 UINT key_state;
334 float wheel_delta; 334 float wheel_delta;
335 bool horizontal_scroll = false; 335 bool horizontal_scroll = false;
336 if ((message == WM_VSCROLL) || (message == WM_HSCROLL)) { 336 if ((message == WM_VSCROLL) || (message == WM_HSCROLL)) {
337 // Synthesize mousewheel event from a scroll event. This is needed to 337 // Synthesize mousewheel event from a scroll event. This is needed to
338 // simulate middle mouse scrolling in some laptops. Use GetAsyncKeyState 338 // simulate middle mouse scrolling in some laptops. Use GetAsyncKeyState
339 // for key state since we are synthesizing the input event. 339 // for key state since we are synthesizing the input event.
340 get_key_state_func = GetAsyncKeyState; 340 get_key_state_func = GetAsyncKeyState;
341 key_state = 0; 341 key_state = 0;
342 if (get_key_state_func(VK_SHIFT)) 342 if (get_key_state_func(VK_SHIFT) & 0x8000)
343 key_state |= MK_SHIFT; 343 key_state |= MK_SHIFT;
344 if (get_key_state_func(VK_CONTROL)) 344 if (get_key_state_func(VK_CONTROL) & 0x8000)
345 key_state |= MK_CONTROL; 345 key_state |= MK_CONTROL;
346 // NOTE: There doesn't seem to be a way to query the mouse button state 346 // NOTE: There doesn't seem to be a way to query the mouse button state
347 // in this case. 347 // in this case.
348 348
349 POINT cursor_position = {0}; 349 POINT cursor_position = {0};
350 GetCursorPos(&cursor_position); 350 GetCursorPos(&cursor_position);
351 result.globalX = cursor_position.x; 351 result.globalX = cursor_position.x;
352 result.globalY = cursor_position.y; 352 result.globalY = cursor_position.y;
353 353
354 switch (LOWORD(wparam)) { 354 switch (LOWORD(wparam)) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 result.wheelTicksX = wheel_delta; 453 result.wheelTicksX = wheel_delta;
454 } else { 454 } else {
455 result.deltaY = scroll_delta; 455 result.deltaY = scroll_delta;
456 result.wheelTicksY = wheel_delta; 456 result.wheelTicksY = wheel_delta;
457 } 457 }
458 458
459 return result; 459 return result;
460 } 460 }
461 461
462 } // namespace content 462 } // namespace content
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