Commit 2aba1b0d authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Do not send bounds change event in minimized state

Changing bounds in minimized state can lead to
bounds change on android side when restored, which
in turn causes delay.

Bug: 889438
Test: covered by unit test
Change-Id: I9f9c2feef9cf468a670bcdb5a729c5877fdca2b6
Reviewed-on: https://chromium-review.googlesource.com/c/1258970
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596526}
parent f96d7cfc
...@@ -539,9 +539,11 @@ void ClientControlledShellSurface::OnBoundsChangeEvent( ...@@ -539,9 +539,11 @@ void ClientControlledShellSurface::OnBoundsChangeEvent(
int64_t display_id, int64_t display_id,
const gfx::Rect& window_bounds, const gfx::Rect& window_bounds,
int bounds_change) { int bounds_change) {
// Do no update the bounds unless we have geometry from client. // 1) Do no update the bounds unless we have geometry from client.
// 2) Do not update the bounds if window is minimized.
// The bounds will be provided by client when unminimized.
if (!geometry().IsEmpty() && !window_bounds.IsEmpty() && if (!geometry().IsEmpty() && !window_bounds.IsEmpty() &&
bounds_changed_callback_) { !widget_->IsMinimized() && bounds_changed_callback_) {
// Sends the client bounds, which matches the geometry // Sends the client bounds, which matches the geometry
// when frame is enabled. // when frame is enabled.
ash::NonClientFrameViewAsh* frame_view = GetFrameView(); ash::NonClientFrameViewAsh* frame_view = GetFrameView();
......
...@@ -1852,4 +1852,38 @@ TEST_F(ClientControlledShellSurfaceTest, MovingPipWindowOffDisplayIsAllowed) { ...@@ -1852,4 +1852,38 @@ TEST_F(ClientControlledShellSurfaceTest, MovingPipWindowOffDisplayIsAllowed) {
shell_surface->GetWidget()->GetWindowBoundsInScreen()); shell_surface->GetWidget()->GetWindowBoundsInScreen());
} }
TEST_F(ClientControlledShellSurfaceDisplayTest,
NoBoundsChangeEventInMinimized) {
gfx::Size buffer_size(100, 100);
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());
shell_surface->SetGeometry(gfx::Rect(0, 0, 100, 100));
surface->Commit();
shell_surface->set_bounds_changed_callback(base::BindRepeating(
&ClientControlledShellSurfaceDisplayTest::OnBoundsChangeEvent,
base::Unretained(this)));
ASSERT_EQ(0, bounds_change_count());
shell_surface->OnBoundsChangeEvent(ash::mojom::WindowStateType::NORMAL,
ash::mojom::WindowStateType::NORMAL, 0,
gfx::Rect(10, 10, 100, 100), 0);
ASSERT_EQ(1, bounds_change_count());
EXPECT_FALSE(shell_surface->GetWidget()->IsMinimized());
shell_surface->SetMinimized();
surface->Commit();
EXPECT_TRUE(shell_surface->GetWidget()->IsMinimized());
shell_surface->OnBoundsChangeEvent(ash::mojom::WindowStateType::MINIMIZED,
ash::mojom::WindowStateType::MINIMIZED, 0,
gfx::Rect(0, 0, 100, 100), 0);
ASSERT_EQ(1, bounds_change_count());
}
} // namespace exo } // 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