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

Side by Side Diff: ui/base/events/event.cc

Issue 16950030: Handle alternate types in HandleMouseEvent. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move virtual override to end of class/public. Created 7 years, 5 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
« no previous file with comments | « ui/base/events/event.h ('k') | ui/views/widget/native_widget_win.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/events/event.h" 5 #include "ui/base/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #endif 9 #endif
10 10
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 SetType(ET_MOUSEWHEEL); 412 SetType(ET_MOUSEWHEEL);
413 } 413 }
414 414
415 MouseWheelEvent::MouseWheelEvent(const MouseEvent& mouse_event, 415 MouseWheelEvent::MouseWheelEvent(const MouseEvent& mouse_event,
416 int x_offset, 416 int x_offset,
417 int y_offset) 417 int y_offset)
418 : MouseEvent(mouse_event), offset_(x_offset, y_offset) { 418 : MouseEvent(mouse_event), offset_(x_offset, y_offset) {
419 DCHECK(type() == ET_MOUSEWHEEL); 419 DCHECK(type() == ET_MOUSEWHEEL);
420 } 420 }
421 421
422 MouseWheelEvent::MouseWheelEvent(const MouseWheelEvent& mouse_wheel_event)
423 : MouseEvent(mouse_wheel_event),
424 offset_(mouse_wheel_event.offset()) {
425 DCHECK(type() == ET_MOUSEWHEEL);
426 }
427
422 #if defined(OS_WIN) 428 #if defined(OS_WIN)
423 // This value matches windows WHEEL_DELTA. 429 // This value matches windows WHEEL_DELTA.
424 // static 430 // static
425 const int MouseWheelEvent::kWheelDelta = 120; 431 const int MouseWheelEvent::kWheelDelta = 120;
426 #else 432 #else
427 // This value matches GTK+ wheel scroll amount. 433 // This value matches GTK+ wheel scroll amount.
428 const int MouseWheelEvent::kWheelDelta = 53; 434 const int MouseWheelEvent::kWheelDelta = 53;
429 #endif 435 #endif
430 436
437 void MouseWheelEvent::UpdateForRootTransform(
438 const gfx::Transform& inverted_root_transform) {
439 LocatedEvent::UpdateForRootTransform(inverted_root_transform);
440 gfx::DecomposedTransform decomp;
441 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform);
442 DCHECK(success);
443 if (decomp.scale[0])
444 offset_.set_x(offset_.x() * decomp.scale[0]);
445 if (decomp.scale[1])
446 offset_.set_y(offset_.y() * decomp.scale[1]);
447 }
448
431 //////////////////////////////////////////////////////////////////////////////// 449 ////////////////////////////////////////////////////////////////////////////////
432 // TouchEvent 450 // TouchEvent
433 451
434 TouchEvent::TouchEvent(const base::NativeEvent& native_event) 452 TouchEvent::TouchEvent(const base::NativeEvent& native_event)
435 : LocatedEvent(native_event), 453 : LocatedEvent(native_event),
436 touch_id_(GetTouchId(native_event)), 454 touch_id_(GetTouchId(native_event)),
437 radius_x_(GetTouchRadiusX(native_event)), 455 radius_x_(GetTouchRadiusX(native_event)),
438 radius_y_(GetTouchRadiusY(native_event)), 456 radius_y_(GetTouchRadiusY(native_event)),
439 rotation_angle_(GetTouchAngle(native_event)), 457 rotation_angle_(GetTouchAngle(native_event)),
440 force_(GetTouchForce(native_event)) { 458 force_(GetTouchForce(native_event)) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 int GestureEvent::GetLowestTouchId() const { 767 int GestureEvent::GetLowestTouchId() const {
750 if (touch_ids_bitfield_ == 0) 768 if (touch_ids_bitfield_ == 0)
751 return -1; 769 return -1;
752 int i = -1; 770 int i = -1;
753 // Find the index of the least significant 1 bit 771 // Find the index of the least significant 1 bit
754 while (!(1 << ++i & touch_ids_bitfield_)); 772 while (!(1 << ++i & touch_ids_bitfield_));
755 return i; 773 return i;
756 } 774 }
757 775
758 } // namespace ui 776 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event.h ('k') | ui/views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698