Commit 4802a855 authored by miletus's avatar miletus Committed by Commit bot

Force calling PostDisplayConfigurationChange() even if earyling out in UpdateDisplays

When changing from software mirroring mode to sinlge display mode, it
is possible there is no need to update |displays_| and we early out
UpdateDisplays(). But we still want to run the PostDisplayConfigurationChange()
cause there are some clients need to act on this, e.g.
TouchTransformerController needs to adjust the TouchTransformer when
switching from dual displays to single display.

BUG=chrome-os-partner:31868
TEST=tested on Big, after existing software mirroring mode, the touch location
     transformation is still correct.

Review URL: https://codereview.chromium.org/559213002

Cr-Commit-Position: refs/heads/master@{#294481}
parent c283eb03
......@@ -655,7 +655,8 @@ TEST_F(DisplayControllerTest, BoundsUpdated) {
// No change
UpdateDisplay("400x500*2,300x300");
EXPECT_EQ(0, observer.CountAndReset());
// We still call into Pre/PostDisplayConfigurationChange().
EXPECT_EQ(1, observer.CountAndReset());
EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
......
......@@ -884,13 +884,6 @@ void DisplayManager::UpdateDisplays(
scoped_ptr<NonDesktopDisplayUpdater> non_desktop_display_updater(
new NonDesktopDisplayUpdater(this, delegate_));
// Do not update |displays_| if there's nothing to be updated. Without this,
// it will not update the display layout, which causes the bug
// http://crbug.com/155948.
if (display_changes.empty() && added_display_indices.empty() &&
removed_displays.empty()) {
return;
}
// Clear focus if the display has been removed, but don't clear focus if
// the destkop has been moved from one display to another
// (mirror -> docked, docked -> single internal).
......@@ -900,6 +893,22 @@ void DisplayManager::UpdateDisplays(
if (delegate_)
delegate_->PreDisplayConfigurationChange(clear_focus);
// Do not update |displays_| if there's nothing to be updated. Without this,
// it will not update the display layout, which causes the bug
// http://crbug.com/155948.
if (display_changes.empty() && added_display_indices.empty() &&
removed_displays.empty()) {
// When changing from software mirroring mode to sinlge display mode, it
// is possible there is no need to update |displays_| and we early out
// here. But we still want to run the PostDisplayConfigurationChange()
// cause there are some clients need to act on this, e.g.
// TouchTransformerController needs to adjust the TouchTransformer when
// switching from dual displays to single display.
if (delegate_)
delegate_->PostDisplayConfigurationChange();
return;
}
size_t updated_index;
if (UpdateSecondaryDisplayBoundsForLayout(&new_displays, &updated_index) &&
std::find(added_display_indices.begin(),
......
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