Commit 3bddafc6 authored by sky's avatar sky Committed by Commit bot

Makes mus not bring window to front on activation changes

The window manager should be doing it. To do otherwise means mus is
likely conflicting with the wm. Additionally changing the activation
as we were meant clients weren't getting notified and got out of sync
with mus.

BUG=652421
TEST=covered by tests
R=msw@chromium.org

Review-Url: https://codereview.chromium.org/2391853002
Cr-Commit-Position: refs/heads/master@{#422652}
parent 9f31b776
...@@ -886,7 +886,6 @@ void Window::ReorderWithoutNotification(Window* window, ...@@ -886,7 +886,6 @@ void Window::ReorderWithoutNotification(Window* window,
} }
// static // static
// Returns true if the order actually changed.
bool Window::ReorderImpl(Window* window, bool Window::ReorderImpl(Window* window,
Window* relative, Window* relative,
mojom::OrderDirection direction, mojom::OrderDirection direction,
......
...@@ -332,6 +332,7 @@ class Window { ...@@ -332,6 +332,7 @@ class Window {
static void ReorderWithoutNotification(Window* window, static void ReorderWithoutNotification(Window* window,
Window* relative, Window* relative,
mojom::OrderDirection direction); mojom::OrderDirection direction);
// Returns true if the order actually changed.
static bool ReorderImpl(Window* window, static bool ReorderImpl(Window* window,
Window* relative, Window* relative,
mojom::OrderDirection direction, mojom::OrderDirection direction,
......
...@@ -351,12 +351,9 @@ bool Display::CanHaveActiveChildren(ServerWindow* window) const { ...@@ -351,12 +351,9 @@ bool Display::CanHaveActiveChildren(ServerWindow* window) const {
void Display::OnActivationChanged(ServerWindow* old_active_window, void Display::OnActivationChanged(ServerWindow* old_active_window,
ServerWindow* new_active_window) { ServerWindow* new_active_window) {
DCHECK_NE(new_active_window, old_active_window); // Don't do anything here. We assume the window manager handles restacking. If
if (new_active_window && new_active_window->parent()) { // we did attempt to restack than we would have to ensure clients see the
// Raise the new active window. // restack.
// TODO(sad): Let the WM dictate whether to raise the window or not?
new_active_window->parent()->StackChildAtTop(new_active_window);
}
} }
void Display::OnFocusChanged(FocusControllerChangeSource change_source, void Display::OnFocusChanged(FocusControllerChangeSource change_source,
......
...@@ -861,15 +861,13 @@ TEST_F(WindowServerTest, Activation) { ...@@ -861,15 +861,13 @@ TEST_F(WindowServerTest, Activation) {
WaitForTreeSizeToMatch(parent, 6); WaitForTreeSizeToMatch(parent, 6);
// |child2| and |child3| are stacked about |child1|. EXPECT_EQ(0, ValidIndexOf(parent->children(), child1));
EXPECT_GT(ValidIndexOf(parent->children(), child2), // NOTE: |child3| is after |child1| as |child3| is a transient child of
ValidIndexOf(parent->children(), child1)); // |child1|.
EXPECT_GT(ValidIndexOf(parent->children(), child3), EXPECT_EQ(1, ValidIndexOf(parent->children(), child3));
ValidIndexOf(parent->children(), child1)); EXPECT_EQ(2, ValidIndexOf(parent->children(), child2));
// Set focus on |child11|. This should activate |child1|, and raise it over // Set focus on |child11|, order of windows should not change.
// |child2|. But |child3| should still be above |child1| because of
// transiency.
child11->SetFocus(); child11->SetFocus();
ASSERT_TRUE(WaitForWindowToHaveFocus(child11)); ASSERT_TRUE(WaitForWindowToHaveFocus(child11));
ASSERT_TRUE(WaitForWindowToHaveFocus( ASSERT_TRUE(WaitForWindowToHaveFocus(
...@@ -878,13 +876,12 @@ TEST_F(WindowServerTest, Activation) { ...@@ -878,13 +876,12 @@ TEST_F(WindowServerTest, Activation) {
server_id(window_manager()->GetFocusedWindow())); server_id(window_manager()->GetFocusedWindow()));
EXPECT_EQ(server_id(child11), server_id(embedded1->GetFocusedWindow())); EXPECT_EQ(server_id(child11), server_id(embedded1->GetFocusedWindow()));
EXPECT_EQ(nullptr, embedded2->GetFocusedWindow()); EXPECT_EQ(nullptr, embedded2->GetFocusedWindow());
EXPECT_GT(ValidIndexOf(parent->children(), child1), EXPECT_EQ(0, ValidIndexOf(parent->children(), child1));
ValidIndexOf(parent->children(), child2)); EXPECT_EQ(1, ValidIndexOf(parent->children(), child3));
EXPECT_GT(ValidIndexOf(parent->children(), child3), EXPECT_EQ(2, ValidIndexOf(parent->children(), child2));
ValidIndexOf(parent->children(), child1));
// Set focus on |child21|. This should activate |child2|, and raise it over // Set focus on |child21|. This should activate |child2|. Again, order should
// |child1|. // not change.
child21->SetFocus(); child21->SetFocus();
ASSERT_TRUE(WaitForWindowToHaveFocus(child21)); ASSERT_TRUE(WaitForWindowToHaveFocus(child21));
ASSERT_TRUE(WaitForWindowToHaveFocus( ASSERT_TRUE(WaitForWindowToHaveFocus(
...@@ -894,10 +891,9 @@ TEST_F(WindowServerTest, Activation) { ...@@ -894,10 +891,9 @@ TEST_F(WindowServerTest, Activation) {
EXPECT_EQ(server_id(child21), server_id(embedded2->GetFocusedWindow())); EXPECT_EQ(server_id(child21), server_id(embedded2->GetFocusedWindow()));
EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1)); EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1));
EXPECT_EQ(nullptr, embedded1->GetFocusedWindow()); EXPECT_EQ(nullptr, embedded1->GetFocusedWindow());
EXPECT_GT(ValidIndexOf(parent->children(), child2), EXPECT_EQ(0, ValidIndexOf(parent->children(), child1));
ValidIndexOf(parent->children(), child1)); EXPECT_EQ(1, ValidIndexOf(parent->children(), child3));
EXPECT_GT(ValidIndexOf(parent->children(), child3), EXPECT_EQ(2, ValidIndexOf(parent->children(), child2));
ValidIndexOf(parent->children(), child1));
} }
TEST_F(WindowServerTest, ActivationNext) { TEST_F(WindowServerTest, ActivationNext) {
...@@ -918,13 +914,11 @@ TEST_F(WindowServerTest, ActivationNext) { ...@@ -918,13 +914,11 @@ TEST_F(WindowServerTest, ActivationNext) {
Window* child31 = NewVisibleWindow(GetFirstRoot(embedded3), embedded3); Window* child31 = NewVisibleWindow(GetFirstRoot(embedded3), embedded3);
WaitForTreeSizeToMatch(parent, 7); WaitForTreeSizeToMatch(parent, 7);
Window* expecteds[] = { child3, child2, child1, child3, nullptr };
Window* focused[] = { child31, child21, child11, child31, nullptr }; Window* focused[] = { child31, child21, child11, child31, nullptr };
for (size_t index = 0; expecteds[index]; ++index) { for (size_t index = 0; focused[index]; ++index) {
window_manager_client()->ActivateNextWindow(); window_manager_client()->ActivateNextWindow();
WaitForWindowToHaveFocus(focused[index]); WaitForWindowToHaveFocus(focused[index]);
EXPECT_TRUE(focused[index]->HasFocus()); EXPECT_TRUE(focused[index]->HasFocus());
EXPECT_EQ(parent->children().back(), expecteds[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