Commit fad529a3 authored by chinsenj's avatar chinsenj Committed by Commit Bot

cros: Change window cycle list (alt-tab) tap behavior.

Currently with the InteractiveWindowCycleList flag enabled, if a user
taps on an item it will activate that window and exit the window cycle
list. It's unclear to users that this selection is being made.

To address this, this CL makes it so taps move the focus ring to the
tapped item rather than activating the tapped item.

Test: manual + modified existing test
Bug: 1067327
Change-Id: Ic35972a931d2ddf5c2afa6bb02743a25e0e9ecf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432725Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Jeremy Chinsen <chinsenj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811367}
parent d1600eb0
......@@ -123,6 +123,13 @@ class WindowCycleControllerTest : public AshTestBase {
->GetWindowCycleItemViewsForTesting();
}
const aura::Window* GetTargetWindow() const {
return Shell::Get()
->window_cycle_controller()
->window_cycle_list()
->GetTargetWindowForTesting();
}
bool CycleViewExists() const {
return Shell::Get()
->window_cycle_controller()
......@@ -1131,8 +1138,7 @@ TEST_F(InteractiveWindowCycleControllerTest, KeysConfirmSelection) {
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
}
// When a user taps on an item, it should cycle to it, complete cycling and
// activate the tapped item.
// When a user taps on an item, it should set the focus ring to that item.
TEST_F(InteractiveWindowCycleControllerTest, TapSelect) {
std::unique_ptr<Window> w0 = CreateTestWindow();
std::unique_ptr<Window> w1 = CreateTestWindow();
......@@ -1145,14 +1151,18 @@ TEST_F(InteractiveWindowCycleControllerTest, TapSelect) {
controller->StartCycling();
generator->GestureTapAt(
GetWindowCycleItemViews()[2]->GetBoundsInScreen().CenterPoint());
EXPECT_TRUE(wm::IsActiveWindow(w0.get()));
EXPECT_TRUE(controller->IsCycling());
EXPECT_EQ(GetTargetWindow(), w0.get());
// Start cycle and tap second item.
// Starting order of windows in cycle list is [0,2,1].
// Starting order of windows in cycle list is [2,1,0].
controller->StartCycling();
generator->GestureTapAt(
GetWindowCycleItemViews()[1]->GetBoundsInScreen().CenterPoint());
EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
EXPECT_TRUE(controller->IsCycling());
EXPECT_EQ(GetTargetWindow(), w1.get());
controller->CompleteCycling();
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
}
// When a user has the window cycle list open and clicks outside of it, it
......
......@@ -153,13 +153,15 @@ class WindowCycleItemView : public WindowMiniView {
void OnGestureEvent(ui::GestureEvent* event) override {
switch (event->type()) {
case ui::ET_GESTURE_TAP:
case ui::ET_GESTURE_DOUBLE_TAP:
case ui::ET_GESTURE_TAP_DOWN:
case ui::ET_GESTURE_TAP_UNCONFIRMED:
case ui::ET_GESTURE_LONG_PRESS:
case ui::ET_GESTURE_LONG_TAP:
case ui::ET_GESTURE_TWO_FINGER_TAP: {
WindowCycleController* controller =
Shell::Get()->window_cycle_controller();
controller->SetFocusedWindow(source_window());
controller->CompleteCycling();
break;
}
default:
......@@ -475,6 +477,10 @@ class WindowCycleView : public views::WidgetDelegateView,
return mirror_container_->children();
}
const aura::Window* GetTargetWindowForTesting() const {
return target_window_;
}
// ui::ImplicitAnimationObserver:
void OnImplicitAnimationsCompleted() override {
occlusion_tracker_pauser_.reset();
......@@ -809,4 +815,8 @@ const views::View::Views& WindowCycleList::GetWindowCycleItemViewsForTesting()
return cycle_view_->GetPreviewViewsForTesting();
}
const aura::Window* WindowCycleList::GetTargetWindowForTesting() const {
return cycle_view_->GetTargetWindowForTesting();
}
} // namespace ash
......@@ -115,6 +115,9 @@ class ASH_EXPORT WindowCycleList : public aura::WindowObserver,
// Returns the views for the window cycle list.
const views::View::Views& GetWindowCycleItemViewsForTesting() const;
// Returns the window cycle list's target window.
const aura::Window* GetTargetWindowForTesting() const;
WindowCycleView* cycle_view_for_testing() const { return cycle_view_; }
int current_index_for_testing() const { return current_index_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment