Add support for querying "display" from eglfs

Return the native display which, with the x11 hooks, is the X11 Display*.
This gives compatibility with xcb and allows QtWebEngine to run on eglfs
in regular desktop builds without ozone. (this requires eglfs built with the
x11 hooks of course)

Change-Id: I8d25e2835c41a7e78f063a57a7d6c6b5e53a19b4
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Laszlo Agocs 2014-05-06 18:21:42 +02:00 committed by The Qt Project
parent 5c28747454
commit 3b6d8ba49b
2 changed files with 22 additions and 2 deletions

View File

@ -190,7 +190,8 @@ enum ResourceType {
EglDisplay,
EglWindow,
EglContext,
NativeDisplay
NativeDisplay,
Display
};
static int resourceType(const QByteArray &key)
@ -199,7 +200,8 @@ static int resourceType(const QByteArray &key)
QByteArrayLiteral("egldisplay"),
QByteArrayLiteral("eglwindow"),
QByteArrayLiteral("eglcontext"),
QByteArrayLiteral("nativedisplay")
QByteArrayLiteral("nativedisplay"),
QByteArrayLiteral("display")
};
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
const QByteArray *result = std::find(names, end, key);
@ -226,6 +228,23 @@ void *QEGLPlatformIntegration::nativeResourceForIntegration(const QByteArray &re
return result;
}
void *QEGLPlatformIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *)
{
void *result = 0;
switch (resourceType(resource)) {
case Display:
// Play nice when using the x11 hooks: Be compatible with xcb that allows querying
// the X Display pointer, which is nothing but our native display.
result = reinterpret_cast<void*>(nativeDisplay());
break;
default:
break;
}
return result;
}
void *QEGLPlatformIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
{
void *result = 0;

View File

@ -79,6 +79,7 @@ public:
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
// QPlatformNativeInterface
void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;