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/gfx/display.h" | 10 #include "ui/gfx/display.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace gfx { | 30 namespace gfx { |
31 | 31 |
32 ScreenWin::ScreenWin() { | 32 ScreenWin::ScreenWin() { |
33 } | 33 } |
34 | 34 |
35 ScreenWin::~ScreenWin() { | 35 ScreenWin::~ScreenWin() { |
36 } | 36 } |
37 | 37 |
38 bool ScreenWin::IsDIPEnabled() { | 38 bool ScreenWin::IsDIPEnabled() { |
| 39 #if defined(ENABLE_HIDPI) |
| 40 return true; |
| 41 #else |
39 return false; | 42 return false; |
| 43 #endif |
40 } | 44 } |
41 | 45 |
42 gfx::Point ScreenWin::GetCursorScreenPoint() { | 46 gfx::Point ScreenWin::GetCursorScreenPoint() { |
43 POINT pt; | 47 POINT pt; |
44 GetCursorPos(&pt); | 48 GetCursorPos(&pt); |
45 return gfx::Point(pt); | 49 return gfx::Point(pt); |
46 } | 50 } |
47 | 51 |
48 gfx::NativeWindow ScreenWin::GetWindowAtCursorScreenPoint() { | 52 gfx::NativeWindow ScreenWin::GetWindowAtCursorScreenPoint() { |
49 POINT location; | 53 POINT location; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 RECT other_bounds_rect = match_rect.ToRECT(); | 89 RECT other_bounds_rect = match_rect.ToRECT(); |
86 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( | 90 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( |
87 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); | 91 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); |
88 return GetDisplay(monitor_info); | 92 return GetDisplay(monitor_info); |
89 } | 93 } |
90 | 94 |
91 gfx::Display ScreenWin::GetPrimaryDisplay() const { | 95 gfx::Display ScreenWin::GetPrimaryDisplay() const { |
92 MONITORINFO mi = GetMonitorInfoForMonitor( | 96 MONITORINFO mi = GetMonitorInfoForMonitor( |
93 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); | 97 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); |
94 gfx::Display display = GetDisplay(mi); | 98 gfx::Display display = GetDisplay(mi); |
| 99 #if !defined(ENABLE_HIDPI) |
| 100 // TODO(kevers|girard): Test if these checks can be reintroduced for high-DIP |
| 101 // once more of the app is DIP-aware. |
95 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width()); | 102 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width()); |
96 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height()); | 103 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height()); |
| 104 #endif |
97 return display; | 105 return display; |
98 } | 106 } |
99 | 107 |
100 void ScreenWin::AddObserver(DisplayObserver* observer) { | 108 void ScreenWin::AddObserver(DisplayObserver* observer) { |
101 // TODO(oshima): crbug.com/122863. | 109 // TODO(oshima): crbug.com/122863. |
102 } | 110 } |
103 | 111 |
104 void ScreenWin::RemoveObserver(DisplayObserver* observer) { | 112 void ScreenWin::RemoveObserver(DisplayObserver* observer) { |
105 // TODO(oshima): crbug.com/122863. | 113 // TODO(oshima): crbug.com/122863. |
106 } | 114 } |
(...skipping 16 matching lines...) Expand all Loading... |
123 #endif // USE_AURA | 131 #endif // USE_AURA |
124 } | 132 } |
125 | 133 |
126 #if !defined(USE_AURA) | 134 #if !defined(USE_AURA) |
127 Screen* CreateNativeScreen() { | 135 Screen* CreateNativeScreen() { |
128 return new ScreenWin; | 136 return new ScreenWin; |
129 } | 137 } |
130 #endif // !USE_AURA | 138 #endif // !USE_AURA |
131 | 139 |
132 } // namespace gfx | 140 } // namespace gfx |
OLD | NEW |