Commit f8f8f958 authored by David Reveman's avatar David Reveman Committed by Commit Bot

exo: Prevent transient windows from being minimized.

It should not be possible to minimize transient dialog windows.
These windows typically disable input for the parent and minimizing
them and leaving the parent in a disabled state can be very confusing.

Bug: 821498
Test: exo_unittest --gtest_filter=ShellSurface.Minimum
Change-Id: I288b57a4b36f61d6ae0d491796ba45d8c9e44686
Reviewed-on: https://chromium-review.googlesource.com/1027890
Commit-Queue: David Reveman <reveman@chromium.org>
Reviewed-by: default avatarKristian H. Kristensen <hoegsberg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553523}
parent f0e11293
......@@ -905,7 +905,8 @@ bool ShellSurfaceBase::CanMaximize() const {
}
bool ShellSurfaceBase::CanMinimize() const {
return can_minimize_;
// Non-transient shell surfaces can be minimized.
return !parent_ && can_minimize_;
}
base::string16 ShellSurfaceBase::GetWindowTitle() const {
......
......@@ -170,6 +170,8 @@ TEST_F(ShellSurfaceTest, Minimize) {
std::unique_ptr<Surface> surface(new Surface);
std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
EXPECT_TRUE(shell_surface->CanMinimize());
// Minimizing can be performed before the surface is committed.
shell_surface->Minimize();
EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized());
......@@ -182,8 +184,15 @@ TEST_F(ShellSurfaceTest, Minimize) {
shell_surface->Restore();
EXPECT_FALSE(shell_surface->GetWidget()->IsMinimized());
shell_surface->Minimize();
EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized());
std::unique_ptr<Surface> child_surface(new Surface);
std::unique_ptr<ShellSurface> child_shell_surface(
new ShellSurface(child_surface.get()));
// Transient shell surfaces cannot be minimized.
child_surface->SetParent(surface.get(), gfx::Point());
child_surface->Attach(buffer.get());
child_surface->Commit();
EXPECT_FALSE(child_shell_surface->CanMinimize());
}
TEST_F(ShellSurfaceTest, Restore) {
......
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