| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/window_manager_state.h" | 5 #include "services/ui/ws/window_manager_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "services/service_manager/public/interfaces/connector.mojom.h" | 10 #include "services/service_manager/public/interfaces/connector.mojom.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) { | 40 bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) { |
| 41 if (one.type() != two.type() || one.flags() != two.flags()) | 41 if (one.type() != two.type() || one.flags() != two.flags()) |
| 42 return false; | 42 return false; |
| 43 | 43 |
| 44 // TODO(sad): wheel events can also be merged. | 44 // TODO(sad): wheel events can also be merged. |
| 45 if (one.type() != ui::ET_POINTER_MOVED) | 45 if (one.type() != ui::ET_POINTER_MOVED) |
| 46 return false; | 46 return false; |
| 47 | 47 |
| 48 return one.AsPointerEvent()->pointer_id() == | 48 return one.AsPointerEvent()->pointer_details().id == |
| 49 two.AsPointerEvent()->pointer_id(); | 49 two.AsPointerEvent()->pointer_details().id; |
| 50 } | 50 } |
| 51 | 51 |
| 52 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first, | 52 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first, |
| 53 std::unique_ptr<ui::Event> second) { | 53 std::unique_ptr<ui::Event> second) { |
| 54 DCHECK(first->type() == ui::ET_POINTER_MOVED) | 54 DCHECK(first->type() == ui::ET_POINTER_MOVED) |
| 55 << " Non-move events cannot be merged yet."; | 55 << " Non-move events cannot be merged yet."; |
| 56 // For mouse moves, the new event just replaces the old event. | 56 // For mouse moves, the new event just replaces the old event. |
| 57 return second; | 57 return second; |
| 58 } | 58 } |
| 59 | 59 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void WindowManagerState::SetDragDropSourceWindow( | 177 void WindowManagerState::SetDragDropSourceWindow( |
| 178 DragSource* drag_source, | 178 DragSource* drag_source, |
| 179 ServerWindow* window, | 179 ServerWindow* window, |
| 180 DragTargetConnection* source_connection, | 180 DragTargetConnection* source_connection, |
| 181 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, | 181 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, |
| 182 uint32_t drag_operation) { | 182 uint32_t drag_operation) { |
| 183 int32_t drag_pointer = PointerEvent::kMousePointerId; | 183 int32_t drag_pointer = PointerEvent::kMousePointerId; |
| 184 if (in_flight_event_details_ && | 184 if (in_flight_event_details_ && |
| 185 in_flight_event_details_->event->IsPointerEvent()) { | 185 in_flight_event_details_->event->IsPointerEvent()) { |
| 186 drag_pointer = | 186 drag_pointer = |
| 187 in_flight_event_details_->event->AsPointerEvent()->pointer_id(); | 187 in_flight_event_details_->event->AsPointerEvent()->pointer_details().id; |
| 188 } else { | 188 } else { |
| 189 NOTIMPLEMENTED() << "Set drag drop set up during something other than a " | 189 NOTIMPLEMENTED() << "Set drag drop set up during something other than a " |
| 190 << "pointer event; rejecting drag."; | 190 << "pointer event; rejecting drag."; |
| 191 drag_source->OnDragCompleted(false, ui::mojom::kDropEffectNone); | 191 drag_source->OnDragCompleted(false, ui::mojom::kDropEffectNone); |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 | 194 |
| 195 event_dispatcher_.SetDragDropSourceWindow(drag_source, window, | 195 event_dispatcher_.SetDragDropSourceWindow(drag_source, window, |
| 196 source_connection, drag_pointer, | 196 source_connection, drag_pointer, |
| 197 drag_data, drag_operation); | 197 drag_data, drag_operation); |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 window->RemoveObserver(this); | 665 window->RemoveObserver(this); |
| 666 orphaned_window_manager_display_roots_.erase(iter); | 666 orphaned_window_manager_display_roots_.erase(iter); |
| 667 return; | 667 return; |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 NOTREACHED(); | 670 NOTREACHED(); |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace ws | 673 } // namespace ws |
| 674 } // namespace ui | 674 } // namespace ui |
| OLD | NEW |