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

Side by Side Diff: components/mus/ws/event_dispatcher.cc

Issue 1775133003: Moves EventDispatcher from Display to WindowManagerState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo Created 4 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 | « components/mus/ws/event_dispatcher.h ('k') | components/mus/ws/event_dispatcher_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/ws/event_dispatcher.h" 5 #include "components/mus/ws/event_dispatcher.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/surfaces/surface_hittest.h" 10 #include "cc/surfaces/surface_hittest.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 for (const auto& pair : pointer_targets_) { 210 for (const auto& pair : pointer_targets_) {
211 if (pair.second.window && 211 if (pair.second.window &&
212 pointer_targets.insert(pair.second.window).second) { 212 pointer_targets.insert(pair.second.window).second) {
213 pair.second.window->RemoveObserver(this); 213 pair.second.window->RemoveObserver(this);
214 } 214 }
215 } 215 }
216 pointer_targets_.clear(); 216 pointer_targets_.clear();
217 } 217 }
218 218
219 void EventDispatcher::Reset() {
220 if (capture_window_) {
221 CancelPointerEventsToTarget(capture_window_);
222 DCHECK(capture_window_ == nullptr);
223 }
224
225 while (!pointer_targets_.empty())
226 StopTrackingPointer(pointer_targets_.begin()->first);
227
228 mouse_button_down_ = false;
229 }
230
231 void EventDispatcher::SetMousePointerScreenLocation(
232 const gfx::Point& screen_location) {
233 DCHECK(pointer_targets_.empty());
234 mouse_pointer_last_location_ = screen_location;
235 UpdateCursorProviderByLastKnownLocation();
236 }
237
219 void EventDispatcher::SetCaptureWindow(ServerWindow* window, 238 void EventDispatcher::SetCaptureWindow(ServerWindow* window,
220 bool in_nonclient_area) { 239 bool in_nonclient_area) {
221 if (window == capture_window_) 240 if (window == capture_window_)
222 return; 241 return;
223 242
224 if (capture_window_) { 243 if (capture_window_) {
225 // Stop observing old capture window. |pointer_targets_| are cleared on 244 // Stop observing old capture window. |pointer_targets_| are cleared on
226 // intial setting of a capture window. 245 // intial setting of a capture window.
227 delegate_->OnServerWindowCaptureLost(capture_window_); 246 delegate_->OnServerWindowCaptureLost(capture_window_);
228 capture_window_->RemoveObserver(this); 247 capture_window_->RemoveObserver(this);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 554
536 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { 555 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) {
537 CancelPointerEventsToTarget(window); 556 CancelPointerEventsToTarget(window);
538 557
539 if (mouse_cursor_source_window_ == window) 558 if (mouse_cursor_source_window_ == window)
540 mouse_cursor_source_window_ = nullptr; 559 mouse_cursor_source_window_ = nullptr;
541 } 560 }
542 561
543 } // namespace ws 562 } // namespace ws
544 } // namespace mus 563 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/event_dispatcher.h ('k') | components/mus/ws/event_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698