| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/controls/button/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.h" |
| 6 | 6 |
| 7 #include "ui/accessibility/ax_node_data.h" | 7 #include "ui/accessibility/ax_node_data.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/events/event_utils.h" | 9 #include "ui/events/event_utils.h" |
| 10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 if (widget && widget->GetNativeWindow()) { | 491 if (widget && widget->GetNativeWindow()) { |
| 492 aura::Window* root_window = widget->GetNativeWindow()->GetRootWindow(); | 492 aura::Window* root_window = widget->GetNativeWindow()->GetRootWindow(); |
| 493 aura::client::CaptureClient* capture_client = | 493 aura::client::CaptureClient* capture_client = |
| 494 aura::client::GetCaptureClient(root_window); | 494 aura::client::GetCaptureClient(root_window); |
| 495 aura::Window* capture_window = | 495 aura::Window* capture_window = |
| 496 capture_client ? capture_client->GetGlobalCaptureWindow() : nullptr; | 496 capture_client ? capture_client->GetGlobalCaptureWindow() : nullptr; |
| 497 check_mouse_position = !capture_window || capture_window == root_window; | 497 check_mouse_position = !capture_window || capture_window == root_window; |
| 498 } | 498 } |
| 499 #endif | 499 #endif |
| 500 | 500 |
| 501 return check_mouse_position && IsMouseHovered(); | 501 return check_mouse_position && IsMouseHovered() && |
| 502 !ui::IsWindowsCursorHidden(); |
| 502 } | 503 } |
| 503 | 504 |
| 504 //////////////////////////////////////////////////////////////////////////////// | 505 //////////////////////////////////////////////////////////////////////////////// |
| 505 // CustomButton, Button overrides (protected): | 506 // CustomButton, Button overrides (protected): |
| 506 | 507 |
| 507 void CustomButton::NotifyClick(const ui::Event& event) { | 508 void CustomButton::NotifyClick(const ui::Event& event) { |
| 508 if (has_ink_drop_action_on_click_) { | 509 if (has_ink_drop_action_on_click_) { |
| 509 AnimateInkDrop(InkDropState::ACTION_TRIGGERED, | 510 AnimateInkDrop(InkDropState::ACTION_TRIGGERED, |
| 510 ui::LocatedEvent::FromIfValid(&event)); | 511 ui::LocatedEvent::FromIfValid(&event)); |
| 511 } | 512 } |
| 512 Button::NotifyClick(event); | 513 Button::NotifyClick(event); |
| 513 } | 514 } |
| 514 | 515 |
| 515 void CustomButton::OnClickCanceled(const ui::Event& event) { | 516 void CustomButton::OnClickCanceled(const ui::Event& event) { |
| 516 if (ShouldUpdateInkDropOnClickCanceled()) { | 517 if (ShouldUpdateInkDropOnClickCanceled()) { |
| 517 if (GetInkDrop()->GetTargetInkDropState() == | 518 if (GetInkDrop()->GetTargetInkDropState() == |
| 518 views::InkDropState::ACTION_PENDING || | 519 views::InkDropState::ACTION_PENDING || |
| 519 GetInkDrop()->GetTargetInkDropState() == | 520 GetInkDrop()->GetTargetInkDropState() == |
| 520 views::InkDropState::ALTERNATE_ACTION_PENDING) { | 521 views::InkDropState::ALTERNATE_ACTION_PENDING) { |
| 521 AnimateInkDrop(views::InkDropState::HIDDEN, | 522 AnimateInkDrop(views::InkDropState::HIDDEN, |
| 522 ui::LocatedEvent::FromIfValid(&event)); | 523 ui::LocatedEvent::FromIfValid(&event)); |
| 523 } | 524 } |
| 524 } | 525 } |
| 525 Button::OnClickCanceled(event); | 526 Button::OnClickCanceled(event); |
| 526 } | 527 } |
| 527 | 528 |
| 528 } // namespace views | 529 } // namespace views |
| OLD | NEW |