blob: db21a926bbc2cdbc0763780fe023ea1a003d08d0 (
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
65
66
67
68
69
|
// Copyright (c) 2011 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"
#if defined(OS_WIN)
#include <windows.h>
#endif
#include "base/logging.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
// gfx can't depend upon aura, otherwise we have circular dependencies. So,
// gfx::Screen is pluggable for aura and Desktop plugs in the real
// implementation.
// static
Screen* Screen::instance_ = NULL;
// static
void Screen::SetInstance(Screen* screen) {
delete instance_;
instance_ = screen;
}
// static
gfx::Point Screen::GetCursorScreenPoint() {
#if defined(OS_WIN)
POINT pt;
GetCursorPos(&pt);
return gfx::Point(pt);
#endif
NOTIMPLEMENTED();
return gfx::Point();
}
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
DCHECK(instance_);
return instance_->GetMonitorWorkAreaNearestWindowImpl(window);
}
// static
gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
DCHECK(instance_);
return instance_->GetMonitorAreaNearestWindowImpl(window);
}
// static
gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
DCHECK(instance_);
return instance_->GetMonitorWorkAreaNearestPointImpl(point);
}
// static
gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
DCHECK(instance_);
return instance_->GetMonitorAreaNearestPointImpl(point);
}
gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
DCHECK(instance_);
return instance_->GetWindowAtCursorScreenPointImpl();
}
} // namespace gfx
|