OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
882 } | 882 } |
883 | 883 |
884 scoped_ptr<NonDesktopDisplayUpdater> non_desktop_display_updater( | 884 scoped_ptr<NonDesktopDisplayUpdater> non_desktop_display_updater( |
885 new NonDesktopDisplayUpdater(this, delegate_)); | 885 new NonDesktopDisplayUpdater(this, delegate_)); |
886 | 886 |
887 // Do not update |displays_| if there's nothing to be updated. Without this, | 887 // Do not update |displays_| if there's nothing to be updated. Without this, |
888 // it will not update the display layout, which causes the bug | 888 // it will not update the display layout, which causes the bug |
889 // http://crbug.com/155948. | 889 // http://crbug.com/155948. |
890 if (display_changes.empty() && added_display_indices.empty() && | 890 if (display_changes.empty() && added_display_indices.empty() && |
891 removed_displays.empty()) { | 891 removed_displays.empty()) { |
892 // When changing from software mirroring mode to sinlge display mode, it | |
893 // is possible there is no need to update |displays_| and we early out | |
894 // here. But we still want to run the PostDisplayConfigurationChange() | |
895 // cause there are some clients need to act on this, e.g. | |
896 // TouchTransformerController needs to adjust the TouchTransformer when | |
897 // switching from dual displays to single display. | |
898 if (delegate_) | |
Yufeng Shen (Slow to review)
2014/09/11 16:24:02
hmmm, DisplayControllerTest catches this that we m
oshima
2014/09/11 17:19:08
Yes, it has to be paired. You can move the PreDisp
Yufeng Shen (Slow to review)
2014/09/11 18:25:49
Done.
| |
899 delegate_->PostDisplayConfigurationChange(); | |
892 return; | 900 return; |
893 } | 901 } |
894 // Clear focus if the display has been removed, but don't clear focus if | 902 // Clear focus if the display has been removed, but don't clear focus if |
895 // the destkop has been moved from one display to another | 903 // the destkop has been moved from one display to another |
896 // (mirror -> docked, docked -> single internal). | 904 // (mirror -> docked, docked -> single internal). |
897 bool clear_focus = | 905 bool clear_focus = |
898 !removed_displays.empty() && | 906 !removed_displays.empty() && |
899 !(removed_displays.size() == 1 && added_display_indices.size() == 1); | 907 !(removed_displays.size() == 1 && added_display_indices.size() == 1); |
900 if (delegate_) | 908 if (delegate_) |
901 delegate_->PreDisplayConfigurationChange(clear_focus); | 909 delegate_->PreDisplayConfigurationChange(clear_focus); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1267 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
1260 break; | 1268 break; |
1261 } | 1269 } |
1262 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1270 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
1263 secondary_display->set_bounds( | 1271 secondary_display->set_bounds( |
1264 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1272 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
1265 secondary_display->UpdateWorkAreaFromInsets(insets); | 1273 secondary_display->UpdateWorkAreaFromInsets(insets); |
1266 } | 1274 } |
1267 | 1275 |
1268 } // namespace ash | 1276 } // namespace ash |
OLD | NEW |