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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 1735743002: Use the MonitorFromPoint API for the cursor position to cover cases where the MonitorFromWindow API… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return false; 119 return false;
120 120
121 taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL); 121 taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL);
122 if (!::IsWindow(taskbar_data.hWnd)) 122 if (!::IsWindow(taskbar_data.hWnd))
123 return false; 123 return false;
124 124
125 SHAppBarMessage(ABM_GETTASKBARPOS, &taskbar_data); 125 SHAppBarMessage(ABM_GETTASKBARPOS, &taskbar_data);
126 if (taskbar_data.uEdge == edge) 126 if (taskbar_data.uEdge == edge)
127 taskbar = taskbar_data.hWnd; 127 taskbar = taskbar_data.hWnd;
128 } 128 }
129 return ::IsWindow(taskbar) && 129
130 (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONULL) == monitor) && 130 if (::IsWindow(taskbar) &&
131 (GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST); 131 (GetWindowLong(taskbar, GWL_EXSTYLE) & WS_EX_TOPMOST)) {
132 if (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONEAREST) == monitor)
133 return true;
134 // In some cases like when the autohide taskbar is on the left of the
135 // secondary monitor, the MonitorFromWindow call above fails to return the
136 // correct monitor the taskbar is on. We fallback to MonitorFromPoint for
137 // the cursor position in that case, which seems to work well.
138 POINT cursor_pos = {0};
139 GetCursorPos(&cursor_pos);
140 if (MonitorFromPoint(cursor_pos, MONITOR_DEFAULTTONEAREST) == monitor)
141 return true;
142 }
143 return false;
132 } 144 }
133 145
134 int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) { 146 int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) {
135 DCHECK(monitor); 147 DCHECK(monitor);
136 148
137 int edges = 0; 149 int edges = 0;
138 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, monitor)) 150 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_LEFT, monitor))
139 edges |= views::ViewsDelegate::EDGE_LEFT; 151 edges |= views::ViewsDelegate::EDGE_LEFT;
140 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, monitor)) 152 if (MonitorHasTopmostAutohideTaskbarForEdge(ABE_TOP, monitor))
141 edges |= views::ViewsDelegate::EDGE_TOP; 153 edges |= views::ViewsDelegate::EDGE_TOP;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return content::BrowserThread::GetBlockingPool(); 505 return content::BrowserThread::GetBlockingPool();
494 } 506 }
495 507
496 #if !defined(USE_ASH) 508 #if !defined(USE_ASH)
497 views::Widget::InitParams::WindowOpacity 509 views::Widget::InitParams::WindowOpacity
498 ChromeViewsDelegate::GetOpacityForInitParams( 510 ChromeViewsDelegate::GetOpacityForInitParams(
499 const views::Widget::InitParams& params) { 511 const views::Widget::InitParams& params) {
500 return views::Widget::InitParams::OPAQUE_WINDOW; 512 return views::Widget::InitParams::OPAQUE_WINDOW;
501 } 513 }
502 #endif 514 #endif
OLDNEW
« 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