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

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

Issue 2647253002: Add tangentialPressure and twist properties to PointerEvent on Windows (Closed)
Patch Set: 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
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 }; 405 };
406 406
407 // Structure for handling common fields between touch and mouse to support 407 // Structure for handling common fields between touch and mouse to support
408 // PointerEvents API. 408 // PointerEvents API.
409 struct EVENTS_EXPORT PointerDetails { 409 struct EVENTS_EXPORT PointerDetails {
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,
mustaq 2017/01/23 20:23:56 Please update this method and events_win.cc to pas
lanwei 2017/01/25 15:53:51 Done.
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 : pointer_type(pointer_type), 421 : pointer_type(pointer_type),
422 // If we aren't provided with a radius on one axis, use the 422 // If we aren't provided with a radius on one axis, use the
423 // information from the other axis. 423 // information from the other axis.
424 radius_x(radius_x > 0 ? radius_x : radius_y), 424 radius_x(radius_x > 0 ? radius_x : radius_y),
425 radius_y(radius_y > 0 ? radius_y : radius_x), 425 radius_y(radius_y > 0 ? radius_y : radius_x),
426 force(force), 426 force(force),
427 tilt_x(tilt_x), 427 tilt_x(tilt_x),
428 tilt_y(tilt_y) {} 428 tilt_y(tilt_y) {}
429 PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset) 429 PointerDetails(EventPointerType pointer_type, const gfx::Vector2d& offset)
430 : pointer_type(pointer_type), 430 : pointer_type(pointer_type),
431 force(std::numeric_limits<float>::quiet_NaN()), 431 force(std::numeric_limits<float>::quiet_NaN()),
432 offset(offset) {} 432 offset(offset) {}
433 433
434 bool operator==(const PointerDetails& other) const { 434 bool operator==(const PointerDetails& other) const {
435 return pointer_type == other.pointer_type && radius_x == other.radius_x && 435 return pointer_type == other.pointer_type && radius_x == other.radius_x &&
436 radius_y == other.radius_y && 436 radius_y == other.radius_y &&
437 (force == other.force || 437 (force == other.force ||
438 (std::isnan(force) && std::isnan(other.force))) && 438 (std::isnan(force) && std::isnan(other.force))) &&
439 tilt_x == other.tilt_x && tilt_y == other.tilt_y && 439 tilt_x == other.tilt_x && tilt_y == other.tilt_y &&
440 tangentialPressure == other.tangentialPressure &&
441 twist == other.twist &&
440 offset == other.offset; 442 offset == other.offset;
441 } 443 }
442 444
443 // The type of pointer device. 445 // The type of pointer device.
444 EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN; 446 EventPointerType pointer_type = EventPointerType::POINTER_TYPE_UNKNOWN;
445 447
446 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. 448 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
447 float radius_x = 0.0; 449 float radius_x = 0.0;
448 450
449 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 451 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
450 float radius_y = 0.0; 452 float radius_y = 0.0;
451 453
452 // Force (pressure) of the touch. Normalized to be [0, 1] except NaN means 454 // Force (pressure) of the touch. Normalized to be [0, 1] except NaN means
453 // pressure is not supported by the input device. 455 // pressure is not supported by the input device.
454 float force = 0.0; 456 float force = 0.0;
455 457
456 // Tilt of a pen/stylus from surface normal as plane angle in degrees, values 458 // 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 459 // 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. 460 // is towards the user. 0.0 if unknown.
459 float tilt_x = 0.0; 461 float tilt_x = 0.0;
460 float tilt_y = 0.0; 462 float tilt_y = 0.0;
461 463
464 // The normalized tangential pressure (or barrel pressure), typically set by
465 // an additional control of the stylus, which has a range of [-1,1], where 0
466 // is the neutral position of the control. Always 0 if the device does not
467 // support it.
468 float tangentialPressure = 0.0;
469
470 // The clockwise rotation of a pen stylus around its own major axis, in
471 // degrees in the range [0,359]. Always 0 if the device does not support it.
472 int twist = 0;
473
462 // Only used by mouse wheel events. The amount to scroll. This is in multiples 474 // Only used by mouse wheel events. The amount to scroll. This is in multiples
463 // of kWheelDelta. 475 // of kWheelDelta.
464 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up. 476 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up.
465 gfx::Vector2d offset; 477 gfx::Vector2d offset;
466 }; 478 };
467 479
468 class EVENTS_EXPORT MouseEvent : public LocatedEvent { 480 class EVENTS_EXPORT MouseEvent : public LocatedEvent {
469 public: 481 public:
470 explicit MouseEvent(const base::NativeEvent& native_event); 482 explicit MouseEvent(const base::NativeEvent& native_event);
471 483
(...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 1050 // dispatched. This field gets a non-zero value only for gestures that are
1039 // released through TouchDispositionGestureFilter::SendGesture. The gesture 1051 // released through TouchDispositionGestureFilter::SendGesture. The gesture
1040 // events that aren't fired directly in response to processing a touch-event 1052 // 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. 1053 // (e.g. timer fired ones), this id is zero. See crbug.com/618738.
1042 uint32_t unique_touch_event_id_; 1054 uint32_t unique_touch_event_id_;
1043 }; 1055 };
1044 1056
1045 } // namespace ui 1057 } // namespace ui
1046 1058
1047 #endif // UI_EVENTS_EVENT_H_ 1059 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« ui/events/blink/web_input_event.cc ('K') | « ui/events/blink/web_input_event_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698