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

Unified Diff: ash/display/display_manager.cc

Issue 11818008: Automatically set the overscan insets if the output has the flag and no preference is set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix / add test Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 64f7e4687731cdb09b245e08dba7ecfa7b7c3075..4284ef4d25c7c55a2e7a6c762412b0155b82df71 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -72,6 +72,13 @@ int64 GetDisplayIdForOutput(XID output) {
}
#endif
+gfx::Insets GetDefaultDisplayOverscan(const gfx::Display& display) {
+ // Currently we assume 5% overscan and hope for the best.
oshima 2013/01/15 23:26:51 add " if TV claims it overscan, but doesn't expose
Jun Mukai 2013/01/15 23:43:57 Done.
+ int width = display.bounds().width() / 40;
+ int height = display.bounds().height() / 40;
+ return gfx::Insets(height, width, height, width);
+}
+
} // namespace
using aura::RootWindow;
@@ -146,6 +153,7 @@ const gfx::Display& DisplayManager::FindDisplayContainingPoint(
void DisplayManager::SetOverscanInsets(int64 display_id,
const gfx::Insets& insets_in_dip) {
display_info_[display_id].overscan_insets_in_dip = insets_in_dip;
+ display_info_[display_id].has_custom_overscan_insets = true;
// Copies the |displays_| because UpdateDisplays() compares the passed
// displays and its internal |displays_|.
@@ -201,12 +209,16 @@ void DisplayManager::OnNativeDisplaysChanged(
new_displays = updated_displays;
}
+ RefreshDisplayInfo();
+
for (DisplayList::const_iterator iter = new_displays.begin();
iter != new_displays.end(); ++iter) {
std::map<int64, DisplayInfo>::iterator info =
display_info_.find(iter->id());
if (info != display_info_.end()) {
info->second.original_bounds_in_pixel = iter->bounds_in_pixel();
+ if (info->second.has_overscan && !info->second.has_custom_overscan_insets)
+ info->second.overscan_insets_in_dip = GetDefaultDisplayOverscan(*iter);
} else {
display_info_[iter->id()].original_bounds_in_pixel =
iter->bounds_in_pixel();
@@ -214,7 +226,6 @@ void DisplayManager::OnNativeDisplaysChanged(
}
UpdateDisplays(new_displays);
- RefreshDisplayNames();
}
void DisplayManager::UpdateDisplays(
@@ -424,7 +435,7 @@ void DisplayManager::Init() {
}
#endif
- RefreshDisplayNames();
+ RefreshDisplayInfo();
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN8)
@@ -550,7 +561,12 @@ void DisplayManager::EnsurePointerInDisplays() {
root_window->MoveCursorTo(target_location);
}
-void DisplayManager::RefreshDisplayNames() {
+DisplayManager::DisplayInfo::DisplayInfo()
+ : has_overscan(false),
+ has_custom_overscan_insets(false) {
+}
+
+void DisplayManager::RefreshDisplayInfo() {
#if defined(OS_CHROMEOS)
if (!base::chromeos::IsRunningOnChromeOS())
return;
@@ -574,6 +590,8 @@ void DisplayManager::RefreshDisplayNames() {
} else if (!name.empty()) {
display_info_[id].name = name;
}
+
+ ui::GetOutputOverscanFlag(outputs[i], &display_info_[id].has_overscan);
}
#endif
}
@@ -587,5 +605,9 @@ void DisplayManager::SetDisplayIdsForTest(DisplayList* to_update) const {
}
}
+void DisplayManager::SetHasOverscanFlagForTest(int64 id, bool has_overscan) {
+ display_info_[id].has_overscan = has_overscan;
+}
+
} // namespace internal
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698