summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/panels/display_settings_provider.cc
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 00:12:07 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 00:12:07 +0000
commitdb897a0054079a125d89a554c1572fc67ab3321a (patch)
treefefa3405b58237820ab31cc6ec0856d9066b7a87 /chrome/browser/ui/panels/display_settings_provider.cc
parent46dc34813419724a9e5f8b9be60703ddcbb04bb4 (diff)
downloadchromium_src-db897a0054079a125d89a554c1572fc67ab3321a.zip
chromium_src-db897a0054079a125d89a554c1572fc67ab3321a.tar.gz
chromium_src-db897a0054079a125d89a554c1572fc67ab3321a.tar.bz2
Fix bug 105565: Panels should adjust max size and full size if display changes
Changes in this patch: 1) We use same max size for both docked and detach panels. 2) When work area gets changed, we update max size, full size and current size if needed. 2.1) If the panel has not been user-resized, max size is propotional to the work area and will get updated when work area changes. 2.2) If the panel has been user-resized, max size will be kept as long as it does not exceed the work area size. BUG=105565 TEST=New tests plus manual test by changing screen resolution and verifying panel sizes. Review URL: https://chromiumcodereview.appspot.com/10356007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/panels/display_settings_provider.cc')
-rw-r--r--chrome/browser/ui/panels/display_settings_provider.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/ui/panels/display_settings_provider.cc b/chrome/browser/ui/panels/display_settings_provider.cc
index 61f7709..f6b538a 100644
--- a/chrome/browser/ui/panels/display_settings_provider.cc
+++ b/chrome/browser/ui/panels/display_settings_provider.cc
@@ -71,8 +71,18 @@ gfx::Rect DisplaySettingsProvider::GetDisplayArea() {
gfx::Rect DisplaySettingsProvider::GetWorkArea() const {
#if defined(OS_MACOSX)
// On OSX, panels should be dropped all the way to the bottom edge of the
- // screen (and overlap Dock).
- gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().bounds();
+ // screen (and overlap Dock). And we also want to exclude the system menu
+ // area. Note that the rect returned from gfx::Screen util functions is in
+ // platform-independent screen coordinates with (0, 0) as the top-left corner.
+ gfx::Monitor monitor = gfx::Screen::GetPrimaryMonitor();
+ gfx::Rect monitor_area = monitor.bounds();
+ gfx::Rect work_area = monitor.work_area();
+ int system_menu_height = work_area.y() - monitor_area.y();
+ if (system_menu_height > 0) {
+ monitor_area.set_y(monitor_area.y() + system_menu_height);
+ monitor_area.set_height(monitor_area.height() - system_menu_height);
+ }
+ return monitor_area;
#else
gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area();
#endif