| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/display/mouse_cursor_event_filter.h" | 5 #include "ash/display/mouse_cursor_event_filter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/display/cursor_window_controller.h" | 9 #include "ash/display/cursor_window_controller.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { | 44 void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { |
| 45 // Don't warp due to synthesized event. | 45 // Don't warp due to synthesized event. |
| 46 if (event->flags() & ui::EF_IS_SYNTHESIZED) | 46 if (event->flags() & ui::EF_IS_SYNTHESIZED) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 // Handle both MOVED and DRAGGED events here because when the mouse pointer | 49 // Handle both MOVED and DRAGGED events here because when the mouse pointer |
| 50 // enters the other root window while dragging, the underlying window system | 50 // enters the other root window while dragging, the underlying window system |
| 51 // (at least X11) stops generating a ui::ET_MOUSE_MOVED event. | 51 // (at least X11) stops generating a ui::ET_MOUSE_MOVED event. |
| 52 if (event->type() != ui::ET_MOUSE_MOVED && | 52 if (event->type() != ui::ET_MOUSE_MOVED && |
| 53 event->type() != ui::ET_MOUSE_DRAGGED) { | 53 event->type() != ui::ET_MOUSE_DRAGGED) { |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 | 56 |
| 57 Shell::GetInstance() | 57 Shell::GetInstance() |
| 58 ->window_tree_host_manager() | 58 ->window_tree_host_manager() |
| 59 ->cursor_window_controller() | 59 ->cursor_window_controller() |
| 60 ->UpdateLocation(); | 60 ->UpdateLocation(); |
| 61 mouse_warp_controller_->SetEnabled(mouse_warp_enabled_); | 61 mouse_warp_controller_->SetEnabled(mouse_warp_enabled_); |
| 62 | 62 |
| 63 if (mouse_warp_controller_->WarpMouseCursor(event)) | 63 if (mouse_warp_controller_->WarpMouseCursor(event)) |
| 64 event->StopPropagation(); | 64 event->StopPropagation(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace ash | 67 } // namespace ash |
| OLD | NEW |