OLD | NEW |
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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } else { | 384 } else { |
385 // Make sure mouse_moved_handler gets updated. | 385 // Make sure mouse_moved_handler gets updated. |
386 DispatchDetails details = SynthesizeMouseMoveEvent(); | 386 DispatchDetails details = SynthesizeMouseMoveEvent(); |
387 if (details.dispatcher_destroyed) | 387 if (details.dispatcher_destroyed) |
388 return; | 388 return; |
389 } | 389 } |
390 mouse_pressed_handler_ = NULL; | 390 mouse_pressed_handler_ = NULL; |
391 } | 391 } |
392 | 392 |
393 void WindowEventDispatcher::OnOtherRootGotCapture() { | 393 void WindowEventDispatcher::OnOtherRootGotCapture() { |
394 // Sending the mouse exit causes bugs on Windows (e.g. crbug.com/394672). | 394 // Windows provides the TrackMouseEvents API which allows us to rely on the |
395 // TODO(pkotwicz): Fix the bugs and send mouse exit on Windows too. | 395 // OS to send us the mouse exit events (WM_MOUSELEAVE). Additionally on |
| 396 // desktop Windows, every top level window could potentially have its own |
| 397 // root window, in which case this function will get called whenever those |
| 398 // windows grab mouse capture. Sending mouse exit messages in these cases |
| 399 // causes subtle bugs like (crbug.com/394672). |
396 #if !defined(OS_WIN) | 400 #if !defined(OS_WIN) |
397 if (mouse_moved_handler_) { | 401 if (mouse_moved_handler_) { |
398 // Dispatch a mouse exit to reset any state associated with hover. This is | 402 // Dispatch a mouse exit to reset any state associated with hover. This is |
399 // important when going from no window having capture to a window having | 403 // important when going from no window having capture to a window having |
400 // capture because we do not dispatch ET_MOUSE_CAPTURE_CHANGED in this case. | 404 // capture because we do not dispatch ET_MOUSE_CAPTURE_CHANGED in this case. |
401 DispatchDetails details = DispatchMouseExitAtPoint( | 405 DispatchDetails details = DispatchMouseExitAtPoint( |
402 GetLastMouseLocationInRoot()); | 406 GetLastMouseLocationInRoot()); |
403 if (details.dispatcher_destroyed) | 407 if (details.dispatcher_destroyed) |
404 return; | 408 return; |
405 } | 409 } |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, | 895 if (!ui::GestureRecognizer::Get()->ProcessTouchEventPreDispatch(orig_event, |
892 target)) { | 896 target)) { |
893 event->SetHandled(); | 897 event->SetHandled(); |
894 } | 898 } |
895 } | 899 } |
896 | 900 |
897 PreDispatchLocatedEvent(target, event); | 901 PreDispatchLocatedEvent(target, event); |
898 } | 902 } |
899 | 903 |
900 } // namespace aura | 904 } // namespace aura |
OLD | NEW |