OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/widget/root_view.h" | 5 #include "views/widget/root_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 View* mouse_pressed_handler = mouse_pressed_handler_; | 448 View* mouse_pressed_handler = mouse_pressed_handler_; |
449 mouse_pressed_handler_ = NULL; | 449 mouse_pressed_handler_ = NULL; |
450 explicit_mouse_handler_ = false; | 450 explicit_mouse_handler_ = false; |
451 mouse_pressed_handler->ProcessMouseReleased(mouse_released, canceled); | 451 mouse_pressed_handler->ProcessMouseReleased(mouse_released, canceled); |
452 // WARNING: we may have been deleted. | 452 // WARNING: we may have been deleted. |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 void RootView::OnMouseMoved(const MouseEvent& e) { | 456 void RootView::OnMouseMoved(const MouseEvent& e) { |
457 View* v = GetViewForPoint(e.location()); | 457 View* v = GetViewForPoint(e.location()); |
458 // Find the first enabled view. | 458 // Find the first enabled view, or the existing move handler, whichever comes |
459 while (v && !v->IsEnabled()) | 459 // first. The check for the existing handler is because if a view becomes |
| 460 // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED |
| 461 // and ET_MOUSE_ENTERED events, because the mouse hasn't actually exited yet. |
| 462 while (v && !v->IsEnabled() && (v != mouse_move_handler_)) |
460 v = v->GetParent(); | 463 v = v->GetParent(); |
461 if (v && v != this) { | 464 if (v && v != this) { |
462 if (v != mouse_move_handler_) { | 465 if (v != mouse_move_handler_) { |
463 if (mouse_move_handler_ != NULL) { | 466 if (mouse_move_handler_ != NULL) { |
464 MouseEvent exited_event(Event::ET_MOUSE_EXITED, 0, 0, 0); | 467 MouseEvent exited_event(Event::ET_MOUSE_EXITED, 0, 0, 0); |
465 mouse_move_handler_->OnMouseExited(exited_event); | 468 mouse_move_handler_->OnMouseExited(exited_event); |
466 } | 469 } |
467 | 470 |
468 mouse_move_handler_ = v; | 471 mouse_move_handler_ = v; |
469 | 472 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 static_cast<WidgetGtk*>(GetWidget())->window_contents(); | 710 static_cast<WidgetGtk*>(GetWidget())->window_contents(); |
708 if (!native_view) | 711 if (!native_view) |
709 return; | 712 return; |
710 gdk_window_set_cursor(native_view->window, cursor); | 713 gdk_window_set_cursor(native_view->window, cursor); |
711 if (cursor) | 714 if (cursor) |
712 gdk_cursor_destroy(cursor); | 715 gdk_cursor_destroy(cursor); |
713 #endif | 716 #endif |
714 } | 717 } |
715 | 718 |
716 } // namespace views | 719 } // namespace views |
OLD | NEW |