| Index: ash/wm/window_cycle_event_filter_aura.cc
|
| diff --git a/ash/wm/window_cycle_event_filter_aura.cc b/ash/wm/window_cycle_event_filter_aura.cc
|
| index e9879b524f7005f9be2261aba4139640fdcb0daa..a8dadb9a8c8c068a8dc41e96875b5f7c9f792eb9 100644
|
| --- a/ash/wm/window_cycle_event_filter_aura.cc
|
| +++ b/ash/wm/window_cycle_event_filter_aura.cc
|
| @@ -14,10 +14,16 @@ namespace ash {
|
|
|
| WindowCycleEventFilterAura::WindowCycleEventFilterAura() {
|
| Shell::GetInstance()->AddPreTargetHandler(this);
|
| + // Handling release of "Alt" must come before other pretarget handlers
|
| + // (specifically, the partial screenshot handler). See crbug.com/651939
|
| + // We can't do all key event handling that early though because it prevents
|
| + // other accelerators (like triggering a partial screenshot) from working.
|
| + Shell::GetInstance()->PrependPreTargetHandler(&alt_release_handler_);
|
| }
|
|
|
| WindowCycleEventFilterAura::~WindowCycleEventFilterAura() {
|
| Shell::GetInstance()->RemovePreTargetHandler(this);
|
| + Shell::GetInstance()->RemovePreTargetHandler(&alt_release_handler_);
|
| }
|
|
|
| void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
|
| @@ -28,12 +34,7 @@ void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
|
| event->type() != ui::ET_KEY_PRESSED) {
|
| event->StopPropagation();
|
| }
|
| - // Views uses VKEY_MENU for both left and right Alt keys.
|
| - if (event->key_code() == ui::VKEY_MENU &&
|
| - event->type() == ui::ET_KEY_RELEASED) {
|
| - WmShell::Get()->window_cycle_controller()->CompleteCycling();
|
| - // Warning: |this| will be deleted from here on.
|
| - } else if (event->key_code() == ui::VKEY_TAB) {
|
| + if (event->key_code() == ui::VKEY_TAB) {
|
| if (event->type() == ui::ET_KEY_RELEASED) {
|
| repeat_timer_.Stop();
|
| } else if (event->type() == ui::ET_KEY_PRESSED && event->is_repeat() &&
|
| @@ -51,4 +52,28 @@ void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
|
| }
|
| }
|
|
|
| +void WindowCycleEventFilterAura::OnMouseEvent(ui::MouseEvent* event) {
|
| + // Prevent mouse clicks from doing anything while the Alt+Tab UI is active
|
| + // <crbug.com/641171> but don't interfere with drag and drop operations
|
| + // <crbug.com/660945>.
|
| + if (event->type() != ui::ET_MOUSE_DRAGGED &&
|
| + event->type() != ui::ET_MOUSE_RELEASED) {
|
| + event->StopPropagation();
|
| + }
|
| +}
|
| +
|
| +WindowCycleEventFilterAura::AltReleaseHandler::AltReleaseHandler() {}
|
| +
|
| +WindowCycleEventFilterAura::AltReleaseHandler::~AltReleaseHandler() {}
|
| +
|
| +void WindowCycleEventFilterAura::AltReleaseHandler::OnKeyEvent(
|
| + ui::KeyEvent* event) {
|
| + // Views uses VKEY_MENU for both left and right Alt keys.
|
| + if (event->key_code() == ui::VKEY_MENU &&
|
| + event->type() == ui::ET_KEY_RELEASED) {
|
| + WmShell::Get()->window_cycle_controller()->CompleteCycling();
|
| + // Warning: |this| will be deleted from here on.
|
| + }
|
| +}
|
| +
|
| } // namespace ash
|
|
|