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

Unified Diff: components/exo/touch.cc

Issue 2562803002: exo: Replace pointer based stylus and replace with touch based stylus (Closed)
Patch Set: updated deps in gn file Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/touch.h ('k') | components/exo/touch_stylus_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/touch.cc
diff --git a/components/exo/touch.cc b/components/exo/touch.cc
index 717b79ec6ba26e3de1fb264c7fb8daf9c187f67c..7d06d80aad6aa699b200b2192d892429ada5317b 100644
--- a/components/exo/touch.cc
+++ b/components/exo/touch.cc
@@ -6,6 +6,7 @@
#include "components/exo/surface.h"
#include "components/exo/touch_delegate.h"
+#include "components/exo/touch_stylus_delegate.h"
#include "components/exo/wm_helper.h"
#include "ui/aura/window.h"
#include "ui/events/event.h"
@@ -42,6 +43,14 @@ Touch::~Touch() {
WMHelper::GetInstance()->RemovePreTargetHandler(this);
}
+void Touch::SetStylusDelegate(TouchStylusDelegate* delegate) {
+ stylus_delegate_ = delegate;
+}
+
+bool Touch::HasStylusDelegate() const {
+ return !!stylus_delegate_;
+}
+
////////////////////////////////////////////////////////////////////////////////
// ui::EventHandler overrides:
@@ -76,6 +85,12 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
// be different from the target surface.
delegate_->OnTouchDown(focus_, event->time_stamp(), event->touch_id(),
location);
+ if (stylus_delegate_ &&
+ event->pointer_details().pointer_type !=
+ ui::EventPointerType::POINTER_TYPE_TOUCH) {
+ stylus_delegate_->OnTouchTool(event->touch_id(),
+ event->pointer_details().pointer_type);
+ }
send_details = true;
} break;
case ui::ET_TOUCH_RELEASED: {
@@ -130,6 +145,19 @@ void Touch::OnTouchEvent(ui::TouchEvent* event) {
delegate_->OnTouchShape(event->touch_id(),
event->pointer_details().radius_x,
event->pointer_details().radius_y);
+
+ if (stylus_delegate_ &&
+ event->pointer_details().pointer_type !=
+ ui::EventPointerType::POINTER_TYPE_TOUCH) {
+ if (!std::isnan(event->pointer_details().force)) {
+ stylus_delegate_->OnTouchForce(event->time_stamp(), event->touch_id(),
+ event->pointer_details().force);
+ }
+ stylus_delegate_->OnTouchTilt(
+ event->time_stamp(), event->touch_id(),
+ gfx::Vector2dF(event->pointer_details().tilt_x,
+ event->pointer_details().tilt_y));
+ }
}
// TODO(denniskempin): Extend ui::TouchEvent to signal end of sequence of
// touch events to send TouchFrame once after all touches have been updated.
« no previous file with comments | « components/exo/touch.h ('k') | components/exo/touch_stylus_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698