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

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

Issue 2655303004: Add id properties to PointerEvent (Closed)
Patch Set: pointer id Created 3 years, 10 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/service_manager/public/interfaces/connector.mojom.h" 10 #include "services/service_manager/public/interfaces/connector.mojom.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) { 39 bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) {
40 if (one.type() != two.type() || one.flags() != two.flags()) 40 if (one.type() != two.type() || one.flags() != two.flags())
41 return false; 41 return false;
42 42
43 // TODO(sad): wheel events can also be merged. 43 // TODO(sad): wheel events can also be merged.
44 if (one.type() != ui::ET_POINTER_MOVED) 44 if (one.type() != ui::ET_POINTER_MOVED)
45 return false; 45 return false;
46 46
47 return one.AsPointerEvent()->pointer_id() == 47 return one.AsPointerEvent()->pointer_details().id ==
48 two.AsPointerEvent()->pointer_id(); 48 two.AsPointerEvent()->pointer_details().id;
49 } 49 }
50 50
51 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first, 51 std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first,
52 std::unique_ptr<ui::Event> second) { 52 std::unique_ptr<ui::Event> second) {
53 DCHECK(first->type() == ui::ET_POINTER_MOVED) 53 DCHECK(first->type() == ui::ET_POINTER_MOVED)
54 << " Non-move events cannot be merged yet."; 54 << " Non-move events cannot be merged yet.";
55 // For mouse moves, the new event just replaces the old event. 55 // For mouse moves, the new event just replaces the old event.
56 return second; 56 return second;
57 } 57 }
58 58
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 void WindowManagerState::SetDragDropSourceWindow( 164 void WindowManagerState::SetDragDropSourceWindow(
165 DragSource* drag_source, 165 DragSource* drag_source,
166 ServerWindow* window, 166 ServerWindow* window,
167 DragTargetConnection* source_connection, 167 DragTargetConnection* source_connection,
168 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, 168 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data,
169 uint32_t drag_operation) { 169 uint32_t drag_operation) {
170 int32_t drag_pointer = PointerEvent::kMousePointerId; 170 int32_t drag_pointer = PointerEvent::kMousePointerId;
171 if (event_awaiting_input_ack_ && 171 if (event_awaiting_input_ack_ &&
172 event_awaiting_input_ack_->IsPointerEvent()) { 172 event_awaiting_input_ack_->IsPointerEvent()) {
173 drag_pointer = event_awaiting_input_ack_->AsPointerEvent()->pointer_id(); 173 drag_pointer =
174 event_awaiting_input_ack_->AsPointerEvent()->pointer_details().id;
174 } else { 175 } else {
175 NOTIMPLEMENTED() << "Set drag drop set up during something other than a " 176 NOTIMPLEMENTED() << "Set drag drop set up during something other than a "
176 << "pointer event; rejecting drag."; 177 << "pointer event; rejecting drag.";
177 drag_source->OnDragCompleted(false, ui::mojom::kDropEffectNone); 178 drag_source->OnDragCompleted(false, ui::mojom::kDropEffectNone);
178 return; 179 return;
179 } 180 }
180 181
181 event_dispatcher_.SetDragDropSourceWindow(drag_source, window, 182 event_dispatcher_.SetDragDropSourceWindow(drag_source, window,
182 source_connection, drag_pointer, 183 source_connection, drag_pointer,
183 drag_data, drag_operation); 184 drag_data, drag_operation);
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 window->RemoveObserver(this); 637 window->RemoveObserver(this);
637 orphaned_window_manager_display_roots_.erase(iter); 638 orphaned_window_manager_display_roots_.erase(iter);
638 return; 639 return;
639 } 640 }
640 } 641 }
641 NOTREACHED(); 642 NOTREACHED();
642 } 643 }
643 644
644 } // namespace ws 645 } // namespace ws
645 } // namespace ui 646 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698