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

Unified Diff: chrome/common/x11_util.cc

Issue 67145: Linux: move X operations from the IO to UI2 thread. (Closed)
Patch Set: ... Created 11 years, 8 months 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 | « chrome/common/x11_util.h ('k') | chrome/test/testing_browser_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/common/x11_util.h ('k') | chrome/test/testing_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698