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

Side by Side Diff: ui/display/win/screen_win.cc

Issue 1935083003: gfx::Screen: Replace GetWindowUnderCursor() with IsWindowUnderCursor(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Null checks Created 4 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 unified diff | Download patch
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 "ui/display/win/screen_win.h" 5 #include "ui/display/win/screen_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return nullptr; 154 return nullptr;
155 } 155 }
156 156
157 gfx::Point ScreenWin::GetCursorScreenPoint() { 157 gfx::Point ScreenWin::GetCursorScreenPoint() {
158 POINT pt; 158 POINT pt;
159 ::GetCursorPos(&pt); 159 ::GetCursorPos(&pt);
160 gfx::Point cursor_pos_pixels(pt); 160 gfx::Point cursor_pos_pixels(pt);
161 return ScreenToDIPPoint(cursor_pos_pixels); 161 return ScreenToDIPPoint(cursor_pos_pixels);
162 } 162 }
163 163
164 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { 164 bool ScreenWin::IsWindowUnderCursor(gfx::NativeWindow window) {
165 POINT cursor_loc; 165 POINT cursor_loc;
166 HWND hwnd = 166 HWND hwnd =
167 ::GetCursorPos(&cursor_loc) ? ::WindowFromPoint(cursor_loc) : nullptr; 167 ::GetCursorPos(&cursor_loc) ? ::WindowFromPoint(cursor_loc) : nullptr;
168 return GetNativeWindowFromHWND(hwnd); 168 return GetNativeWindowFromHWND(hwnd) == window;
169 } 169 }
170 170
171 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) { 171 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) {
172 gfx::Point point_in_pixels = DIPToScreenPoint(point); 172 gfx::Point point_in_pixels = DIPToScreenPoint(point);
173 return GetNativeWindowFromHWND(WindowFromPoint(point_in_pixels.ToPOINT())); 173 return GetNativeWindowFromHWND(WindowFromPoint(point_in_pixels.ToPOINT()));
174 } 174 }
175 175
176 int ScreenWin::GetNumDisplays() const { 176 int ScreenWin::GetNumDisplays() const {
177 return static_cast<int>(screen_win_displays_.size()); 177 return static_cast<int>(screen_win_displays_.size());
178 } 178 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 // There is 1:1 correspondence between MONITORINFOEX and ScreenWinDisplay. 305 // There is 1:1 correspondence between MONITORINFOEX and ScreenWinDisplay.
306 // If we make it here, it means we have no displays and we should hand out the 306 // If we make it here, it means we have no displays and we should hand out the
307 // default display. 307 // default display.
308 DCHECK_EQ(screen_win_displays_.size(), 0u); 308 DCHECK_EQ(screen_win_displays_.size(), 0u);
309 return ScreenWinDisplay(); 309 return ScreenWinDisplay();
310 } 310 }
311 311
312 } // namespace win 312 } // namespace win
313 } // namespace display 313 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/win/screen_win.h ('k') | ui/gfx/screen.h » ('j') | ui/views/mus/screen_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698