Index: ui/gfx/x/x11_types.cc |
diff --git a/ui/gfx/x/x11_types.cc b/ui/gfx/x/x11_types.cc |
index 6c4f62db989be3c6946efea4119f51c2532f8ff1..54a0816c65236121dd6852a21a87777f03b43efb 100644 |
--- a/ui/gfx/x/x11_types.cc |
+++ b/ui/gfx/x/x11_types.cc |
@@ -6,17 +6,29 @@ |
#include <X11/Xlib.h> |
+#include "base/command_line.h" |
#include "base/message_loop/message_loop.h" |
+#include "ui/gfx/x/x11_switches.h" |
namespace gfx { |
XDisplay* GetXDisplay() { |
static XDisplay* display = NULL; |
if (!display) |
- display = XOpenDisplay(NULL); |
+ display = OpenNewXDisplay(); |
return display; |
} |
+XDisplay* OpenNewXDisplay() { |
+#if defined(OS_CHROMEOS) |
+ return XOpenDisplay(NULL); |
+#else |
+ std::string display_str = base::CommandLine::ForCurrentProcess()-> |
+ GetSwitchValueASCII(switches::kX11Display); |
+ return XOpenDisplay(display_str.empty() ? NULL : display_str.c_str()); |
+#endif |
+} |
+ |
void PutARGBImage(XDisplay* display, |
void* visual, int depth, |
XID pixmap, void* pixmap_gc, |