Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: services/ui/ws/window_manager_state.cc

Issue 2323553002: mash: Use the new mus drag and drop API to get drag working in mash. (Closed)
Patch Set: another make unique Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_->AsPointerEvent()) {
170 drag_pointer = event_awaiting_input_ack_->AsPointerEvent()->pointer_id();
Elliot Glaysher 2016/09/26 20:57:29 In the server, do I have to handle things other th
sky 2016/09/26 21:44:41 You should at least check that event_awaiting_inpu
Elliot Glaysher 2016/09/26 22:20:02 Misunderstood interface; thought it returned null
171 } else {
172 NOTIMPLEMENTED() << "Set drag drop set up during something other than a "
sky 2016/09/26 21:44:41 Can the NOTIMPLEMENTED case fail? I'm ok if you wa
Elliot Glaysher 2016/09/26 22:20:02 Done.
173 << "pointer event; defaulting to mouse pointer.";
174 }
175
168 event_dispatcher_.SetDragDropSourceWindow( 176 event_dispatcher_.SetDragDropSourceWindow(
169 drag_source, window, source_connection, drag_pointer, 177 drag_source, window, source_connection, drag_pointer,
170 std::move(drag_data), drag_operation); 178 std::move(drag_data), drag_operation);
171 } 179 }
172 180
173 void WindowManagerState::CancelDragDrop() { 181 void WindowManagerState::CancelDragDrop() {
174 event_dispatcher_.CancelDragDrop(); 182 event_dispatcher_.CancelDragDrop();
175 } 183 }
176 184
177 void WindowManagerState::EndDragDrop() { 185 void WindowManagerState::EndDragDrop() {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 display_root->display()->UpdateNativeCursor(cursor_id); 416 display_root->display()->UpdateNativeCursor(cursor_id);
409 } 417 }
410 } 418 }
411 419
412 event_dispatch_phase_ = EventDispatchPhase::TARGET; 420 event_dispatch_phase_ = EventDispatchPhase::TARGET;
413 421
414 WindowTree* tree = window_server()->GetTreeWithId(client_id); 422 WindowTree* tree = window_server()->GetTreeWithId(client_id);
415 DCHECK(tree); 423 DCHECK(tree);
416 ScheduleInputEventTimeout(tree); 424 ScheduleInputEventTimeout(tree);
417 425
418 if (accelerator) { 426 event_awaiting_input_ack_ = ui::Event::Clone(event);
419 event_awaiting_input_ack_ = ui::Event::Clone(event); 427
sky 2016/09/26 21:44:41 Why do you need to do this change?
Elliot Glaysher 2016/09/26 22:20:02 Because we need to keep track of the event awaitin
sky 2016/09/26 23:06:05 Got it.
428 if (accelerator)
420 post_target_accelerator_ = accelerator; 429 post_target_accelerator_ = accelerator;
421 }
422 430
423 // Ignore |tree| because it will receive the event via normal dispatch. 431 // Ignore |tree| because it will receive the event via normal dispatch.
424 window_server()->SendToPointerWatchers(event, user_id(), target, tree); 432 window_server()->SendToPointerWatchers(event, user_id(), target, tree);
425 433
426 tree->DispatchInputEvent(target, event); 434 tree->DispatchInputEvent(target, event);
427 } 435 }
428 436
429 void WindowManagerState::AddDebugAccelerators() { 437 void WindowManagerState::AddDebugAccelerators() {
430 const DebugAccelerator accelerator = { 438 const DebugAccelerator accelerator = {
431 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S, 439 DebugAcceleratorType::PRINT_WINDOWS, ui::VKEY_S,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 window->RemoveObserver(this); 627 window->RemoveObserver(this);
620 orphaned_window_manager_display_roots_.erase(iter); 628 orphaned_window_manager_display_roots_.erase(iter);
621 return; 629 return;
622 } 630 }
623 } 631 }
624 NOTREACHED(); 632 NOTREACHED();
625 } 633 }
626 634
627 } // namespace ws 635 } // namespace ws
628 } // namespace ui 636 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698