summaryrefslogtreecommitdiffstats
path: root/shared/shared_globals.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-10-30 11:28:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-11 17:25:17 +0100
commit258e3aad97be370663983573b557c4115db3fafb (patch)
tree0a5a55d7825fa93d7c3a0557c1dfb851aac05ec3 /shared/shared_globals.cpp
parentfb62607e950ac711f7366b378d8d5f952d4fd1b3 (diff)
Use our own implementation of GetDefaultXDisplay.
This allows the Chromium GL code to initialize on the display created by Qt. Change-Id: I3d21f56c3792d6e99cb94690f56d7dd5c542045a Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'shared/shared_globals.cpp')
-rw-r--r--shared/shared_globals.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/shared/shared_globals.cpp b/shared/shared_globals.cpp
index 70ef901db..3d20ad45d 100644
--- a/shared/shared_globals.cpp
+++ b/shared/shared_globals.cpp
@@ -41,10 +41,17 @@
#include "shared_globals.h"
+#include "base/message_loop/message_pump_gtk.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include <QGuiApplication>
#include <QScreen>
#include <QWindow>
+#include <qpa/qplatformnativeinterface.h>
+
+#if defined(USE_X11)
+#include <X11/Xlib.h>
+#endif
void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* results)
{
@@ -63,6 +70,23 @@ void GetScreenInfoFromNativeWindow(QWindow* window, WebKit::WebScreenInfo* resul
*results = r;
}
+namespace base {
+
+#if defined(USE_X11)
+Display* MessagePumpGtk::GetDefaultXDisplay() {
+ static void *display = qApp->platformNativeInterface()->nativeResourceForScreen(QByteArrayLiteral("display"), qApp->primaryScreen());
+ if (!display) {
+ // XLib isn't available or has not been initialized, which is a decision we wish to
+ // support, for example for the GPU process.
+ static Display* xdisplay = XOpenDisplay(NULL);
+ return xdisplay;
+ }
+ return static_cast<Display*>(display);
+}
+#endif
+
+}
+
namespace content {
class WebContentsImpl;
class WebContentsViewPort;