Commit f8855f01 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Disable activation for PIP window states.

with it did not activate it.

Bug: b/112629940
Test: Put app into PIP mode, it no longer was activated. Interacting
Change-Id: I88cb307afe5a6aba573c27a5fc9d3f150c430649
Reviewed-on: https://chromium-review.googlesource.com/1175751
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583959}
parent 59de1871
......@@ -875,6 +875,20 @@ void ClientControlledShellSurface::OnPreWidgetCommit() {
break;
}
// PIP windows should not be able to be active.
if (pending_window_state_ == ash::mojom::WindowStateType::PIP) {
auto* window = widget_->GetNativeWindow();
if (wm::IsActiveWindow(window)) {
// In the case that a window changed state into PIP while activated,
// make sure to deactivate it now.
wm::DeactivateWindow(window);
}
widget_->widget_delegate()->set_can_activate(false);
} else {
widget_->widget_delegate()->set_can_activate(true);
}
client_controlled_state_->EnterNextState(window_state, pending_window_state_,
animation_type);
}
......
......@@ -1658,4 +1658,33 @@ TEST_F(ClientControlledShellSurfaceTest, SnappedInTabletMode) {
EXPECT_TRUE(frame_view->GetHeaderView()->in_immersive_mode());
}
TEST_F(ClientControlledShellSurfaceTest, PipWindowCannotBeActivated) {
const gfx::Size buffer_size(256, 256);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
std::unique_ptr<Surface> surface(new Surface());
auto shell_surface =
exo_test_helper()->CreateClientControlledShellSurface(surface.get());
surface->Attach(buffer.get());
surface->Commit();
EXPECT_TRUE(shell_surface->GetWidget()->IsActive());
EXPECT_TRUE(shell_surface->GetWidget()->CanActivate());
// Entering PIP should unactivate the window and make the widget
// unactivatable.
shell_surface->SetPip();
surface->Commit();
EXPECT_FALSE(shell_surface->GetWidget()->IsActive());
EXPECT_FALSE(shell_surface->GetWidget()->CanActivate());
// Leaving PIP should make it activatable again.
shell_surface->SetRestored();
surface->Commit();
EXPECT_TRUE(shell_surface->GetWidget()->CanActivate());
}
} // namespace exo
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