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

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: 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
« ash/display/display_manager.h ('K') | « ash/display/display_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 476815b2e2b54d0a2e1f19f23344ce24f4ce7221..9e577a1ab98ad624ff086b4df027b8720baa9a8e 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% for each edge.
+ int width = display.bounds().width() / 20;
+ int height = display.bounds().height() / 20;
+ return gfx::Insets(height, width, height, width);
oshima 2013/01/12 02:06:38 Is 5% good assumption? Isn't it better to just le
Jun Mukai 2013/01/14 18:18:51 No info, there's only a bool flag and marcheu sugg
+}
+
} // 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].overscan_insets_specified = 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.overscan && !info->second.overscan_insets_specified)
+ 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(
@@ -420,7 +431,7 @@ void DisplayManager::Init() {
}
#endif
- RefreshDisplayNames();
+ RefreshDisplayInfo();
#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN8)
@@ -546,7 +557,11 @@ void DisplayManager::EnsurePointerInDisplays() {
root_window->MoveCursorTo(target_location);
}
-void DisplayManager::RefreshDisplayNames() {
+DisplayManager::DisplayInfo::DisplayInfo()
+ : overscan(false), overscan_insets_specified(false) {
oshima 2013/01/12 02:06:38 one argument per line (I think)
Jun Mukai 2013/01/14 18:18:51 Done.
+}
+
+void DisplayManager::RefreshDisplayInfo() {
#if defined(OS_CHROMEOS)
if (!base::chromeos::IsRunningOnChromeOS())
return;
@@ -570,6 +585,11 @@ void DisplayManager::RefreshDisplayNames() {
} else if (!name.empty()) {
display_info_[id].name = name;
}
+
+ bool overscan = false;
+ if (ui::GetOutputOverscanFlag(outputs[i], &overscan)) {
+ display_info_[id].overscan = true;
+ }
oshima 2013/01/12 02:06:38 the code looks a bit odd. Won't ui::GetOutputOve
Jun Mukai 2013/01/14 18:18:51 Done.
}
#endif
}
« ash/display/display_manager.h ('K') | « ash/display/display_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698