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

Unified Diff: components/exo/pointer.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/pointer.h ('k') | components/exo/pointer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/pointer.cc
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc
index 0e5e9d1bfff77c2d5c0ffbb2e7bcbe7b4ef0886b..b10d0186d798e64a6b47f7ca69e1dd9fe5b95bac 100644
--- a/components/exo/pointer.cc
+++ b/components/exo/pointer.cc
@@ -51,8 +51,6 @@ Pointer::Pointer(PointerDelegate* delegate)
Pointer::~Pointer() {
delegate_->OnPointerDestroying(this);
- if (stylus_delegate_)
- stylus_delegate_->OnPointerDestroying(this);
if (surface_)
surface_->RemoveSurfaceObserver(this);
if (focus_) {
@@ -106,7 +104,7 @@ void Pointer::SetCursor(Surface* surface, const gfx::Point& hotspot) {
surface_->window()->Show();
// Show widget now that cursor has been defined.
- if (!widget_->IsVisible() && !is_direct_input_)
+ if (!widget_->IsVisible())
widget_->Show();
}
@@ -123,14 +121,6 @@ void Pointer::SetCursor(Surface* surface, const gfx::Point& hotspot) {
focus_->window()->GetCursor(gfx::ToFlooredPoint(location_)));
}
-bool Pointer::HasStylusDelegate() const {
- return !!stylus_delegate_;
-}
-
-void Pointer::SetStylusDelegate(PointerStylusDelegate* delegate) {
- stylus_delegate_ = delegate;
-}
-
////////////////////////////////////////////////////////////////////////////////
// ui::EventHandler overrides:
@@ -140,13 +130,6 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
if (event->flags() & ui::EF_TOUCH_ACCESSIBILITY)
return;
- auto new_pointer_type = pointer_type_;
- if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0) {
- new_pointer_type = event->pointer_details().pointer_type;
- if (new_pointer_type == ui::EventPointerType::POINTER_TYPE_UNKNOWN)
- new_pointer_type = ui::EventPointerType::POINTER_TYPE_MOUSE;
- }
-
// If target is different than the current pointer focus then we need to
// generate enter and leave events.
if (target != focus_) {
@@ -164,26 +147,13 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
delegate_->OnPointerEnter(target, event->location_f(),
event->button_flags());
location_ = event->location_f();
- if (stylus_delegate_) {
- stylus_delegate_->OnPointerToolChange(new_pointer_type);
- pointer_type_ = new_pointer_type;
- }
-
focus_ = target;
focus_->AddSurfaceObserver(this);
}
delegate_->OnPointerFrame();
}
- // Report changes in pointer type.
- if (focus_ && stylus_delegate_ && new_pointer_type != pointer_type_) {
- stylus_delegate_->OnPointerToolChange(new_pointer_type);
- pointer_type_ = new_pointer_type;
- }
-
if (focus_ && event->IsMouseEvent() && event->type() != ui::ET_MOUSE_EXITED) {
- bool send_frame = false;
-
// Generate motion event if location changed. We need to check location
// here as mouse movement can generate both "moved" and "entered" events
// but OnPointerMotion should only be called if location changed since
@@ -191,29 +161,8 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
if (!SameLocation(event, location_)) {
location_ = event->location_f();
delegate_->OnPointerMotion(event->time_stamp(), location_);
- send_frame = true;
- }
- if (stylus_delegate_ &&
- pointer_type_ != ui::EventPointerType::POINTER_TYPE_MOUSE) {
- constexpr float kEpsilon = std::numeric_limits<float>::epsilon();
- gfx::Vector2dF new_tilt = gfx::Vector2dF(event->pointer_details().tilt_x,
- event->pointer_details().tilt_y);
- if (std::abs(new_tilt.x() - tilt_.x()) > kEpsilon ||
- std::abs(new_tilt.y() - tilt_.y()) > kEpsilon) {
- tilt_ = new_tilt;
- stylus_delegate_->OnPointerTilt(event->time_stamp(), new_tilt);
- send_frame = true;
- }
-
- float new_force = event->pointer_details().force;
- if (std::abs(new_force - force_) > kEpsilon) {
- force_ = new_force;
- stylus_delegate_->OnPointerForce(event->time_stamp(), new_force);
- send_frame = true;
- }
- }
- if (send_frame)
delegate_->OnPointerFrame();
+ }
}
switch (event->type()) {
@@ -267,11 +216,8 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
break;
}
- if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0)
- is_direct_input_ = (event->flags() & ui::EF_DIRECT_INPUT) != 0;
-
// Update cursor widget to reflect current focus and pointer location.
- if (focus_ && !is_direct_input_) {
+ if (focus_) {
if (!widget_)
CreatePointerWidget();
« no previous file with comments | « components/exo/pointer.h ('k') | components/exo/pointer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698