| 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 "services/ui/ws/event_dispatcher.h" | 5 #include "services/ui/ws/event_dispatcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const gfx::Point& screen_location) { | 79 const gfx::Point& screen_location) { |
| 80 DCHECK(pointer_targets_.empty()); | 80 DCHECK(pointer_targets_.empty()); |
| 81 mouse_pointer_last_location_ = screen_location; | 81 mouse_pointer_last_location_ = screen_location; |
| 82 UpdateCursorProviderByLastKnownLocation(); | 82 UpdateCursorProviderByLastKnownLocation(); |
| 83 // Write our initial location back to our shared screen coordinate. This | 83 // Write our initial location back to our shared screen coordinate. This |
| 84 // shouldn't cause problems because we already read the cursor before we | 84 // shouldn't cause problems because we already read the cursor before we |
| 85 // process any events in views during window construction. | 85 // process any events in views during window construction. |
| 86 delegate_->OnMouseCursorLocationChanged(screen_location); | 86 delegate_->OnMouseCursorLocationChanged(screen_location); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ui::mojom::Cursor EventDispatcher::GetCurrentMouseCursor() const { | 89 ui::mojom::CursorType EventDispatcher::GetCurrentMouseCursor() const { |
| 90 if (drag_controller_) | 90 if (drag_controller_) |
| 91 return drag_controller_->current_cursor(); | 91 return drag_controller_->current_cursor(); |
| 92 | 92 |
| 93 if (!mouse_cursor_source_window_) | 93 if (!mouse_cursor_source_window_) |
| 94 return ui::mojom::Cursor::POINTER; | 94 return ui::mojom::CursorType::POINTER; |
| 95 | 95 |
| 96 if (mouse_cursor_in_non_client_area_) | 96 if (mouse_cursor_in_non_client_area_) |
| 97 return mouse_cursor_source_window_->non_client_cursor(); | 97 return mouse_cursor_source_window_->non_client_cursor(); |
| 98 | 98 |
| 99 const ServerWindow* window = GetWindowForMouseCursor(); | 99 const ServerWindow* window = GetWindowForMouseCursor(); |
| 100 return window ? window->cursor() : ui::mojom::Cursor::POINTER; | 100 return window ? window->cursor() : ui::mojom::CursorType::POINTER; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool EventDispatcher::SetCaptureWindow(ServerWindow* window, | 103 bool EventDispatcher::SetCaptureWindow(ServerWindow* window, |
| 104 ClientSpecificId client_id) { | 104 ClientSpecificId client_id) { |
| 105 if (!window) | 105 if (!window) |
| 106 client_id = kInvalidClientId; | 106 client_id = kInvalidClientId; |
| 107 | 107 |
| 108 if (window == capture_window_ && client_id == capture_window_client_id_) | 108 if (window == capture_window_ && client_id == capture_window_client_id_) |
| 109 return true; | 109 return true; |
| 110 | 110 |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (mouse_cursor_source_window_ == window) | 653 if (mouse_cursor_source_window_ == window) |
| 654 SetMouseCursorSourceWindow(nullptr); | 654 SetMouseCursorSourceWindow(nullptr); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void EventDispatcher::OnDragCursorUpdated() { | 657 void EventDispatcher::OnDragCursorUpdated() { |
| 658 delegate_->UpdateNativeCursorFromDispatcher(); | 658 delegate_->UpdateNativeCursorFromDispatcher(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 } // namespace ws | 661 } // namespace ws |
| 662 } // namespace ui | 662 } // namespace ui |
| OLD | NEW |