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

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

Issue 10828133: Desktop Aura: Allow tab drags out of window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better mouse tracking Created 8 years, 4 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
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 LocatedEvent::~LocatedEvent() { 92 LocatedEvent::~LocatedEvent() {
93 } 93 }
94 94
95 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) 95 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event)
96 : Event(native_event, 96 : Event(native_event,
97 EventTypeFromNative(native_event), 97 EventTypeFromNative(native_event),
98 EventFlagsFromNative(native_event)), 98 EventFlagsFromNative(native_event)),
99 location_(EventLocationFromNative(native_event)), 99 location_(EventLocationFromNative(native_event)),
100 root_location_(location_) { 100 root_location_(location_),
101 system_location_(ui::EventSystemLocationFromNative(native_event)) {
101 } 102 }
102 103
103 LocatedEvent::LocatedEvent(EventType type, 104 LocatedEvent::LocatedEvent(EventType type,
104 const gfx::Point& location, 105 const gfx::Point& location,
105 const gfx::Point& root_location, 106 const gfx::Point& root_location,
106 int flags) 107 int flags)
107 : Event(type, flags), 108 : Event(type, flags),
108 location_(location), 109 location_(location),
109 root_location_(root_location) { 110 root_location_(root_location),
111 system_location_(-1, -1) {
110 } 112 }
111 113
112 LocatedEvent::LocatedEvent(const LocatedEvent& model) 114 LocatedEvent::LocatedEvent(const LocatedEvent& model)
113 : Event(model), 115 : Event(model),
114 location_(model.location_), 116 location_(model.location_),
115 root_location_(model.root_location_) { 117 root_location_(model.root_location_),
118 system_location_(model.system_location_) {
116 } 119 }
117 120
118 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { 121 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) {
119 // Transform has to be done at root level. 122 // Transform has to be done at root level.
120 DCHECK_EQ(root_location_.x(), location_.x()); 123 DCHECK_EQ(root_location_.x(), location_.x());
121 DCHECK_EQ(root_location_.y(), location_.y()); 124 DCHECK_EQ(root_location_.y(), location_.y());
122 gfx::Point3f p(location_); 125 gfx::Point3f p(location_);
123 root_transform.TransformPointReverse(p); 126 root_transform.TransformPointReverse(p);
124 root_location_ = location_ = p.AsPoint(); 127 root_location_ = location_ = p.AsPoint();
125 } 128 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 TouchEvent::TouchEvent(const base::NativeEvent& native_event) 236 TouchEvent::TouchEvent(const base::NativeEvent& native_event)
234 : LocatedEvent(native_event), 237 : LocatedEvent(native_event),
235 touch_id_(ui::GetTouchId(native_event)), 238 touch_id_(ui::GetTouchId(native_event)),
236 radius_x_(GetTouchRadiusX(native_event)), 239 radius_x_(GetTouchRadiusX(native_event)),
237 radius_y_(GetTouchRadiusY(native_event)), 240 radius_y_(GetTouchRadiusY(native_event)),
238 rotation_angle_(GetTouchAngle(native_event)), 241 rotation_angle_(GetTouchAngle(native_event)),
239 force_(GetTouchForce(native_event)) { 242 force_(GetTouchForce(native_event)) {
240 } 243 }
241 244
242 TouchEvent::TouchEvent(EventType type, 245 TouchEvent::TouchEvent(EventType type,
243 const gfx::Point& location, 246 const gfx::Point& location,
244 int touch_id, 247 int touch_id,
245 base::TimeDelta time_stamp) 248 base::TimeDelta time_stamp)
246 : LocatedEvent(type, location, location, 0), 249 : LocatedEvent(type, location, location, 0),
247 touch_id_(touch_id), 250 touch_id_(touch_id),
248 radius_x_(0.0f), 251 radius_x_(0.0f),
249 radius_y_(0.0f), 252 radius_y_(0.0f),
250 rotation_angle_(0.0f), 253 rotation_angle_(0.0f),
251 force_(0.0f) { 254 force_(0.0f) {
252 set_time_stamp(time_stamp); 255 set_time_stamp(time_stamp);
253 } 256 }
254 257
255 TouchEvent::~TouchEvent() { 258 TouchEvent::~TouchEvent() {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 int GestureEvent::GetLowestTouchId() const { 401 int GestureEvent::GetLowestTouchId() const {
399 if (touch_ids_bitfield_ == 0) 402 if (touch_ids_bitfield_ == 0)
400 return -1; 403 return -1;
401 int i = -1; 404 int i = -1;
402 // Find the index of the least significant 1 bit 405 // Find the index of the least significant 1 bit
403 while (!(1 << ++i & touch_ids_bitfield_)); 406 while (!(1 << ++i & touch_ids_bitfield_));
404 return i; 407 return i;
405 } 408 }
406 409
407 } // namespace ui 410 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698