Add some missing nativeResourceForIntegration imlementations
The EglDisplay and the Display is normally a PlatformIntegration wide resource Change-Id: Ie5382a2a0b34fbe1c506b5134bf581afbd7f5d99 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>bb10
parent
bf86735f07
commit
f9f54bc0e4
|
|
@ -52,6 +52,21 @@ public:
|
|||
|
||||
Q_GLOBAL_STATIC(QKmsResourceMap, qKmsResourceMap)
|
||||
|
||||
void *QKmsNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString)
|
||||
{
|
||||
QByteArray lowerCaseResource = resourceString.toLower();
|
||||
ResourceType resource = qKmsResourceMap()->value(lowerCaseResource);
|
||||
void *result = 0;
|
||||
switch (resource) {
|
||||
case EglDisplay:
|
||||
result = eglDisplay();
|
||||
break;
|
||||
default:
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
void *QKmsNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
||||
{
|
||||
QByteArray lowerCaseResource = resourceString.toLower();
|
||||
|
|
@ -79,7 +94,14 @@ QPlatformNativeInterface::NativeResourceForContextFunction QKmsNativeInterface::
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *QKmsNativeInterface::eglDisplay()
|
||||
{
|
||||
//QKmsIntegration *integration = static_cast<QKmsIntegration *>(QGuiApplicationPrivate::platformIntegration());
|
||||
QKmsScreen *screen = static_cast<QKmsScreen *>(QGuiApplication::primaryScreen()->handle());
|
||||
if (!screen || !screen->device())
|
||||
return 0;
|
||||
return screen->device()->eglDisplay();
|
||||
}
|
||||
|
||||
void *QKmsNativeInterface::eglDisplayForWindow(QWindow *window)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,10 +46,12 @@ public:
|
|||
EglContext
|
||||
};
|
||||
|
||||
void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
|
||||
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE;
|
||||
|
||||
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
|
||||
|
||||
void *eglDisplay();
|
||||
void *eglDisplayForWindow(QWindow *window);
|
||||
void *eglContextForWindow(QWindow *window);
|
||||
static void *eglContextForContext(QOpenGLContext *context);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@
|
|||
|
||||
#include "qxcbeglnativeinterfacehandler.h"
|
||||
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include "qxcbeglwindow.h"
|
||||
#include "qxcbintegration.h"
|
||||
#include "qxcbeglintegration.h"
|
||||
#include "qxcbeglcontext.h"
|
||||
|
||||
|
|
@ -70,6 +72,16 @@ QXcbEglNativeInterfaceHandler::QXcbEglNativeInterfaceHandler(QXcbNativeInterface
|
|||
{
|
||||
}
|
||||
|
||||
QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbEglNativeInterfaceHandler::nativeResourceFunctionForIntegration(const QByteArray &resource) const{
|
||||
switch (resourceType(resource)) {
|
||||
case EglDisplay:
|
||||
return eglDisplay;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Q_NULLPTR;
|
||||
}
|
||||
|
||||
QPlatformNativeInterface::NativeResourceForContextFunction QXcbEglNativeInterfaceHandler::nativeResourceFunctionForContext(const QByteArray &resource) const
|
||||
{
|
||||
switch (resourceType(resource)) {
|
||||
|
|
@ -94,6 +106,13 @@ QPlatformNativeInterface::NativeResourceForWindowFunction QXcbEglNativeInterface
|
|||
return Q_NULLPTR;
|
||||
}
|
||||
|
||||
void *QXcbEglNativeInterfaceHandler::eglDisplay()
|
||||
{
|
||||
QXcbIntegration *integration = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration());
|
||||
QXcbEglIntegration *eglIntegration = static_cast<QXcbEglIntegration *>(integration->defaultConnection()->glIntegration());
|
||||
return eglIntegration->eglDisplay();
|
||||
}
|
||||
|
||||
void *QXcbEglNativeInterfaceHandler::eglDisplayForWindow(QWindow *window)
|
||||
{
|
||||
Q_ASSERT(window);
|
||||
|
|
|
|||
|
|
@ -57,9 +57,11 @@ public:
|
|||
|
||||
QXcbEglNativeInterfaceHandler(QXcbNativeInterface *nativeInterface);
|
||||
|
||||
QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const Q_DECL_OVERRIDE;
|
||||
QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const Q_DECL_OVERRIDE;
|
||||
QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const Q_DECL_OVERRIDE;
|
||||
private:
|
||||
static void *eglDisplay();
|
||||
static void *eglDisplayForWindow(QWindow *window);
|
||||
static void *eglContextForContext(QOpenGLContext *context);
|
||||
static void *eglConfigForContext(QOpenGLContext *context);
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resour
|
|||
case RootWindow:
|
||||
result = rootWindow();
|
||||
break;
|
||||
case Display:
|
||||
result = display();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -421,6 +424,17 @@ void *QXcbNativeInterface::rootWindow()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *QXcbNativeInterface::display()
|
||||
{
|
||||
#ifdef XCB_USE_XLIB
|
||||
QXcbIntegration *integration = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration());
|
||||
QXcbConnection *defaultConnection = integration->defaultConnection();
|
||||
return defaultConnection->xlib_display();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time)
|
||||
{
|
||||
static_cast<QXcbScreen *>(screen->handle())->connection()->setTime(time);
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ public:
|
|||
void *startupId();
|
||||
void *x11Screen();
|
||||
void *rootWindow();
|
||||
void *display();
|
||||
static void setStartupId(const char *);
|
||||
static void setAppTime(QScreen *screen, xcb_timestamp_t time);
|
||||
static void setAppUserTime(QScreen *screen, xcb_timestamp_t time);
|
||||
|
|
|
|||
Loading…
Reference in New Issue