summaryrefslogtreecommitdiffstats
path: root/ui/gfx/screen_gtk.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 00:39:35 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 00:39:35 +0000
commit6b7d954ff37811b45fac57e34418ff1c169b6ef8 (patch)
treef9b48972f6343d85508e1277bc9c524d7cb222a2 /ui/gfx/screen_gtk.cc
parented5c8219cf7da9a89d3da219c09f777ac3998ba9 (diff)
downloadchromium_src-6b7d954ff37811b45fac57e34418ff1c169b6ef8.zip
chromium_src-6b7d954ff37811b45fac57e34418ff1c169b6ef8.tar.gz
chromium_src-6b7d954ff37811b45fac57e34418ff1c169b6ef8.tar.bz2
Move DisplayUtils methods into gfx::Screen.
These methods are currently just used by metrics. I moved them from base into the browser a while back, but I think it makes the most sense for them to live in gfx::Screen. I'm also relocating the tests to ui_unittest and making them work on Aura. BUG=99711,100341 TEST=ran ui_unittest Review URL: http://codereview.chromium.org/8382019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/screen_gtk.cc')
-rw-r--r--ui/gfx/screen_gtk.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc
index 81904e1..42799b7 100644
--- a/ui/gfx/screen_gtk.cc
+++ b/ui/gfx/screen_gtk.cc
@@ -63,6 +63,7 @@ gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
return gfx::Rect(bounds);
}
+// static
gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
GdkWindow* window = gdk_window_at_pointer(NULL, NULL);
if (!window)
@@ -77,4 +78,18 @@ gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
return GTK_IS_WINDOW(widget) ? GTK_WINDOW(widget) : NULL;
}
+// static
+gfx::Size Screen::GetPrimaryMonitorSize() {
+ GdkScreen* screen = gdk_screen_get_default();
+ return gfx::Size(gdk_screen_get_width(screen), gdk_screen_get_height(screen));
+}
+
+// static
+int Screen::GetNumMonitors() {
+ // This query is kinda bogus for Linux -- do we want number of X screens?
+ // The number of monitors Xinerama has? We'll just use whatever GDK uses.
+ GdkScreen* screen = gdk_screen_get_default();
+ return gdk_screen_get_n_monitors(screen);
+}
+
} // namespace gfx