Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/exo/touch.h" | 5 #include "components/exo/touch.h" |
| 6 | 6 |
| 7 #include "components/exo/surface.h" | 7 #include "components/exo/surface.h" |
| 8 #include "components/exo/touch_delegate.h" | 8 #include "components/exo/touch_delegate.h" |
| 9 #include "components/exo/wm_helper.h" | 9 #include "components/exo/wm_helper.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 focus_->RemoveSurfaceObserver(this); | 111 focus_->RemoveSurfaceObserver(this); |
| 112 focus_ = nullptr; | 112 focus_ = nullptr; |
| 113 | 113 |
| 114 // Cancel the full set of touch sequences as soon as one is canceled. | 114 // Cancel the full set of touch sequences as soon as one is canceled. |
| 115 touch_points_.clear(); | 115 touch_points_.clear(); |
| 116 delegate_->OnTouchCancel(); | 116 delegate_->OnTouchCancel(); |
| 117 } | 117 } |
| 118 } break; | 118 } break; |
| 119 default: | 119 default: |
| 120 NOTREACHED(); | 120 NOTREACHED(); |
| 121 break; | 121 return; |
| 122 } | 122 } |
| 123 if (event->type() == ui::ET_TOUCH_PRESSED || | |
| 124 event->type() == ui::ET_TOUCH_MOVED) { | |
| 125 delegate_->OnTouchShape(event->touch_id(), | |
|
reveman
2016/12/08 01:40:45
Can you move this up into the switch cases above i
| |
| 126 event->pointer_details().radius_x, | |
| 127 event->pointer_details().radius_y); | |
| 128 } | |
| 129 // todo(denniskempin): Extend ui::TouchEvent to signal end of sequence of | |
|
reveman
2016/12/08 01:40:45
s/todo/TODO/
| |
| 130 // touch events to send TouchFrame once after all touches have been updated. | |
| 131 delegate_->OnTouchFrame(); | |
|
reveman
2016/12/08 01:40:45
Move this up into the switch cases as well to avoi
| |
| 123 } | 132 } |
| 124 | 133 |
| 125 //////////////////////////////////////////////////////////////////////////////// | 134 //////////////////////////////////////////////////////////////////////////////// |
| 126 // SurfaceObserver overrides: | 135 // SurfaceObserver overrides: |
| 127 | 136 |
| 128 void Touch::OnSurfaceDestroying(Surface* surface) { | 137 void Touch::OnSurfaceDestroying(Surface* surface) { |
| 129 DCHECK(surface == focus_); | 138 DCHECK(surface == focus_); |
| 130 focus_ = nullptr; | 139 focus_ = nullptr; |
| 131 surface->RemoveSurfaceObserver(this); | 140 surface->RemoveSurfaceObserver(this); |
| 132 | 141 |
| 133 // Cancel touch sequences. | 142 // Cancel touch sequences. |
| 134 DCHECK_NE(touch_points_.size(), 0u); | 143 DCHECK_NE(touch_points_.size(), 0u); |
| 135 touch_points_.clear(); | 144 touch_points_.clear(); |
| 136 delegate_->OnTouchCancel(); | 145 delegate_->OnTouchCancel(); |
| 137 } | 146 } |
| 138 | 147 |
| 139 //////////////////////////////////////////////////////////////////////////////// | 148 //////////////////////////////////////////////////////////////////////////////// |
| 140 // Touch, private: | 149 // Touch, private: |
| 141 | 150 |
| 142 Surface* Touch::GetEffectiveTargetForEvent(ui::Event* event) const { | 151 Surface* Touch::GetEffectiveTargetForEvent(ui::Event* event) const { |
| 143 Surface* target = | 152 Surface* target = |
| 144 Surface::AsSurface(static_cast<aura::Window*>(event->target())); | 153 Surface::AsSurface(static_cast<aura::Window*>(event->target())); |
| 145 if (!target) | 154 if (!target) |
| 146 return nullptr; | 155 return nullptr; |
| 147 | 156 |
| 148 return delegate_->CanAcceptTouchEventsForSurface(target) ? target : nullptr; | 157 return delegate_->CanAcceptTouchEventsForSurface(target) ? target : nullptr; |
| 149 } | 158 } |
| 150 | 159 |
| 151 } // namespace exo | 160 } // namespace exo |
| OLD | NEW |