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

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

Issue 10134045: Getting RenderWidgetHostViewWin ready for a GestureRecognizer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed const ref's. Created 8 years, 7 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
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/views/events/event.h" 5 #include "ui/views/events/event.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/keycodes/keyboard_code_conversion.h" 8 #include "ui/base/keycodes/keyboard_code_conversion.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 #include "ui/views/widget/root_view.h" 10 #include "ui/views/widget/root_view.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // This value matches windows WHEEL_DELTA. 190 // This value matches windows WHEEL_DELTA.
191 // static 191 // static
192 const int MouseWheelEvent::kWheelDelta = 120; 192 const int MouseWheelEvent::kWheelDelta = 120;
193 #else 193 #else
194 // This value matches GTK+ wheel scroll amount. 194 // This value matches GTK+ wheel scroll amount.
195 const int MouseWheelEvent::kWheelDelta = 53; 195 const int MouseWheelEvent::kWheelDelta = 53;
196 #endif 196 #endif
197 197
198 //////////////////////////////////////////////////////////////////////////////// 198 ////////////////////////////////////////////////////////////////////////////////
199 // GestureEvent, public: 199 // GestureEvent, public:
200 GestureEvent::GestureEvent(ui::EventType type,
201 int x,
202 int y,
203 int flags,
204 const base::Time& time_stamp,
205 float delta_x,
206 float delta_y,
207 unsigned int touch_ids_bitfield)
208 : LocatedEvent(type, gfx::Point(x, y), flags),
209 delta_x_(delta_x),
210 delta_y_(delta_y),
211 touch_ids_bitfield_(touch_ids_bitfield) {
212 set_time_stamp(time_stamp);
213 }
200 214
201 GestureEvent::GestureEvent(const GestureEvent& model, View* source, 215 GestureEvent::GestureEvent(const GestureEvent& model, View* source,
202 View* target) 216 View* target)
203 : LocatedEvent(model, source, target), 217 : LocatedEvent(model, source, target),
204 delta_x_(model.delta_x_), 218 delta_x_(model.delta_x_),
205 delta_y_(model.delta_y_) { 219 delta_y_(model.delta_y_),
220 touch_ids_bitfield_(model.touch_ids_bitfield_) {
206 } 221 }
207 222
208 //////////////////////////////////////////////////////////////////////////////// 223 ////////////////////////////////////////////////////////////////////////////////
209 // GestureEvent, private: 224 // GestureEvent, private:
210 225
211 GestureEvent::GestureEvent(const GestureEvent& model, View* root) 226 GestureEvent::GestureEvent(const GestureEvent& model, View* root)
212 : LocatedEvent(model, root), 227 : LocatedEvent(model, root),
213 delta_x_(model.delta_x_), 228 delta_x_(model.delta_x_),
214 delta_y_(model.delta_y_) { 229 delta_y_(model.delta_y_),
230 touch_ids_bitfield_(0) {
215 } 231 }
216 232
217 GestureEvent::GestureEvent(ui::EventType type, int x, int y, int flags) 233 GestureEvent::GestureEvent(ui::EventType type, int x, int y, int flags)
218 : LocatedEvent(type, gfx::Point(x, y), flags), 234 : LocatedEvent(type, gfx::Point(x, y), flags),
219 delta_x_(0), 235 delta_x_(0),
220 delta_y_(0) { 236 delta_y_(0),
237 touch_ids_bitfield_(0) {
221 } 238 }
222 239
223 GestureEvent::~GestureEvent() { 240 GestureEvent::~GestureEvent() {
224 } 241 }
225 242
226 #if !defined(USE_AURA)
227 int GestureEvent::GetLowestTouchId() const { 243 int GestureEvent::GetLowestTouchId() const {
228 // TODO: 244 if (touch_ids_bitfield_ == 0)
229 return 0; 245 return -1;
246 int i = -1;
247 // Find the index of the least significant 1 bit
248 while (!((1 << ++i) & touch_ids_bitfield_));
249 return i;
230 } 250 }
231 #endif
232 251
233 GestureEventForTest::GestureEventForTest(ui::EventType type, 252 GestureEventForTest::GestureEventForTest(ui::EventType type,
234 int x, 253 int x,
235 int y, 254 int y,
236 int flags) 255 int flags)
237 : GestureEvent(type, x, y, flags) { 256 : GestureEvent(type, x, y, flags) {
238 } 257 }
239 258
240 } // namespace views 259 } // namespace views
OLDNEW
« content/browser/renderer_host/render_widget_host_view_win.cc ('K') | « ui/views/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698