Commit 68e0e1a9 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Enable autohide frame in Snapped ClientControlledShellSurface

Bug: 869429
Test: covered by unittest
Change-Id: I192d74e0dd467238af2bf0db7e7e37b5df69ed81
Reviewed-on: https://chromium-review.googlesource.com/1156881Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580007}
parent 8a49de16
......@@ -448,7 +448,8 @@ void ClientControlledShellSurface::SetCanMaximize(bool can_maximize) {
void ClientControlledShellSurface::UpdateAutoHideFrame() {
if (immersive_fullscreen_controller_) {
bool enabled = (frame_type_ == SurfaceFrameType::AUTOHIDE &&
GetWindowState()->IsMaximizedOrFullscreenOrPinned());
(GetWindowState()->IsMaximizedOrFullscreenOrPinned() ||
GetWindowState()->IsSnapped()));
immersive_fullscreen_controller_->SetEnabled(
ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, enabled);
}
......
......@@ -1490,4 +1490,32 @@ TEST_F(ClientControlledShellSurfaceTest, AdjustBoundsLocally) {
EXPECT_EQ(gfx::Rect(774, 0, 200, 300), requested_bounds);
}
TEST_F(ClientControlledShellSurfaceTest, SnappedInTabletMode) {
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();
shell_surface->GetWidget()->Show();
auto* window = shell_surface->GetWidget()->GetNativeWindow();
auto* window_state = ash::wm::GetWindowState(window);
EnableTabletMode(true);
ash::wm::WMEvent event(ash::wm::WM_EVENT_SNAP_LEFT);
window_state->OnWMEvent(&event);
EXPECT_EQ(window_state->GetStateType(),
ash::mojom::WindowStateType::LEFT_SNAPPED);
ash::CustomFrameViewAsh* frame_view = static_cast<ash::CustomFrameViewAsh*>(
shell_surface->GetWidget()->non_client_view()->frame_view());
// Snapped window can also use auto hide.
surface->SetFrame(SurfaceFrameType::AUTOHIDE);
EXPECT_TRUE(frame_view->visible());
EXPECT_TRUE(frame_view->GetHeaderView()->in_immersive_mode());
}
} // 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