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

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

Issue 10868096: aura: Fix propagating wheel events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 8 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/event.h ('k') | ui/views/widget/native_widget_aura.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/event.h" 5 #include "ui/base/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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const gfx::Point& location, 115 const gfx::Point& location,
116 const gfx::Point& root_location, 116 const gfx::Point& root_location,
117 int flags) 117 int flags)
118 : Event(type, flags), 118 : Event(type, flags),
119 location_(location), 119 location_(location),
120 root_location_(root_location), 120 root_location_(root_location),
121 valid_system_location_(false), 121 valid_system_location_(false),
122 system_location_(0, 0) { 122 system_location_(0, 0) {
123 } 123 }
124 124
125 LocatedEvent::LocatedEvent(const LocatedEvent& model)
126 : Event(model),
127 location_(model.location_),
128 root_location_(model.root_location_),
129 valid_system_location_(model.valid_system_location_),
130 system_location_(model.system_location_) {
131 }
132
133 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { 125 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) {
134 // Transform has to be done at root level. 126 // Transform has to be done at root level.
135 DCHECK_EQ(root_location_.x(), location_.x()); 127 DCHECK_EQ(root_location_.x(), location_.x());
136 DCHECK_EQ(root_location_.y(), location_.y()); 128 DCHECK_EQ(root_location_.y(), location_.y());
137 gfx::Point3f p(location_); 129 gfx::Point3f p(location_);
138 root_transform.TransformPointReverse(p); 130 root_transform.TransformPointReverse(p);
139 root_location_ = location_ = p.AsPoint(); 131 root_location_ = location_ = p.AsPoint();
140 } 132 }
141 133
142 //////////////////////////////////////////////////////////////////////////////// 134 ////////////////////////////////////////////////////////////////////////////////
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 f &= ~EF_IS_TRIPLE_CLICK; 230 f &= ~EF_IS_TRIPLE_CLICK;
239 break; 231 break;
240 case 3: 232 case 3:
241 f &= ~EF_IS_DOUBLE_CLICK; 233 f &= ~EF_IS_DOUBLE_CLICK;
242 f |= EF_IS_TRIPLE_CLICK; 234 f |= EF_IS_TRIPLE_CLICK;
243 break; 235 break;
244 } 236 }
245 set_flags(f); 237 set_flags(f);
246 } 238 }
247 239
248 MouseEvent::MouseEvent(const MouseEvent& model) : LocatedEvent(model) {
249 }
250
251 //////////////////////////////////////////////////////////////////////////////// 240 ////////////////////////////////////////////////////////////////////////////////
252 // MouseWheelEvent 241 // MouseWheelEvent
253 242
254 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event) 243 MouseWheelEvent::MouseWheelEvent(const base::NativeEvent& native_event)
255 : MouseEvent(native_event), 244 : MouseEvent(native_event),
256 offset_(GetMouseWheelOffset(native_event)) { 245 offset_(GetMouseWheelOffset(native_event)) {
257 } 246 }
258 247
259 MouseWheelEvent::MouseWheelEvent(const MouseEvent& mouse_event)
260 : MouseEvent(mouse_event),
261 offset_(GetMouseWheelOffset(mouse_event.native_event())) {
262 }
263
264 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event) 248 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event)
265 : MouseEvent(scroll_event), 249 : MouseEvent(scroll_event),
266 offset_(scroll_event.y_offset()) { 250 offset_(scroll_event.y_offset()) {
267 set_type(ET_MOUSEWHEEL); 251 set_type(ET_MOUSEWHEEL);
268 } 252 }
269 253
270 #if defined(OS_WIN) 254 #if defined(OS_WIN)
271 // This value matches windows WHEEL_DELTA. 255 // This value matches windows WHEEL_DELTA.
272 // static 256 // static
273 const int MouseWheelEvent::kWheelDelta = 120; 257 const int MouseWheelEvent::kWheelDelta = 120;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 int GestureEvent::GetLowestTouchId() const { 489 int GestureEvent::GetLowestTouchId() const {
506 if (touch_ids_bitfield_ == 0) 490 if (touch_ids_bitfield_ == 0)
507 return -1; 491 return -1;
508 int i = -1; 492 int i = -1;
509 // Find the index of the least significant 1 bit 493 // Find the index of the least significant 1 bit
510 while (!(1 << ++i & touch_ids_bitfield_)); 494 while (!(1 << ++i & touch_ids_bitfield_));
511 return i; 495 return i;
512 } 496 }
513 497
514 } // namespace ui 498 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/event.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698