Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Side by Side Diff: ui/display/manager/display_manager.cc

Issue 2792733002: Display: dectect changes to mirror mode and send a notification. (Closed)
Patch Set: Fix test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/display/manager/display_manager.h" 5 #include "ui/display/manager/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 const Display& updated_display = active_display_list_[iter->first]; 815 const Display& updated_display = active_display_list_[iter->first];
816 816
817 if (notify_primary_change && 817 if (notify_primary_change &&
818 updated_display.id() == screen_->GetPrimaryDisplay().id()) { 818 updated_display.id() == screen_->GetPrimaryDisplay().id()) {
819 metrics |= DisplayObserver::DISPLAY_METRIC_PRIMARY; 819 metrics |= DisplayObserver::DISPLAY_METRIC_PRIMARY;
820 notify_primary_change = false; 820 notify_primary_change = false;
821 } 821 }
822 NotifyMetricsChanged(updated_display, metrics); 822 NotifyMetricsChanged(updated_display, metrics);
823 } 823 }
824 824
825 uint32_t primary_metrics = 0;
826
825 if (notify_primary_change) { 827 if (notify_primary_change) {
826 // This happens when a primary display has moved to anther display without 828 // This happens when a primary display has moved to anther display without
827 // bounds change. 829 // bounds change.
828 const Display& primary = screen_->GetPrimaryDisplay(); 830 const Display& primary = screen_->GetPrimaryDisplay();
829 if (primary.id() != old_primary.id()) { 831 if (primary.id() != old_primary.id()) {
830 uint32_t metrics = DisplayObserver::DISPLAY_METRIC_PRIMARY; 832 primary_metrics = DisplayObserver::DISPLAY_METRIC_PRIMARY;
831 if (primary.size() != old_primary.size()) { 833 if (primary.size() != old_primary.size()) {
832 metrics |= (DisplayObserver::DISPLAY_METRIC_BOUNDS | 834 primary_metrics |= (DisplayObserver::DISPLAY_METRIC_BOUNDS |
833 DisplayObserver::DISPLAY_METRIC_WORK_AREA); 835 DisplayObserver::DISPLAY_METRIC_WORK_AREA);
834 } 836 }
835 if (primary.device_scale_factor() != old_primary.device_scale_factor()) 837 if (primary.device_scale_factor() != old_primary.device_scale_factor())
836 metrics |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR; 838 primary_metrics |= DisplayObserver::DISPLAY_METRIC_DEVICE_SCALE_FACTOR;
837
838 NotifyMetricsChanged(primary, metrics);
839 } 839 }
840 } 840 }
841 841
842 bool mirror_mode = IsInMirrorMode();
843 if (mirror_mode != mirror_mode_for_metrics_) {
844 primary_metrics |= DisplayObserver::DISPLAY_METRIC_MIRROR_STATE;
845 mirror_mode_for_metrics_ = mirror_mode;
846 }
847
848 if (delegate_ && primary_metrics)
849 NotifyMetricsChanged(screen_->GetPrimaryDisplay(), primary_metrics);
850
842 bool must_clear_window = false; 851 bool must_clear_window = false;
843 #if defined(USE_X11) && defined(OS_CHROMEOS) 852 #if defined(USE_X11) && defined(OS_CHROMEOS)
844 must_clear_window = 853 must_clear_window =
845 !display_changes.empty() && base::SysInfo::IsRunningOnChromeOS(); 854 !display_changes.empty() && base::SysInfo::IsRunningOnChromeOS();
846 #endif 855 #endif
847 856
848 if (delegate_) 857 if (delegate_)
849 delegate_->PostDisplayConfigurationChange(must_clear_window); 858 delegate_->PostDisplayConfigurationChange(must_clear_window);
850 859
851 // Create the mirroring window asynchronously after all displays 860 // Create the mirroring window asynchronously after all displays
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1465 }
1457 1466
1458 const Display& DisplayManager::GetSecondaryDisplay() const { 1467 const Display& DisplayManager::GetSecondaryDisplay() const {
1459 CHECK_LE(2U, GetNumDisplays()); 1468 CHECK_LE(2U, GetNumDisplays());
1460 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() 1469 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
1461 ? GetDisplayAt(1) 1470 ? GetDisplayAt(1)
1462 : GetDisplayAt(0); 1471 : GetDisplayAt(0);
1463 } 1472 }
1464 1473
1465 } // namespace display 1474 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698