Commit f983cd51 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

views: makes show from server not also activate

If the server shows a window, views was also activating the window. Instead
views should just show the window. If the server wants the window active, it'll
activate the window.

BUG=756085
TEST=covered by test

Change-Id: I208945a61d8c96b5dba0a070d7f32f6536342f28
Reviewed-on: https://chromium-review.googlesource.com/c/1330710Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607027}
parent 69d0307e
......@@ -1021,7 +1021,10 @@ void DesktopWindowTreeHostMus::OnWindowPropertyChanged(aura::Window* window,
}
void DesktopWindowTreeHostMus::ShowImpl() {
Show(ui::SHOW_STATE_NORMAL, gfx::Rect());
// This code path is hit when the server initiated the change. In such a case
// the window should not be made active. If the server wants the window to be
// active, it will make the window active.
Show(ui::SHOW_STATE_INACTIVE, gfx::Rect());
}
void DesktopWindowTreeHostMus::HideImpl() {
......
......@@ -766,4 +766,15 @@ TEST_F(DesktopWindowTreeHostMusTest, WindowMoveShouldNotTransfersBack) {
EXPECT_EQ(2, counter.GetTotalCount());
}
TEST_F(DesktopWindowTreeHostMusTest, ShowWindowFromServerDoesntActivate) {
std::unique_ptr<Widget> widget(CreateWidget());
// This simulates what happens when a show happens from the server.
widget->GetNativeWindow()->GetHost()->Show();
EXPECT_TRUE(widget->IsVisible());
// The window should not be active yet.
EXPECT_FALSE(widget->GetNativeWindow()->HasFocus());
EXPECT_FALSE(widget->IsActive());
}
} // namespace views
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