| 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/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "components/exo/pointer_delegate.h" | 9 #include "components/exo/pointer_delegate.h" |
| 10 #include "components/exo/pointer_stylus_delegate.h" | 10 #include "components/exo/pointer_stylus_delegate.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 delegate_->OnPointerFrame(); | 240 delegate_->OnPointerFrame(); |
| 241 } | 241 } |
| 242 break; | 242 break; |
| 243 case ui::ET_SCROLL_FLING_START: | 243 case ui::ET_SCROLL_FLING_START: |
| 244 if (focus_) { | 244 if (focus_) { |
| 245 delegate_->OnPointerScrollStop(event->time_stamp()); | 245 delegate_->OnPointerScrollStop(event->time_stamp()); |
| 246 delegate_->OnPointerFrame(); | 246 delegate_->OnPointerFrame(); |
| 247 } | 247 } |
| 248 break; | 248 break; |
| 249 case ui::ET_SCROLL_FLING_CANCEL: | 249 case ui::ET_SCROLL_FLING_CANCEL: |
| 250 if (focus_) { | 250 if (focus_ && last_event_type_ == ui::ET_SCROLL_FLING_START) { |
| 251 delegate_->OnPointerScrollCancel(event->time_stamp()); | 251 delegate_->OnPointerScroll(event->time_stamp(), gfx::Vector2dF(), |
| 252 false); |
| 253 delegate_->OnPointerFrame(); |
| 254 delegate_->OnPointerScrollStop(event->time_stamp()); |
| 252 delegate_->OnPointerFrame(); | 255 delegate_->OnPointerFrame(); |
| 253 } | 256 } |
| 254 break; | 257 break; |
| 255 case ui::ET_MOUSE_MOVED: | 258 case ui::ET_MOUSE_MOVED: |
| 256 case ui::ET_MOUSE_DRAGGED: | 259 case ui::ET_MOUSE_DRAGGED: |
| 257 case ui::ET_MOUSE_ENTERED: | 260 case ui::ET_MOUSE_ENTERED: |
| 258 case ui::ET_MOUSE_EXITED: | 261 case ui::ET_MOUSE_EXITED: |
| 259 case ui::ET_MOUSE_CAPTURE_CHANGED: | 262 case ui::ET_MOUSE_CAPTURE_CHANGED: |
| 260 break; | 263 break; |
| 261 default: | 264 default: |
| 262 NOTREACHED(); | 265 NOTREACHED(); |
| 263 break; | 266 break; |
| 264 } | 267 } |
| 265 | 268 |
| 266 if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0) | 269 if (!(event->flags() & ui::EF_IS_SYNTHESIZED)) { |
| 267 is_direct_input_ = (event->flags() & ui::EF_DIRECT_INPUT) != 0; | 270 is_direct_input_ = event->flags() & ui::EF_DIRECT_INPUT; |
| 271 last_event_type_ = event->type(); |
| 272 } |
| 268 | 273 |
| 269 // Update cursor widget to reflect current focus and pointer location. | 274 // Update cursor widget to reflect current focus and pointer location. |
| 270 if (focus_ && !is_direct_input_) { | 275 if (focus_ && !is_direct_input_) { |
| 271 if (!widget_) | 276 if (!widget_) |
| 272 CreatePointerWidget(); | 277 CreatePointerWidget(); |
| 273 | 278 |
| 274 // Update cursor location if mouse event caused it to change. | 279 // Update cursor location if mouse event caused it to change. |
| 275 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); | 280 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); |
| 276 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); | 281 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); |
| 277 if (mouse_location != bounds.origin()) { | 282 if (mouse_location != bounds.origin()) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 374 |
| 370 if (ui_scale != cursor_scale_) { | 375 if (ui_scale != cursor_scale_) { |
| 371 gfx::Transform transform; | 376 gfx::Transform transform; |
| 372 transform.Scale(ui_scale, ui_scale); | 377 transform.Scale(ui_scale, ui_scale); |
| 373 widget_->GetNativeWindow()->SetTransform(transform); | 378 widget_->GetNativeWindow()->SetTransform(transform); |
| 374 cursor_scale_ = ui_scale; | 379 cursor_scale_ = ui_scale; |
| 375 } | 380 } |
| 376 } | 381 } |
| 377 | 382 |
| 378 } // namespace exo | 383 } // namespace exo |
| OLD | NEW |