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 |
} |