diff options
author | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 23:07:43 +0000 |
---|---|---|
committer | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 23:07:43 +0000 |
commit | 0dd07728a31a4ff41fb533e4473c1d313a5c69b4 (patch) | |
tree | 7f55b2f42f50705096ca340875e82f2e44867cdf /ash | |
parent | dfad2604821f9987a17ad405259e9e6dab722f5e (diff) | |
download | chromium_src-0dd07728a31a4ff41fb533e4473c1d313a5c69b4.zip chromium_src-0dd07728a31a4ff41fb533e4473c1d313a5c69b4.tar.gz chromium_src-0dd07728a31a4ff41fb533e4473c1d313a5c69b4.tar.bz2 |
Update window visibility detection for shelf to limit to
windows on the same display.
BUG=180469
Review URL: https://chromiumcodereview.appspot.com/13881005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 3 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager_unittest.cc | 17 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager.cc | 1 |
3 files changed, 14 insertions, 7 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index b26f524..6e9e3c7 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -857,7 +857,8 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( // Process the window list and check if there are any visible windows. for (size_t i = 0; i < windows.size(); ++i) { if (windows[i] && windows[i]->IsVisible() && - !ash::wm::IsWindowMinimized(windows[i])) + !ash::wm::IsWindowMinimized(windows[i]) && + root_window_ == windows[i]->GetRootWindow()) return SHELF_AUTO_HIDE_HIDDEN; } diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 74d88df..30c9220 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -1061,6 +1061,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) { } TEST_F(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) { + UpdateDisplay("800x600,800x600"); ShelfLayoutManager* shelf = GetShelfLayoutManager(); shelf->LayoutShelf(); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); @@ -1074,12 +1075,10 @@ TEST_F(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) { // Window minimized => auto hide disabled. dummy->Minimize(); - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); // Window closed => auto hide disabled. dummy->CloseNow(); - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); // Multiple window test @@ -1087,22 +1086,28 @@ TEST_F(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) { views::Widget* window2 = CreateTestWidget(); // both visible => normal autohide - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); // either minimzed => normal autohide window2->Minimize(); - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); window2->Restore(); window1->Minimize(); - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); // both minimzed => disable auto hide window2->Minimize(); - shelf->UpdateVisibilityState(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); + + // Test moving windows to/from other display. + window2->Restore(); + EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); + // Move to second display. + window2->SetBounds(gfx::Rect(850, 50, 50, 50)); + EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); + // Move back to primary display. + window2->SetBounds(gfx::Rect(50, 50, 50, 50)); + EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); } #if defined(OS_WIN) diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc index 106dbff..2378dd1 100644 --- a/ash/wm/workspace/workspace_manager.cc +++ b/ash/wm/workspace/workspace_manager.cc @@ -688,6 +688,7 @@ void WorkspaceManager::OnWindowRemovedFromWorkspace(Workspace* workspace, Window* child) { if (workspace->ShouldMoveToPending()) MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); + UpdateShelfVisibility(); } void WorkspaceManager::OnWorkspaceChildWindowVisibilityChanged( |