summaryrefslogtreecommitdiffstats
path: root/chromium/ui/gfx/x/x11_types.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/gfx/x/x11_types.cc')
-rw-r--r--chromium/ui/gfx/x/x11_types.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/chromium/ui/gfx/x/x11_types.cc b/chromium/ui/gfx/x/x11_types.cc
index 48ce6416b69..54a0816c652 100644
--- a/chromium/ui/gfx/x/x11_types.cc
+++ b/chromium/ui/gfx/x/x11_types.cc
@@ -6,12 +6,27 @@
#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() {
- return base::MessagePumpForUI::GetDefaultXDisplay();
+ static XDisplay* display = NULL;
+ if (!display)
+ 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,