Index: chrome/common/x11_util.cc |
diff --git a/chrome/common/x11_util.cc b/chrome/common/x11_util.cc |
index d10c32079c766d10f16c2f12b5dcb47b7ce706fc..83fc02a8e4ee3a5e243ce517e490f98a3e3953b3 100644 |
--- a/chrome/common/x11_util.cc |
+++ b/chrome/common/x11_util.cc |
@@ -6,6 +6,7 @@ |
// ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
// remains woefully incomplete. |
+#include "base/thread.h" |
#include "chrome/common/x11_util.h" |
#include "chrome/common/x11_util_internal.h" |
@@ -98,6 +99,10 @@ bool QueryRenderSupport(Display* dpy) { |
return render_supported; |
} |
+int GetDefaultScreen(Display* display) { |
+ return XDefaultScreen(display); |
+} |
+ |
XID GetX11RootWindow() { |
return GDK_WINDOW_XID(gdk_get_default_root_window()); |
} |
@@ -106,6 +111,10 @@ XID GetX11WindowFromGtkWidget(GtkWidget* widget) { |
return GDK_WINDOW_XID(widget->window); |
} |
+XID GetX11WindowFromGdkWindow(GdkWindow* window) { |
+ return GDK_WINDOW_XID(window); |
+} |
+ |
void* GetVisualFromGtkWidget(GtkWidget* widget) { |
return GDK_VISUAL_XVISUAL(gtk_widget_get_visual(widget)); |
} |
@@ -219,4 +228,25 @@ void FreePixmap(Display* display, XID pixmap) { |
XFreePixmap(display, pixmap); |
} |
+// Called on BACKGROUND_X11 thread. |
+Display* GetSecondaryDisplay() { |
+ static Display* display = NULL; |
+ if (!display) { |
+ display = XOpenDisplay(NULL); |
+ CHECK(display); |
+ } |
+ |
+ return display; |
+} |
+ |
+// Called on BACKGROUND_X11 thread. |
+void GetWindowGeometry(int* x, int* y, unsigned* width, unsigned* height, |
+ XID window) { |
+ Window root_window; |
+ unsigned border_width, depth; |
+ |
+ CHECK(XGetGeometry(GetSecondaryDisplay(), window, |
+ &root_window, x, y, width, height, &border_width, &depth)); |
+} |
+ |
} // namespace x11_util |