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/events/event.h

Issue 2647253002: Add tangentialPressure and twist properties to PointerEvent on Windows (Closed)
Patch Set: rotation Created 3 years, 11 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
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/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_EVENTS_EVENT_H_ 5 #ifndef UI_EVENTS_EVENT_H_
6 #define UI_EVENTS_EVENT_H_ 6 #define UI_EVENTS_EVENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 public: 410 public:
411 PointerDetails() {} 411 PointerDetails() {}
412 explicit PointerDetails(EventPointerType pointer_type) 412 explicit PointerDetails(EventPointerType pointer_type)
413 : pointer_type(pointer_type), 413 : pointer_type(pointer_type),
414 force(std::numeric_limits<float>::quiet_NaN()) {} 414 force(std::numeric_limits<float>::quiet_NaN()) {}
415 PointerDetails(EventPointerType pointer_type, 415 PointerDetails(EventPointerType pointer_type,
416 float radius_x, 416 float radius_x,
417 float radius_y, 417 float radius_y,
418 float force, 418 float force,
419 float tilt_x, 419 float tilt_x,
420 float tilt_y) 420 float tilt_y,
421 float tangentialPressure,
sadrul 2017/01/26 02:24:08 tangential_pressure (everywhere else in this CL)
lanwei 2017/01/26 15:53:52 Done, thanks for catching this!
422 int twist)
sadrul 2017/01/26 02:24:08 Can these have default values now?
lanwei 2017/01/26 15:53:52 Done.
421 : pointer_type(pointer_type), 423 : pointer_type(pointer_type),
422 // If we aren't provided with a radius on one axis, use the 424 // If we aren't provided with a radius on one axis, use the
423 // information from the other axis. 425 // information from the other axis.
424 radius_x(radius_x > 0 ? radius_x : radius_y), 426 radius_x(radius_x > 0 ? radius_x : radius_y),
425 radius_y(radius_y > 0 ? radius_y : radius_x), 427 radius_y(radius_y > 0 ? radius_y : radius_x),
426 force(force), 428 force(force),
427 tilt_x(tilt_x), 429 tilt_x(tilt_x),
428 tilt_y(tilt_y) {} 430 tilt_y(tilt_y),
431 tangentialPressure(tangentialPressure),
432 twist(twist) {}
429 PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset) 433 PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset)
430 : pointer_type(pointer_type), 434 : pointer_type(pointer_type),
431 force(std::numeric_limits<float>::quiet_NaN()), 435 force(std::numeric_limits<float>::quiet_NaN()),
432 offset(offset) {} 436 offset(offset) {}
433 437
434 bool operator==(const PointerDetails& other) const { 438 bool operator==(const PointerDetails& other) const {
435 return pointer_type == other.pointer_type && radius_x == other.radius_x && 439 return pointer_type == other.pointer_type && radius_x == other.radius_x &&
436 radius_y == other.radius_y && 440 radius_y == other.radius_y &&
437 (force == other.force || 441 (force == other.force ||
438 (std::isnan(force) && std::isnan(other.force))) && 442 (std::isnan(force) && std::isnan(other.force))) &&
439 tilt_x == other.tilt_x && tilt_y == other.tilt_y && 443 tilt_x == other.tilt_x && tilt_y == other.tilt_y &&
440 offset == other.offset; 444 tangentialPressure == other.tangentialPressure &&
445 twist == other.twist && offset == other.offset;
441 } 446 }
442 447
443 // The type of pointer device. 448 // The type of pointer device.
444 EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN; 449 EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN;
445 450
446 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. 451 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
447 float radius_x = 0.0; 452 float radius_x = 0.0;
448 453
449 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 454 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
450 float radius_y = 0.0; 455 float radius_y = 0.0;
451 456
452 // Force (pressure) of the touch. Normalized to be [0, 1] except NaN means 457 // Force (pressure) of the touch. Normalized to be [0, 1] except NaN means
453 // pressure is not supported by the input device. 458 // pressure is not supported by the input device.
454 float force = 0.0; 459 float force = 0.0;
455 460
456 // Tilt of a pen/stylus from surface normal as plane angle in degrees, values 461 // Tilt of a pen/stylus from surface normal as plane angle in degrees, values
457 // lie in [-90,90]. A positive tilt_x is to the right and a positive tilt_y 462 // lie in [-90,90]. A positive tilt_x is to the right and a positive tilt_y
458 // is towards the user. 0.0 if unknown. 463 // is towards the user. 0.0 if unknown.
459 float tilt_x = 0.0; 464 float tilt_x = 0.0;
460 float tilt_y = 0.0; 465 float tilt_y = 0.0;
461 466
467 // The normalized tangential pressure (or barrel pressure), typically set by
468 // an additional control of the stylus, which has a range of [-1,1], where 0
469 // is the neutral position of the control. Always 0 if the device does not
470 // support it.
471 float tangentialPressure = 0.0;
sadrul 2017/01/26 02:24:08 tangential_pressure
472
473 // The clockwise rotation of a pen stylus around its own major axis, in
474 // degrees in the range [0,359]. Always 0 if the device does not support it.
475 int twist = 0;
476
462 // Only used by mouse wheel events. The amount to scroll. This is in multiples 477 // Only used by mouse wheel events. The amount to scroll. This is in multiples
463 // of kWheelDelta. 478 // of kWheelDelta.
464 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up. 479 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up.
465 gfx::Vector2d offset; 480 gfx::Vector2d offset;
466 }; 481 };
467 482
468 class EVENTS_EXPORT MouseEvent : public LocatedEvent { 483 class EVENTS_EXPORT MouseEvent : public LocatedEvent {
469 public: 484 public:
470 explicit MouseEvent(const base::NativeEvent& native_event); 485 explicit MouseEvent(const base::NativeEvent& native_event);
471 486
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 // dispatched. This field gets a non-zero value only for gestures that are 1053 // dispatched. This field gets a non-zero value only for gestures that are
1039 // released through TouchDispositionGestureFilter::SendGesture. The gesture 1054 // released through TouchDispositionGestureFilter::SendGesture. The gesture
1040 // events that aren't fired directly in response to processing a touch-event 1055 // events that aren't fired directly in response to processing a touch-event
1041 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. 1056 // (e.g. timer fired ones), this id is zero. See crbug.com/618738.
1042 uint32_t unique_touch_event_id_; 1057 uint32_t unique_touch_event_id_;
1043 }; 1058 };
1044 1059
1045 } // namespace ui 1060 } // namespace ui
1046 1061
1047 #endif // UI_EVENTS_EVENT_H_ 1062 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698