OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "views/screen.h" | 5 #include "views/screen.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
| 9 #include "base/logging.h" |
| 10 |
9 namespace views { | 11 namespace views { |
10 | 12 |
11 // static | 13 // static |
12 gfx::Point Screen::GetCursorScreenPoint() { | 14 gfx::Point Screen::GetCursorScreenPoint() { |
13 gint x, y; | 15 gint x, y; |
14 gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL); | 16 gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL); |
15 return gfx::Point(x, y); | 17 return gfx::Point(x, y); |
16 } | 18 } |
17 | 19 |
| 20 // static |
| 21 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) { |
| 22 // TODO(beng): use |window|. |
| 23 guchar* raw_data = NULL; |
| 24 gint data_len = 0; |
| 25 gboolean success = gdk_property_get(gdk_get_default_root_window(), |
| 26 gdk_atom_intern("_NET_WORKAREA", FALSE), |
| 27 gdk_atom_intern("CARDINAL", FALSE), |
| 28 0, 0xFF, false, NULL, NULL, &data_len, |
| 29 &raw_data); |
| 30 DCHECK(success); |
| 31 glong* data = reinterpret_cast<glong*>(raw_data); |
| 32 return gfx::Rect(data[0], data[1], data[0] + data[2], data[1] + data[3]); |
| 33 } |
| 34 |
18 } // namespace | 35 } // namespace |
19 | 36 |
OLD | NEW |