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

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

Issue 10175002: Fix scaling for aura::GestureEvent and aura::TouchEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed GestureEvent handling Created 8 years, 8 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 | ui/aura/event.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 #ifndef UI_AURA_EVENT_H_ 5 #ifndef UI_AURA_EVENT_H_
6 #define UI_AURA_EVENT_H_ 6 #define UI_AURA_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 LocatedEvent* located_event_; 105 LocatedEvent* located_event_;
106 }; 106 };
107 107
108 virtual ~LocatedEvent(); 108 virtual ~LocatedEvent();
109 109
110 int x() const { return location_.x(); } 110 int x() const { return location_.x(); }
111 int y() const { return location_.y(); } 111 int y() const { return location_.y(); }
112 gfx::Point location() const { return location_; } 112 gfx::Point location() const { return location_; }
113 gfx::Point root_location() const { return root_location_; } 113 gfx::Point root_location() const { return root_location_; }
114 114
115 // Applies the |root_transform| to both |location_| and |root_location_|. 115 // Applies |root_transform| to the event.
116 void UpdateForRootTransform(const ui::Transform& root_transform); 116 // This is applied to both |location_| and |root_location_|.
117 virtual void UpdateForRootTransform(const ui::Transform& root_transform);
117 118
118 protected: 119 protected:
119 explicit LocatedEvent(const base::NativeEvent& native_event); 120 explicit LocatedEvent(const base::NativeEvent& native_event);
120 121
121 // Create a new LocatedEvent which is identical to the provided model. 122 // Create a new LocatedEvent which is identical to the provided model.
122 // If source / target windows are provided, the model location will be 123 // If source / target windows are provided, the model location will be
123 // converted from |source| coordinate system to |target| coordinate system. 124 // converted from |source| coordinate system to |target| coordinate system.
124 LocatedEvent(const LocatedEvent& model, Window* source, Window* target); 125 LocatedEvent(const LocatedEvent& model, Window* source, Window* target);
125 126
126 // Used for synthetic events in testing. 127 // Used for synthetic events in testing.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 base::TimeDelta time_stamp); 198 base::TimeDelta time_stamp);
198 199
199 virtual ~TouchEvent(); 200 virtual ~TouchEvent();
200 201
201 int touch_id() const { return touch_id_; } 202 int touch_id() const { return touch_id_; }
202 float radius_x() const { return radius_x_; } 203 float radius_x() const { return radius_x_; }
203 float radius_y() const { return radius_y_; } 204 float radius_y() const { return radius_y_; }
204 float rotation_angle() const { return rotation_angle_; } 205 float rotation_angle() const { return rotation_angle_; }
205 float force() const { return force_; } 206 float force() const { return force_; }
206 207
208 // Overridden from LocatedEvent.
209 virtual void UpdateForRootTransform(
210 const ui::Transform& root_transform) OVERRIDE;
211
207 // Overridden from ui::TouchEvent. 212 // Overridden from ui::TouchEvent.
208 virtual ui::EventType GetEventType() const OVERRIDE; 213 virtual ui::EventType GetEventType() const OVERRIDE;
209 virtual gfx::Point GetLocation() const OVERRIDE; 214 virtual gfx::Point GetLocation() const OVERRIDE;
210 virtual int GetTouchId() const OVERRIDE; 215 virtual int GetTouchId() const OVERRIDE;
211 virtual int GetEventFlags() const OVERRIDE; 216 virtual int GetEventFlags() const OVERRIDE;
212 virtual base::TimeDelta GetTimestamp() const OVERRIDE; 217 virtual base::TimeDelta GetTimestamp() const OVERRIDE;
213 virtual TouchEvent* Copy() const OVERRIDE; 218 virtual TouchEvent* Copy() const OVERRIDE;
214 219
215 private: 220 private:
216 // The identity (typically finger) of the touch starting at 0 and incrementing 221 // The identity (typically finger) of the touch starting at 0 and incrementing
217 // for each separable additional touch that the hardware can detect. 222 // for each separable additional touch that the hardware can detect.
218 const int touch_id_; 223 const int touch_id_;
219 224
220 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. 225 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown.
221 const float radius_x_; 226 float radius_x_;
222 227
223 // Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown. 228 // Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown.
224 const float radius_y_; 229 float radius_y_;
225 230
226 // Angle of the major axis away from the X axis. Default 0.0. 231 // Angle of the major axis away from the X axis. Default 0.0.
227 const float rotation_angle_; 232 const float rotation_angle_;
228 233
229 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. 234 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
230 const float force_; 235 const float force_;
231 236
232 DISALLOW_COPY_AND_ASSIGN(TouchEvent); 237 DISALLOW_COPY_AND_ASSIGN(TouchEvent);
233 }; 238 };
234 239
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // This value is stored as a bitfield because the number of touch ids varies, 387 // This value is stored as a bitfield because the number of touch ids varies,
383 // but we currently don't need more than 32 touches at a time. 388 // but we currently don't need more than 32 touches at a time.
384 const unsigned int touch_ids_bitfield_; 389 const unsigned int touch_ids_bitfield_;
385 390
386 DISALLOW_COPY_AND_ASSIGN(GestureEvent); 391 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
387 }; 392 };
388 393
389 } // namespace aura 394 } // namespace aura
390 395
391 #endif // UI_AURA_EVENT_H_ 396 #endif // UI_AURA_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/aura/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698