blob: 4337ede3c911d89ca5ac7926e3e6e7e704134017 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gfx/screen.h"
#include "base/logging.h"
#include "ui/gfx/monitor.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/screen_impl.h"
namespace gfx {
// gfx can't depend upon aura, otherwise we have circular dependencies. So,
// gfx::Screen is pluggable and Desktop plugs in the real implementation.
namespace {
ScreenImpl* g_instance_ = NULL;
}
// static
void Screen::SetInstance(ScreenImpl* screen) {
delete g_instance_;
g_instance_ = screen;
}
// TODO(oshima): Implement ScreenImpl for Linux/aura and remove this
// ifdef.
// static
Point Screen::GetCursorScreenPoint() {
return g_instance_->GetCursorScreenPoint();
}
// static
NativeWindow Screen::GetWindowAtCursorScreenPoint() {
return g_instance_->GetWindowAtCursorScreenPoint();
}
// static
int Screen::GetNumMonitors() {
return g_instance_->GetNumMonitors();
}
// static
Monitor Screen::GetMonitorNearestWindow(NativeView window) {
return g_instance_->GetMonitorNearestWindow(window);
}
// static
Monitor Screen::GetMonitorNearestPoint(const Point& point) {
return g_instance_->GetMonitorNearestPoint(point);
}
// static
Monitor Screen::GetPrimaryMonitor() {
return g_instance_->GetPrimaryMonitor();
}
// static
Monitor Screen::GetMonitorMatching(const gfx::Rect& match_rect) {
return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint());
}
} // namespace gfx
|