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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/base/win/dpi.h" |
10 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) { | 15 MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) { |
15 MONITORINFO monitor_info = { 0 }; | 16 MONITORINFO monitor_info = { 0 }; |
16 monitor_info.cbSize = sizeof(monitor_info); | 17 monitor_info.cbSize = sizeof(monitor_info); |
17 GetMonitorInfo(monitor, &monitor_info); | 18 GetMonitorInfo(monitor, &monitor_info); |
18 return monitor_info; | 19 return monitor_info; |
19 } | 20 } |
(...skipping 19 matching lines...) Expand all Loading... |
39 #if defined(ENABLE_HIDPI) | 40 #if defined(ENABLE_HIDPI) |
40 return true; | 41 return true; |
41 #else | 42 #else |
42 return false; | 43 return false; |
43 #endif | 44 #endif |
44 } | 45 } |
45 | 46 |
46 gfx::Point ScreenWin::GetCursorScreenPoint() { | 47 gfx::Point ScreenWin::GetCursorScreenPoint() { |
47 POINT pt; | 48 POINT pt; |
48 GetCursorPos(&pt); | 49 GetCursorPos(&pt); |
| 50 if (IsDIPEnabled()) { |
| 51 static float os_scale = ui::GetDPIScale(); |
| 52 pt.x *= os_scale; |
| 53 pt.y *= os_scale; |
| 54 } |
49 return gfx::Point(pt); | 55 return gfx::Point(pt); |
50 } | 56 } |
51 | 57 |
52 gfx::NativeWindow ScreenWin::GetWindowAtCursorScreenPoint() { | 58 gfx::NativeWindow ScreenWin::GetWindowAtCursorScreenPoint() { |
53 POINT location; | 59 POINT location; |
54 HWND window_hwnd = GetCursorPos(&location) ? WindowFromPoint(location) : NULL; | 60 HWND window_hwnd = GetCursorPos(&location) ? WindowFromPoint(location) : NULL; |
55 return GetNativeWindowFromHWND(window_hwnd); | 61 return GetNativeWindowFromHWND(window_hwnd); |
56 } | 62 } |
57 | 63 |
58 int ScreenWin::GetNumDisplays() { | 64 int ScreenWin::GetNumDisplays() { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #endif // USE_AURA | 137 #endif // USE_AURA |
132 } | 138 } |
133 | 139 |
134 #if !defined(USE_AURA) | 140 #if !defined(USE_AURA) |
135 Screen* CreateNativeScreen() { | 141 Screen* CreateNativeScreen() { |
136 return new ScreenWin; | 142 return new ScreenWin; |
137 } | 143 } |
138 #endif // !USE_AURA | 144 #endif // !USE_AURA |
139 | 145 |
140 } // namespace gfx | 146 } // namespace gfx |
OLD | NEW |