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

Unified Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 302113002: Revert use of ABM_GETAUTOHIDEBAREX since apparently it doesn't work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/chrome_views_delegate.cc
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index 2d846924018069daeeb5679c19a57bbb08c3b253..7b01822118f1f011db423ba35f3c51aa59784830 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -84,29 +84,35 @@ PrefService* GetPrefsForWindow(const views::Widget* window) {
}
#if defined(OS_WIN)
-bool MonitorHasTopmostAutohideTaskbarForEdge(UINT edge, const RECT& rect) {
- APPBARDATA taskbar_data = { sizeof(APPBARDATA), NULL, 0, edge, rect };
+bool MonitorHasTopmostAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
+ APPBARDATA taskbar_data = { sizeof(APPBARDATA), NULL, 0, edge };
+ // MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
+ // rect and returns autohide bars on that monitor. This sounds like a good
+ // idea for multi-monitor systems. Unfortunately, it appears to not work at
+ // least some of the time (erroneously returning NULL) and there's almost no
+ // online documentation or other sample code using it that suggests ways to
+ // address this problem. So we just use ABM_GETAUTOHIDEBAR and hope the user
+ // only cares about autohide bars on the monitor with the primary taskbar.
+ //
// NOTE: This call spins a nested message loop.
- HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAREX,
+ HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAR,
&taskbar_data));
return ::IsWindow(taskbar) &&
+ (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONULL) == monitor) &&
(GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST);
}
int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) {
DCHECK(monitor);
- MONITORINFO mi = { sizeof(MONITORINFO) };
- GetMonitorInfo(monitor, &mi);
-
int edges = 0;
- if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, mi.rcMonitor))
+ if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, monitor))
edges |= views::ViewsDelegate::EDGE_LEFT;
- if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, mi.rcMonitor))
+ if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, monitor))
edges |= views::ViewsDelegate::EDGE_TOP;
- if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_RIGHT, mi.rcMonitor))
+ if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_RIGHT, monitor))
edges |= views::ViewsDelegate::EDGE_RIGHT;
- if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, mi.rcMonitor))
+ if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_BOTTOM, monitor))
edges |= views::ViewsDelegate::EDGE_BOTTOM;
return edges;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698