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

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

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 #ifndef UI_BASE_EVENT_H_ 5 #ifndef UI_BASE_EVENT_H_
6 #define UI_BASE_EVENT_H_ 6 #define UI_BASE_EVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/event_types.h" 10 #include "base/event_types.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 LocatedEvent* located_event_; 138 LocatedEvent* located_event_;
139 }; 139 };
140 140
141 virtual ~LocatedEvent(); 141 virtual ~LocatedEvent();
142 142
143 int x() const { return location_.x(); } 143 int x() const { return location_.x(); }
144 int y() const { return location_.y(); } 144 int y() const { return location_.y(); }
145 gfx::Point location() const { return location_; } 145 gfx::Point location() const { return location_; }
146 gfx::Point root_location() const { return root_location_; } 146 gfx::Point root_location() const { return root_location_; }
147 147
148 bool valid_system_location() const {
149 return system_location_ != gfx::Point(-1, -1);
150 }
151 void set_system_location(const gfx::Point& loc) { system_location_ = loc; }
152 gfx::Point system_location() const { return system_location_; }
153
154
148 // Applies |root_transform| to the event. 155 // Applies |root_transform| to the event.
149 // This is applied to both |location_| and |root_location_|. 156 // This is applied to both |location_| and |root_location_|.
150 virtual void UpdateForRootTransform(const Transform& root_transform); 157 virtual void UpdateForRootTransform(const Transform& root_transform);
151 158
152 protected: 159 protected:
153 explicit LocatedEvent(const base::NativeEvent& native_event); 160 explicit LocatedEvent(const base::NativeEvent& native_event);
154 161
155 // Create a new LocatedEvent which is identical to the provided model. 162 // Create a new LocatedEvent which is identical to the provided model.
156 // If source / target windows are provided, the model location will be 163 // If source / target windows are provided, the model location will be
157 // converted from |source| coordinate system to |target| coordinate system. 164 // converted from |source| coordinate system to |target| coordinate system.
158 template <class T> 165 template <class T>
159 LocatedEvent(const LocatedEvent& model, T* source, T* target) 166 LocatedEvent(const LocatedEvent& model, T* source, T* target)
160 : Event(model), 167 : Event(model),
161 location_(model.location_), 168 location_(model.location_),
162 root_location_(model.root_location_) { 169 root_location_(model.root_location_),
170 system_location_(model.system_location_) {
171 // TODO(erg): May need to create system_location_ by converting location to
172 // system coordinates here.
163 if (target && target != source) 173 if (target && target != source)
164 T::ConvertPointToTarget(source, target, &location_); 174 T::ConvertPointToTarget(source, target, &location_);
165 } 175 }
166 176
167 // Used for synthetic events in testing. 177 // Used for synthetic events in testing.
168 LocatedEvent(EventType type, 178 LocatedEvent(EventType type,
169 const gfx::Point& location, 179 const gfx::Point& location,
170 const gfx::Point& root_location, 180 const gfx::Point& root_location,
171 int flags); 181 int flags);
172 182
173 LocatedEvent(const LocatedEvent& model); 183 LocatedEvent(const LocatedEvent& model);
174 184
175 gfx::Point location_; 185 gfx::Point location_;
176 186
177 gfx::Point root_location_; 187 gfx::Point root_location_;
188
189 gfx::Point system_location_;
Daniel Erat 2012/08/15 20:30:57 Add a comment describing what "system" means here.
Elliot Glaysher 2012/08/15 20:55:59 Commented. "Root location" in aura and "root locat
178 }; 190 };
179 191
180 class UI_EXPORT MouseEvent : public LocatedEvent { 192 class UI_EXPORT MouseEvent : public LocatedEvent {
181 public: 193 public:
182 explicit MouseEvent(const base::NativeEvent& native_event); 194 explicit MouseEvent(const base::NativeEvent& native_event);
183 195
184 // Create a new MouseEvent based on the provided model. 196 // Create a new MouseEvent based on the provided model.
185 // Uses the provided |type| and |flags| for the new event. 197 // Uses the provided |type| and |flags| for the new event.
186 // If source / target windows are provided, the model location will be 198 // If source / target windows are provided, the model location will be
187 // converted from |source| coordinate system to |target| coordinate system. 199 // converted from |source| coordinate system to |target| coordinate system.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // This value is stored as a bitfield because the number of touch ids varies, 500 // This value is stored as a bitfield because the number of touch ids varies,
489 // but we currently don't need more than 32 touches at a time. 501 // but we currently don't need more than 32 touches at a time.
490 const unsigned int touch_ids_bitfield_; 502 const unsigned int touch_ids_bitfield_;
491 503
492 DISALLOW_COPY_AND_ASSIGN(GestureEvent); 504 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
493 }; 505 };
494 506
495 } // namespace ui 507 } // namespace ui
496 508
497 #endif // UI_BASE_EVENT_H_ 509 #endif // UI_BASE_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698