OLD | NEW |
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/gfx/screen_win.h" | 5 #include "ui/gfx/screen_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ScreenWin::~ScreenWin() { | 58 ScreenWin::~ScreenWin() { |
59 } | 59 } |
60 | 60 |
61 bool ScreenWin::IsDIPEnabled() { | 61 bool ScreenWin::IsDIPEnabled() { |
62 return IsInHighDPIMode(); | 62 return IsInHighDPIMode(); |
63 } | 63 } |
64 | 64 |
65 gfx::Point ScreenWin::GetCursorScreenPoint() { | 65 gfx::Point ScreenWin::GetCursorScreenPoint() { |
66 POINT pt; | 66 POINT pt; |
67 GetCursorPos(&pt); | 67 GetCursorPos(&pt); |
68 return gfx::Point(pt); | 68 gfx::Point cursor_pos_pixels(pt); |
| 69 return gfx::win::ScreenToDIPPoint(cursor_pos_pixels); |
69 } | 70 } |
70 | 71 |
71 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { | 72 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { |
72 POINT cursor_loc; | 73 POINT cursor_loc; |
73 HWND hwnd = GetCursorPos(&cursor_loc) ? WindowFromPoint(cursor_loc) : NULL; | 74 HWND hwnd = GetCursorPos(&cursor_loc) ? WindowFromPoint(cursor_loc) : NULL; |
74 return GetNativeWindowFromHWND(hwnd); | 75 return GetNativeWindowFromHWND(hwnd); |
75 } | 76 } |
76 | 77 |
77 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) { | 78 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) { |
78 return GetNativeWindowFromHWND(WindowFromPoint(point.ToPOINT())); | 79 return GetNativeWindowFromHWND(WindowFromPoint(point.ToPOINT())); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 NOTREACHED(); | 150 NOTREACHED(); |
150 return NULL; | 151 return NULL; |
151 } | 152 } |
152 | 153 |
153 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { | 154 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { |
154 NOTREACHED(); | 155 NOTREACHED(); |
155 return NULL; | 156 return NULL; |
156 } | 157 } |
157 | 158 |
158 } // namespace gfx | 159 } // namespace gfx |
OLD | NEW |