Chromium Code Reviews| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 86 |
| 87 ScreenWin::ScreenWin() | 87 ScreenWin::ScreenWin() |
| 88 : displays_(GetDisplays()) { | 88 : displays_(GetDisplays()) { |
| 89 SingletonHwnd::GetInstance()->AddObserver(this); | 89 SingletonHwnd::GetInstance()->AddObserver(this); |
| 90 } | 90 } |
| 91 | 91 |
| 92 ScreenWin::~ScreenWin() { | 92 ScreenWin::~ScreenWin() { |
| 93 SingletonHwnd::GetInstance()->RemoveObserver(this); | 93 SingletonHwnd::GetInstance()->RemoveObserver(this); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool ScreenWin::IsDIPEnabled() { | 96 bool ScreenWin::IsDIPEnabled() { |
|
scottmg
2014/10/23 02:42:06
I think IsDIPEnabled could be deleted, it seems to
| |
| 97 return IsInHighDPIMode(); | 97 return GetDPIScale() > 1.0; |
| 98 } | 98 } |
| 99 | 99 |
| 100 gfx::Point ScreenWin::GetCursorScreenPoint() { | 100 gfx::Point ScreenWin::GetCursorScreenPoint() { |
| 101 POINT pt; | 101 POINT pt; |
| 102 GetCursorPos(&pt); | 102 GetCursorPos(&pt); |
| 103 gfx::Point cursor_pos_pixels(pt); | 103 gfx::Point cursor_pos_pixels(pt); |
| 104 return gfx::win::ScreenToDIPPoint(cursor_pos_pixels); | 104 return gfx::win::ScreenToDIPPoint(cursor_pos_pixels); |
| 105 } | 105 } |
| 106 | 106 |
| 107 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { | 107 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); | 157 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); |
| 158 return GetDisplay(monitor_info); | 158 return GetDisplay(monitor_info); |
| 159 } | 159 } |
| 160 | 160 |
| 161 gfx::Display ScreenWin::GetPrimaryDisplay() const { | 161 gfx::Display ScreenWin::GetPrimaryDisplay() const { |
| 162 MONITORINFOEX mi = GetMonitorInfoForMonitor( | 162 MONITORINFOEX mi = GetMonitorInfoForMonitor( |
| 163 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); | 163 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); |
| 164 gfx::Display display = GetDisplay(mi); | 164 gfx::Display display = GetDisplay(mi); |
| 165 // TODO(kevers|girard): Test if these checks can be reintroduced for high-DIP | 165 // TODO(kevers|girard): Test if these checks can be reintroduced for high-DIP |
| 166 // once more of the app is DIP-aware. | 166 // once more of the app is DIP-aware. |
| 167 if (!(IsInHighDPIMode() || IsHighDPIEnabled())) { | 167 if (!(GetDPIScale() > 1.0 || IsHighDPIEnabled())) { |
| 168 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width()); | 168 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width()); |
| 169 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height()); | 169 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height()); |
| 170 } | 170 } |
| 171 return display; | 171 return display; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ScreenWin::AddObserver(DisplayObserver* observer) { | 174 void ScreenWin::AddObserver(DisplayObserver* observer) { |
| 175 change_notifier_.AddObserver(observer); | 175 change_notifier_.AddObserver(observer); |
| 176 } | 176 } |
| 177 | 177 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 196 NOTREACHED(); | 196 NOTREACHED(); |
| 197 return NULL; | 197 return NULL; |
| 198 } | 198 } |
| 199 | 199 |
| 200 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { | 200 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { |
| 201 NOTREACHED(); | 201 NOTREACHED(); |
| 202 return NULL; | 202 return NULL; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace gfx | 205 } // namespace gfx |
| OLD | NEW |