Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: ui/gfx/screen_win.cc

Issue 10540091: Rename gfx::Monitor to gfx::Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 5 #include "ui/gfx/screen.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/monitor.h" 10 #include "ui/gfx/display.h"
11 11
12 namespace { 12 namespace {
13 13
14 MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) { 14 MONITORINFO GetMonitorInfoForMonitor(HMONITOR monitor) {
15 MONITORINFO monitor_info = { 0 }; 15 MONITORINFO monitor_info = { 0 };
16 monitor_info.cbSize = sizeof(monitor_info); 16 monitor_info.cbSize = sizeof(monitor_info);
17 GetMonitorInfo(monitor, &monitor_info); 17 GetMonitorInfo(monitor, &monitor_info);
18 return monitor_info; 18 return monitor_info;
19 } 19 }
20 20
21 gfx::Monitor GetMonitor(MONITORINFO& monitor_info) { 21 gfx::Display GetDisplay(MONITORINFO& monitor_info) {
22 // TODO(oshima): Implement ID and Observer. 22 // TODO(oshima): Implement ID and Observer.
23 gfx::Monitor monitor(0, gfx::Rect(monitor_info.rcMonitor)); 23 gfx::Display display(0, gfx::Rect(monitor_info.rcMonitor));
24 monitor.set_work_area(gfx::Rect(monitor_info.rcWork)); 24 display.set_work_area(gfx::Rect(monitor_info.rcWork));
25 return monitor; 25 return display;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 namespace gfx { 30 namespace gfx {
31 31
32 // static 32 // static
33 bool Screen::IsDIPEnabled() { 33 bool Screen::IsDIPEnabled() {
34 return false; 34 return false;
35 } 35 }
(...skipping 10 matching lines...) Expand all
46 POINT location; 46 POINT location;
47 return GetCursorPos(&location) ? WindowFromPoint(location) : NULL; 47 return GetCursorPos(&location) ? WindowFromPoint(location) : NULL;
48 } 48 }
49 49
50 // static 50 // static
51 int Screen::GetNumMonitors() { 51 int Screen::GetNumMonitors() {
52 return GetSystemMetrics(SM_CMONITORS); 52 return GetSystemMetrics(SM_CMONITORS);
53 } 53 }
54 54
55 // static 55 // static
56 gfx::Monitor Screen::GetMonitorNearestWindow(gfx::NativeView window) { 56 gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView window) {
57 MONITORINFO monitor_info; 57 MONITORINFO monitor_info;
58 monitor_info.cbSize = sizeof(monitor_info); 58 monitor_info.cbSize = sizeof(monitor_info);
59 GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST), 59 GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST),
60 &monitor_info); 60 &monitor_info);
61 return GetMonitor(monitor_info); 61 return GetDisplay(monitor_info);
62 } 62 }
63 63
64 // static 64 // static
65 gfx::Monitor Screen::GetMonitorNearestPoint(const gfx::Point& point) { 65 gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) {
66 POINT initial_loc = { point.x(), point.y() }; 66 POINT initial_loc = { point.x(), point.y() };
67 HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST); 67 HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST);
68 MONITORINFO mi = {0}; 68 MONITORINFO mi = {0};
69 mi.cbSize = sizeof(mi); 69 mi.cbSize = sizeof(mi);
70 if (monitor && GetMonitorInfo(monitor, &mi)) 70 if (monitor && GetMonitorInfo(monitor, &mi))
71 return GetMonitor(mi); 71 return GetDisplay(mi);
72 return gfx::Monitor(); 72 return gfx::Display();
73 } 73 }
74 74
75 // static 75 // static
76 gfx::Monitor Screen::GetPrimaryMonitor() { 76 gfx::Display Screen::GetPrimaryMonitor() {
77 MONITORINFO mi = GetMonitorInfoForMonitor( 77 MONITORINFO mi = GetMonitorInfoForMonitor(
78 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); 78 MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY));
79 gfx::Monitor monitor = GetMonitor(mi); 79 gfx::Display display = GetDisplay(mi);
80 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), monitor.size().width()); 80 DCHECK_EQ(GetSystemMetrics(SM_CXSCREEN), display.size().width());
81 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), monitor.size().height()); 81 DCHECK_EQ(GetSystemMetrics(SM_CYSCREEN), display.size().height());
82 return monitor; 82 return display;
83 } 83 }
84 84
85 // static 85 // static
86 gfx::Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) { 86 gfx::Display Screen::GetMonitorMatching(const gfx::Rect& match_rect) {
87 RECT other_bounds_rect = match_rect.ToRECT(); 87 RECT other_bounds_rect = match_rect.ToRECT();
88 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( 88 MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect(
89 &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); 89 &other_bounds_rect, MONITOR_DEFAULTTONEAREST));
90 return GetMonitor(monitor_info); 90 return GetDisplay(monitor_info);
91 } 91 }
92 92
93 } // namespace gfx 93 } // namespace gfx
OLDNEW
« ui/gfx/screen.h ('K') | « ui/gfx/screen_mac.mm ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698