| 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/shell/public/interfaces/connector.mojom.h" | 10 #include "services/shell/public/interfaces/connector.mojom.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { | 157 void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() { |
| 158 event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow(); | 158 event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void WindowManagerState::SetDragDropSourceWindow( | 161 void WindowManagerState::SetDragDropSourceWindow( |
| 162 DragSource* drag_source, | 162 DragSource* drag_source, |
| 163 ServerWindow* window, | 163 ServerWindow* window, |
| 164 DragTargetConnection* source_connection, | 164 DragTargetConnection* source_connection, |
| 165 int32_t drag_pointer, | |
| 166 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, | 165 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, |
| 167 uint32_t drag_operation) { | 166 uint32_t drag_operation) { |
| 167 int32_t drag_pointer = PointerEvent::kMousePointerId; |
| 168 if (event_awaiting_input_ack_ && |
| 169 event_awaiting_input_ack_->IsPointerEvent()) { |
| 170 drag_pointer = event_awaiting_input_ack_->AsPointerEvent()->pointer_id(); |
| 171 } else { |
| 172 NOTIMPLEMENTED() << "Set drag drop set up during something other than a " |
| 173 << "pointer event; rejecting drag."; |
| 174 drag_source->OnDragCompleted(false, ui::mojom::kDropEffectNone); |
| 175 return; |
| 176 } |
| 177 |
| 168 event_dispatcher_.SetDragDropSourceWindow( | 178 event_dispatcher_.SetDragDropSourceWindow( |
| 169 drag_source, window, source_connection, drag_pointer, | 179 drag_source, window, source_connection, drag_pointer, |
| 170 std::move(drag_data), drag_operation); | 180 std::move(drag_data), drag_operation); |
| 171 } | 181 } |
| 172 | 182 |
| 173 void WindowManagerState::CancelDragDrop() { | 183 void WindowManagerState::CancelDragDrop() { |
| 174 event_dispatcher_.CancelDragDrop(); | 184 event_dispatcher_.CancelDragDrop(); |
| 175 } | 185 } |
| 176 | 186 |
| 177 void WindowManagerState::EndDragDrop() { | 187 void WindowManagerState::EndDragDrop() { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 display_root->display()->UpdateNativeCursor(cursor_id); | 418 display_root->display()->UpdateNativeCursor(cursor_id); |
| 409 } | 419 } |
| 410 } | 420 } |
| 411 | 421 |
| 412 event_dispatch_phase_ = EventDispatchPhase::TARGET; | 422 event_dispatch_phase_ = EventDispatchPhase::TARGET; |
| 413 | 423 |
| 414 WindowTree* tree = window_server()->GetTreeWithId(client_id); | 424 WindowTree* tree = window_server()->GetTreeWithId(client_id); |
| 415 DCHECK(tree); | 425 DCHECK(tree); |
| 416 ScheduleInputEventTimeout(tree); | 426 ScheduleInputEventTimeout(tree); |
| 417 | 427 |
| 418 if (accelerator) { | 428 event_awaiting_input_ack_ = ui::Event::Clone(event); |
| 419 event_awaiting_input_ack_ = ui::Event::Clone(event); | 429 |
| 430 if (accelerator) |
| 420 post_target_accelerator_ = accelerator; | 431 post_target_accelerator_ = accelerator; |
| 421 } | |
| 422 | 432 |
| 423 // Ignore |tree| because it will receive the event via normal dispatch. | 433 // Ignore |tree| because it will receive the event via normal dispatch. |
| 424 window_server()->SendToPointerWatchers(event, user_id(), target, tree); | 434 window_server()->SendToPointerWatchers(event, user_id(), target, tree); |
| 425 | 435 |
| 426 tree->DispatchInputEvent(target, event); | 436 tree->DispatchInputEvent(target, event); |
| 427 } | 437 } |
| 428 | 438 |
| 429 void WindowManagerState::AddDebugAccelerators() { | 439 void WindowManagerState::AddDebugAccelerators() { |
| 430 const DebugAccelerator accelerator = { | 440 const DebugAccelerator accelerator = { |
| 431 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S, | 441 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 window->RemoveObserver(this); | 629 window->RemoveObserver(this); |
| 620 orphaned_window_manager_display_roots_.erase(iter); | 630 orphaned_window_manager_display_roots_.erase(iter); |
| 621 return; | 631 return; |
| 622 } | 632 } |
| 623 } | 633 } |
| 624 NOTREACHED(); | 634 NOTREACHED(); |
| 625 } | 635 } |
| 626 | 636 |
| 627 } // namespace ws | 637 } // namespace ws |
| 628 } // namespace ui | 638 } // namespace ui |
| OLD | NEW |