| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return gfx::win::ScreenToDIPPoint(cursor_pos_pixels); | 69 return gfx::win::ScreenToDIPPoint(cursor_pos_pixels); |
| 70 } | 70 } |
| 71 | 71 |
| 72 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { | 72 gfx::NativeWindow ScreenWin::GetWindowUnderCursor() { |
| 73 POINT cursor_loc; | 73 POINT cursor_loc; |
| 74 HWND hwnd = GetCursorPos(&cursor_loc) ? WindowFromPoint(cursor_loc) : NULL; | 74 HWND hwnd = GetCursorPos(&cursor_loc) ? WindowFromPoint(cursor_loc) : NULL; |
| 75 return GetNativeWindowFromHWND(hwnd); | 75 return GetNativeWindowFromHWND(hwnd); |
| 76 } | 76 } |
| 77 | 77 |
| 78 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) { | 78 gfx::NativeWindow ScreenWin::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 79 return GetNativeWindowFromHWND(WindowFromPoint(point.ToPOINT())); | 79 gfx::Point point_in_pixels = gfx::win::DIPToScreenPoint(point); |
| 80 return GetNativeWindowFromHWND(WindowFromPoint(point_in_pixels.ToPOINT())); |
| 80 } | 81 } |
| 81 | 82 |
| 82 int ScreenWin::GetNumDisplays() const { | 83 int ScreenWin::GetNumDisplays() const { |
| 83 return GetSystemMetrics(SM_CMONITORS); | 84 return GetSystemMetrics(SM_CMONITORS); |
| 84 } | 85 } |
| 85 | 86 |
| 86 std::vector<gfx::Display> ScreenWin::GetAllDisplays() const { | 87 std::vector<gfx::Display> ScreenWin::GetAllDisplays() const { |
| 87 std::vector<gfx::Display> all_displays; | 88 std::vector<gfx::Display> all_displays; |
| 88 EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, | 89 EnumDisplayMonitors(NULL, NULL, EnumMonitorCallback, |
| 89 reinterpret_cast<LPARAM>(&all_displays)); | 90 reinterpret_cast<LPARAM>(&all_displays)); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 NOTREACHED(); | 151 NOTREACHED(); |
| 151 return NULL; | 152 return NULL; |
| 152 } | 153 } |
| 153 | 154 |
| 154 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { | 155 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { |
| 155 NOTREACHED(); | 156 NOTREACHED(); |
| 156 return NULL; | 157 return NULL; |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace gfx | 160 } // namespace gfx |
| OLD | NEW |