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

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

Issue 2696873002: Change OnWindowInputEvent to use display_id to find the host and update event root_location in WS. (Closed)
Patch Set: nits Created 3 years, 9 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
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return false; 150 return false;
151 if (id) 151 if (id)
152 *id = iter->second; 152 *id = iter->second;
153 return true; 153 return true;
154 } 154 }
155 155
156 bool WindowTree::HasRoot(const ServerWindow* window) const { 156 bool WindowTree::HasRoot(const ServerWindow* window) const {
157 return roots_.count(window) > 0; 157 return roots_.count(window) > 0;
158 } 158 }
159 159
160 const ServerWindow* WindowTree::FindRootFor(const ServerWindow* window) const {
161 for (const ServerWindow* parent = window; parent; parent = parent->parent()) {
162 if (roots_.count(parent))
163 return parent;
164 }
165 return nullptr;
166 }
167
160 const ServerWindow* WindowTree::GetWindowByClientId( 168 const ServerWindow* WindowTree::GetWindowByClientId(
161 const ClientWindowId& id) const { 169 const ClientWindowId& id) const {
162 auto iter = client_id_to_window_id_map_.find(id); 170 auto iter = client_id_to_window_id_map_.find(id);
163 return iter == client_id_to_window_id_map_.end() ? nullptr 171 return iter == client_id_to_window_id_map_.end() ? nullptr
164 : GetWindow(iter->second); 172 : GetWindow(iter->second);
165 } 173 }
166 174
167 const Display* WindowTree::GetDisplay(const ServerWindow* window) const { 175 const Display* WindowTree::GetDisplay(const ServerWindow* window) const {
168 return window ? display_manager()->GetDisplayContaining(window) : nullptr; 176 return window ? display_manager()->GetDisplayContaining(window) : nullptr;
169 } 177 }
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 const ui::Event& event) { 1165 const ui::Event& event) {
1158 GenerateEventAckId(); 1166 GenerateEventAckId();
1159 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(target); 1167 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(target);
1160 DCHECK(display_root); 1168 DCHECK(display_root);
1161 event_source_wms_ = display_root->window_manager_state(); 1169 event_source_wms_ = display_root->window_manager_state();
1162 // Should only get events from windows attached to a host. 1170 // Should only get events from windows attached to a host.
1163 DCHECK(event_source_wms_); 1171 DCHECK(event_source_wms_);
1164 bool matched_pointer_watcher = EventMatchesPointerWatcher(event); 1172 bool matched_pointer_watcher = EventMatchesPointerWatcher(event);
1165 Display* display = GetDisplay(target); 1173 Display* display = GetDisplay(target);
1166 DCHECK(display); 1174 DCHECK(display);
1167 client()->OnWindowInputEvent( 1175 client()->OnWindowInputEvent(
sadrul 2017/03/16 01:35:16 This is where the conversion should happen.
1168 event_ack_id_, ClientWindowIdForWindow(target).id, display->GetId(), 1176 event_ack_id_, ClientWindowIdForWindow(target).id, display->GetId(),
1169 ui::Event::Clone(event), matched_pointer_watcher); 1177 ui::Event::Clone(event), matched_pointer_watcher);
1170 } 1178 }
1171 1179
1172 bool WindowTree::EventMatchesPointerWatcher(const ui::Event& event) const { 1180 bool WindowTree::EventMatchesPointerWatcher(const ui::Event& event) const {
1173 if (!has_pointer_watcher_) 1181 if (!has_pointer_watcher_)
1174 return false; 1182 return false;
1175 if (!event.IsPointerEvent()) 1183 if (!event.IsPointerEvent())
1176 return false; 1184 return false;
1177 if (pointer_watcher_want_moves_ && event.type() == ui::ET_POINTER_MOVED) 1185 if (pointer_watcher_want_moves_ && event.type() == ui::ET_POINTER_MOVED)
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, 2187 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset,
2180 effect_bitmask, callback); 2188 effect_bitmask, callback);
2181 } 2189 }
2182 2190
2183 void WindowTree::PerformOnDragDropDone() { 2191 void WindowTree::PerformOnDragDropDone() {
2184 client()->OnDragDropDone(); 2192 client()->OnDragDropDone();
2185 } 2193 }
2186 2194
2187 } // namespace ws 2195 } // namespace ws
2188 } // namespace ui 2196 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698