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 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ | 5 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ | 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 static int GetSystemMetricsForHwnd(HWND hwnd, int metric); | 95 static int GetSystemMetricsForHwnd(HWND hwnd, int metric); |
| 96 | 96 |
| 97 // Returns the result of GetSystemMetrics for |metric| in DIP. | 97 // Returns the result of GetSystemMetrics for |metric| in DIP. |
| 98 // Use this function if you need to work in DIP and can tolerate cascading | 98 // Use this function if you need to work in DIP and can tolerate cascading |
| 99 // rounding errors towards screen pixels. | 99 // rounding errors towards screen pixels. |
| 100 static int GetSystemMetricsInDIP(int metric); | 100 static int GetSystemMetricsInDIP(int metric); |
| 101 | 101 |
| 102 // Returns |hwnd|'s scale factor. | 102 // Returns |hwnd|'s scale factor. |
| 103 static float GetScaleFactorForHWND(HWND hwnd); | 103 static float GetScaleFactorForHWND(HWND hwnd); |
| 104 | 104 |
| 105 // Returns the system's global scale factor, ignoring the value of | |
| 106 // --force-device-scale-factor. Only use this if you are working with Windows | |
| 107 // metrics global to the system. Otherwise you should call | |
| 108 // GetScaleFactorForHWND() to get the correct scale factor for the monitor | |
| 109 // you are on. | |
|
robliao
2017/02/15 22:59:41
Nit: correct scale factor for the target monitor.
Bret
2017/02/15 23:13:46
Okay, Bishop Lowth. I edited it anyway since targe
| |
| 110 static float GetSystemScaleFactor(); | |
| 111 | |
| 105 // Returns the HWND associated with the NativeView. | 112 // Returns the HWND associated with the NativeView. |
| 106 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; | 113 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; |
| 107 | 114 |
| 108 // Returns the NativeView associated with the HWND. | 115 // Returns the NativeView associated with the HWND. |
| 109 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; | 116 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; |
| 110 | 117 |
| 111 protected: | 118 protected: |
| 112 // Screen: | 119 // Screen: |
| 113 gfx::Point GetCursorScreenPoint() override; | 120 gfx::Point GetCursorScreenPoint() override; |
| 114 bool IsWindowUnderCursor(gfx::NativeWindow window) override; | 121 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // This must be updated anytime |screen_win_displays_| is updated. | 193 // This must be updated anytime |screen_win_displays_| is updated. |
| 187 std::vector<Display> displays_; | 194 std::vector<Display> displays_; |
| 188 | 195 |
| 189 DISALLOW_COPY_AND_ASSIGN(ScreenWin); | 196 DISALLOW_COPY_AND_ASSIGN(ScreenWin); |
| 190 }; | 197 }; |
| 191 | 198 |
| 192 } // namespace win | 199 } // namespace win |
| 193 } // namespace display | 200 } // namespace display |
| 194 | 201 |
| 195 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ | 202 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| OLD | NEW |