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

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

Issue 1881253002: mus: Implement ScreenMus::GetCursorScreenPoint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows more. Created 4 years, 8 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 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 StopTrackingPointer(pointer_targets_.begin()->first); 101 StopTrackingPointer(pointer_targets_.begin()->first);
102 102
103 mouse_button_down_ = false; 103 mouse_button_down_ = false;
104 } 104 }
105 105
106 void EventDispatcher::SetMousePointerScreenLocation( 106 void EventDispatcher::SetMousePointerScreenLocation(
107 const gfx::Point& screen_location) { 107 const gfx::Point& screen_location) {
108 DCHECK(pointer_targets_.empty()); 108 DCHECK(pointer_targets_.empty());
109 mouse_pointer_last_location_ = screen_location; 109 mouse_pointer_last_location_ = screen_location;
110 UpdateCursorProviderByLastKnownLocation(); 110 UpdateCursorProviderByLastKnownLocation();
111 delegate_->OnMouseCursorLocationChanged(screen_location);
111 } 112 }
112 113
113 bool EventDispatcher::SetCaptureWindow(ServerWindow* window, 114 bool EventDispatcher::SetCaptureWindow(ServerWindow* window,
114 bool in_nonclient_area) { 115 bool in_nonclient_area) {
115 if (window == capture_window_) 116 if (window == capture_window_)
116 return true; 117 return true;
117 118
118 // A window that is blocked by a modal window cannot gain capture. 119 // A window that is blocked by a modal window cannot gain capture.
119 if (window && window->IsBlockedByModalWindow()) 120 if (window && window->IsBlockedByModalWindow())
120 return false; 121 return false;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } else if (post_target) { 233 } else if (post_target) {
233 delegate_->OnAccelerator(post_target->id(), event); 234 delegate_->OnAccelerator(post_target->id(), event);
234 } 235 }
235 } 236 }
236 237
237 void EventDispatcher::ProcessLocatedEvent(const ui::LocatedEvent& event) { 238 void EventDispatcher::ProcessLocatedEvent(const ui::LocatedEvent& event) {
238 DCHECK(event.IsPointerEvent() || event.IsMouseWheelEvent()); 239 DCHECK(event.IsPointerEvent() || event.IsMouseWheelEvent());
239 const bool is_mouse_event = 240 const bool is_mouse_event =
240 event.IsMousePointerEvent() || event.IsMouseWheelEvent(); 241 event.IsMousePointerEvent() || event.IsMouseWheelEvent();
241 242
242 if (is_mouse_event) 243 if (is_mouse_event) {
244 delegate_->OnMouseCursorLocationChanged(event.root_location());
sky 2016/04/20 23:46:36 nit: move this after 245 so the mouse_pointer_last
243 mouse_pointer_last_location_ = event.location(); 245 mouse_pointer_last_location_ = event.location();
246 }
244 247
245 // Release capture on pointer up. For mouse we only release if there are 248 // Release capture on pointer up. For mouse we only release if there are
246 // no buttons down. 249 // no buttons down.
247 const bool is_pointer_going_up = 250 const bool is_pointer_going_up =
248 (event.type() == ui::ET_POINTER_UP || 251 (event.type() == ui::ET_POINTER_UP ||
249 event.type() == ui::ET_POINTER_CANCELLED) && 252 event.type() == ui::ET_POINTER_CANCELLED) &&
250 (!is_mouse_event || IsOnlyOneMouseButtonDown(event.flags())); 253 (!is_mouse_event || IsOnlyOneMouseButtonDown(event.flags()));
251 254
252 // Update mouse down state upon events which change it. 255 // Update mouse down state upon events which change it.
253 if (is_mouse_event) { 256 if (is_mouse_event) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 449
447 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { 450 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) {
448 CancelPointerEventsToTarget(window); 451 CancelPointerEventsToTarget(window);
449 452
450 if (mouse_cursor_source_window_ == window) 453 if (mouse_cursor_source_window_ == window)
451 mouse_cursor_source_window_ = nullptr; 454 mouse_cursor_source_window_ = nullptr;
452 } 455 }
453 456
454 } // namespace ws 457 } // namespace ws
455 } // namespace mus 458 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698