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/pointer.h" | 5 #include "components/exo/pointer.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
| 10 #include "components/exo/pointer_delegate.h" | 10 #include "components/exo/pointer_delegate.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 case ui::ET_MOUSEWHEEL: { | 202 case ui::ET_MOUSEWHEEL: { |
| 203 delegate_->OnPointerScroll( | 203 delegate_->OnPointerScroll( |
| 204 event->time_stamp(), | 204 event->time_stamp(), |
| 205 static_cast<ui::MouseWheelEvent*>(event)->offset(), true); | 205 static_cast<ui::MouseWheelEvent*>(event)->offset(), true); |
| 206 delegate_->OnPointerFrame(); | 206 delegate_->OnPointerFrame(); |
| 207 break; | 207 break; |
| 208 } | 208 } |
| 209 case ui::ET_SCROLL_FLING_START: { | 209 case ui::ET_SCROLL_FLING_START: { |
| 210 // Fling start in chrome signals the lifting of fingers after scrolling. | |
| 211 // In wayland terms this signals the end of a scroll sequence. | |
| 210 delegate_->OnPointerScrollStop(event->time_stamp()); | 212 delegate_->OnPointerScrollStop(event->time_stamp()); |
| 211 delegate_->OnPointerFrame(); | 213 delegate_->OnPointerFrame(); |
| 212 break; | 214 break; |
| 213 } | 215 } |
| 214 case ui::ET_SCROLL_FLING_CANCEL: { | 216 case ui::ET_SCROLL_FLING_CANCEL: { |
| 215 delegate_->OnPointerScrollCancel(event->time_stamp()); | 217 // Fling cancel is generated very generously at every touch of the |
| 216 delegate_->OnPointerFrame(); | 218 // touchpad. Since it's not directly supported by wayland, we do not |
|
reveman
2017/05/03 21:02:49
nit: we shouldn't be referring to wayland in this
| |
| 219 // want limit this event to only right after a fling start has been | |
| 220 // generated to prevent erronous behavior. | |
| 221 if (last_event_type_ == ui::ET_SCROLL_FLING_START) { | |
| 222 // Since wayland does not have support for fling cancel events | |
|
reveman
2017/05/03 21:02:48
nit: s/wayland/delegate/
| |
| 223 // (which are supposed to stop any kind of fling/kinetic scrolling | |
| 224 // motion), we emulate this by starting a new scroll sequence that | |
| 225 // scrolls by 0 pixels, effectively stopping any kinetic scroll motion. | |
| 226 delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(), | |
| 227 false); | |
| 228 delegate_->OnPointerFrame(); | |
| 229 delegate_->OnPointerScrollStop(event->time_stamp()); | |
| 230 delegate_->OnPointerFrame(); | |
| 231 } | |
| 217 break; | 232 break; |
| 218 } | 233 } |
| 219 case ui::ET_MOUSE_MOVED: | 234 case ui::ET_MOUSE_MOVED: |
| 220 case ui::ET_MOUSE_DRAGGED: | 235 case ui::ET_MOUSE_DRAGGED: |
| 221 case ui::ET_MOUSE_ENTERED: | 236 case ui::ET_MOUSE_ENTERED: |
| 222 case ui::ET_MOUSE_EXITED: | 237 case ui::ET_MOUSE_EXITED: |
| 223 case ui::ET_MOUSE_CAPTURE_CHANGED: | 238 case ui::ET_MOUSE_CAPTURE_CHANGED: |
| 224 break; | 239 break; |
| 225 default: | 240 default: |
| 226 NOTREACHED(); | 241 NOTREACHED(); |
| 227 break; | 242 break; |
| 228 } | 243 } |
| 229 | 244 |
| 245 last_event_type_ = event->type(); | |
| 230 UpdateCursorScale(); | 246 UpdateCursorScale(); |
| 231 } | 247 } |
| 232 | 248 |
| 233 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { | 249 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { |
| 234 OnMouseEvent(event); | 250 OnMouseEvent(event); |
| 235 } | 251 } |
| 236 | 252 |
| 237 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// |
| 238 // WMHelper::CursorObserver overrides: | 254 // WMHelper::CursorObserver overrides: |
| 239 | 255 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 if (!root_window) | 398 if (!root_window) |
| 383 return; | 399 return; |
| 384 | 400 |
| 385 aura::client::CursorClient* cursor_client = | 401 aura::client::CursorClient* cursor_client = |
| 386 aura::client::GetCursorClient(root_window); | 402 aura::client::GetCursorClient(root_window); |
| 387 if (cursor_client) | 403 if (cursor_client) |
| 388 cursor_client->SetCursor(cursor_); | 404 cursor_client->SetCursor(cursor_); |
| 389 } | 405 } |
| 390 | 406 |
| 391 } // namespace exo | 407 } // namespace exo |
| OLD | NEW |