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

Unified Diff: views/screen_gtk.cc

Issue 460134: Uses X mechanisms to get the screen size. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/screen_gtk.cc
===================================================================
--- views/screen_gtk.cc (revision 34134)
+++ views/screen_gtk.cc (working copy)
@@ -4,6 +4,7 @@
#include "views/screen.h"
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "base/logging.h"
@@ -25,9 +26,35 @@
gdk_atom_intern("CARDINAL", FALSE),
0, 0xFF, false, NULL, NULL, &data_len,
&raw_data);
+ int top_left_x = 0;
+ int top_left_y = 0;
+ int width = 0;
+ int height = 0;
+
+ if (success) {
+ glong* data = reinterpret_cast<glong*>(raw_data);
+ top_left_x = data[0];
+ top_left_y = data[1];
+ width = data[2];
+ height = data[3];
+ } else {
+#if defined(OS_LINUX)
sky 2009/12/09 16:34:34 This file is only compiled on linux, so no need fo
Chris Masone 2009/12/09 17:09:50 fixed and committed
+ // If there's no window manager, we can ask X for Monitor info directly.
+ XWindowAttributes attributes;
+ Status status = XGetWindowAttributes(gdk_x11_get_default_xdisplay(),
+ gdk_x11_get_default_root_xwindow(),
+ &attributes);
+ if (status) {
+ top_left_x = attributes.x;
+ top_left_y = attributes.y;
+ width = attributes.width;
+ height = attributes.height;
+ success = true;
+ }
+#endif
+ }
DCHECK(success);
- glong* data = reinterpret_cast<glong*>(raw_data);
- return gfx::Rect(data[0], data[1], data[0] + data[2], data[1] + data[3]);
+ return gfx::Rect(top_left_x, top_left_y, width, height);
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698