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

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

Issue 12087124: Disable touch calibration on external touchscreen. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Win compilation take 2 + rebase Created 7 years, 10 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 #ifndef UI_BASE_EVENTS_EVENT_H_ 5 #ifndef UI_BASE_EVENTS_EVENT_H_
6 #define UI_BASE_EVENTS_EVENT_H_ 6 #define UI_BASE_EVENTS_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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/singleton.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "ui/base/dragdrop/os_exchange_data.h" 14 #include "ui/base/dragdrop/os_exchange_data.h"
14 #include "ui/base/events/event_constants.h" 15 #include "ui/base/events/event_constants.h"
15 #include "ui/base/gestures/gesture_types.h" 16 #include "ui/base/gestures/gesture_types.h"
16 #include "ui/base/keycodes/keyboard_codes.h" 17 #include "ui/base/keycodes/keyboard_codes.h"
17 #include "ui/base/ui_export.h" 18 #include "ui/base/ui_export.h"
18 #include "ui/gfx/point.h" 19 #include "ui/gfx/point.h"
19 20
20 namespace gfx { 21 namespace gfx {
21 class Transform; 22 class Transform;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // The amount to scroll. This is in multiples of kWheelDelta. 432 // The amount to scroll. This is in multiples of kWheelDelta.
432 // Note: offset() > 0 means scroll up / left. 433 // Note: offset() > 0 means scroll up / left.
433 int offset() const { return offset_; } 434 int offset() const { return offset_; }
434 435
435 private: 436 private:
436 int offset_; 437 int offset_;
437 438
438 DISALLOW_COPY_AND_ASSIGN(MouseWheelEvent); 439 DISALLOW_COPY_AND_ASSIGN(MouseWheelEvent);
439 }; 440 };
440 441
442 #if defined(USE_XI2_MT)
443 class TouchCoordinatesCalibrator {
sadrul 2013/02/04 19:10:22 Add doc
ynovikov 2013/03/13 23:34:21 Done.
444 public:
445 static TouchCoordinatesCalibrator* GetInstance();
446 void Calibrate(TouchEvent& event, const gfx::Rect& bounds);
sadrul 2013/02/04 19:10:22 You should either use a const ref, or a pointer.
ynovikov 2013/03/13 23:34:21 Done.
447 private:
448 TouchCoordinatesCalibrator();
449 friend struct DefaultSingletonTraits<TouchCoordinatesCalibrator>;
450
451 // The (positive) calibration values for the four border sides.
452 int left_border_touch_calibration;
sadrul 2013/02/04 19:10:22 You can probably just call these left_, right_, to
ynovikov 2013/03/13 23:34:21 Done.
453 int right_border_touch_calibration;
454 int top_border_touch_calibration;
455 int bottom_border_touch_calibration;
456
457 DISALLOW_COPY_AND_ASSIGN(TouchCoordinatesCalibrator);
458 };
459 #endif
460
441 class UI_EXPORT TouchEvent : public LocatedEvent { 461 class UI_EXPORT TouchEvent : public LocatedEvent {
442 public: 462 public:
443 explicit TouchEvent(const base::NativeEvent& native_event); 463 explicit TouchEvent(const base::NativeEvent& native_event);
444 464
445 // Create a new TouchEvent which is identical to the provided model. 465 // Create a new TouchEvent which is identical to the provided model.
446 // If source / target windows are provided, the model location will be 466 // If source / target windows are provided, the model location will be
447 // converted from |source| coordinate system to |target| coordinate system. 467 // converted from |source| coordinate system to |target| coordinate system.
448 template <class T> 468 template <class T>
449 TouchEvent(const TouchEvent& model, T* source, T* target) 469 TouchEvent(const TouchEvent& model, T* source, T* target)
450 : LocatedEvent(model, source, target), 470 : LocatedEvent(model, source, target),
(...skipping 25 matching lines...) Expand all
476 float radius_x() const { return radius_x_; } 496 float radius_x() const { return radius_x_; }
477 float radius_y() const { return radius_y_; } 497 float radius_y() const { return radius_y_; }
478 float rotation_angle() const { return rotation_angle_; } 498 float rotation_angle() const { return rotation_angle_; }
479 float force() const { return force_; } 499 float force() const { return force_; }
480 500
481 // Relocate the touch-point to a new |origin|. 501 // Relocate the touch-point to a new |origin|.
482 // This is useful when touch event is in X Root Window coordinates, 502 // This is useful when touch event is in X Root Window coordinates,
483 // and it needs to be mapped into Aura Root Window coordinates. 503 // and it needs to be mapped into Aura Root Window coordinates.
484 void Relocate(const gfx::Point& origin); 504 void Relocate(const gfx::Point& origin);
485 505
506 #if defined(USE_XI2_MT)
507 void Calibrate(const gfx::Rect& bounds);
508 #endif
509
486 // Used for unit tests. 510 // Used for unit tests.
487 void set_radius_x(const float r) { radius_x_ = r; } 511 void set_radius_x(const float r) { radius_x_ = r; }
488 void set_radius_y(const float r) { radius_y_ = r; } 512 void set_radius_y(const float r) { radius_y_ = r; }
489 513
490 // Overridden from LocatedEvent. 514 // Overridden from LocatedEvent.
491 virtual void UpdateForRootTransform( 515 virtual void UpdateForRootTransform(
492 const gfx::Transform& root_transform) OVERRIDE; 516 const gfx::Transform& root_transform) OVERRIDE;
493 517
494 protected: 518 protected:
495 void set_radius(float radius_x, float radius_y) { 519 void set_radius(float radius_x, float radius_y) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // This value is stored as a bitfield because the number of touch ids varies, 709 // This value is stored as a bitfield because the number of touch ids varies,
686 // but we currently don't need more than 32 touches at a time. 710 // but we currently don't need more than 32 touches at a time.
687 const unsigned int touch_ids_bitfield_; 711 const unsigned int touch_ids_bitfield_;
688 712
689 DISALLOW_COPY_AND_ASSIGN(GestureEvent); 713 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
690 }; 714 };
691 715
692 } // namespace ui 716 } // namespace ui
693 717
694 #endif // UI_BASE_EVENTS_EVENT_H_ 718 #endif // UI_BASE_EVENTS_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698