From 481cd6a6b5f6ddb0edf5e67b2569ca170002f6df Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 2 May 2011 14:58:29 +0200 Subject: Track API change in QPlatformNativeInterface Reviewed-by: Samuel --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 59 +++++++++++------------ src/plugins/platforms/xcb/qxcbnativeinterface.h | 16 +++--- 2 files changed, 35 insertions(+), 40 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index bef2d573d0..8e2e099492 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -73,29 +73,29 @@ public: Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap) -void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); ResourceType resource = qXcbResourceMap()->value(lowerCaseResource); void *result = 0; switch(resource) { case Display: - result = displayForWidget(widget); + result = displayForWindow(window); break; case EglDisplay: - result = eglDisplayForWidget(widget); + result = eglDisplayForWindow(window); break; case Connection: - result = connectionForWidget(widget); + result = connectionForWindow(window); break; case Screen: - result = qPlatformScreenForWidget(widget); + result = qPlatformScreenForWindow(window); break; case GraphicsDevice: - result = graphicsDeviceForWidget(widget); + result = graphicsDeviceForWindow(window); break; case EglContext: - result = eglContextForWidget(widget); + result = eglContextForWindow(window); break; default: result = 0; @@ -103,75 +103,70 @@ void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceStr return result; } -QXcbScreen *QXcbNativeInterface::qPlatformScreenForWidget(QWidget *widget) +QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) { QXcbScreen *screen; - if (widget) { - screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + if (window) { + screen = static_cast(QPlatformScreen::platformScreenForWindow(window)); }else { screen = static_cast(QApplicationPrivate::platformIntegration()->screens()[0]); } return screen; } -void *QXcbNativeInterface::displayForWidget(QWidget *widget) +void *QXcbNativeInterface::displayForWindow(QWindow *window) { #if defined(XCB_USE_XLIB) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->connection()->xlib_display(); #else - Q_UNUSED(widget); + Q_UNUSED(window); return 0; #endif } -void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::eglDisplayForWindow(QWindow *window) { #if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->connection()->egl_display(); #else - Q_UNUSED(widget) + Q_UNUSED(window) return 0; #endif } -void *QXcbNativeInterface::connectionForWidget(QWidget *widget) +void *QXcbNativeInterface::connectionForWindow(QWindow *window) { - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->xcb_connection(); } -void *QXcbNativeInterface::screenForWidget(QWidget *widget) +void *QXcbNativeInterface::screenForWindow(QWindow *window) { - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->screen(); } -void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) +void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window) { #if defined(XCB_USE_DRI2) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); QByteArray deviceName = screen->connection()->dri2DeviceName(); return deviceName.data(); #else - Q_UNUSED(widget); + Q_UNUSED(window); return 0; #endif } -void * QXcbNativeInterface::eglContextForWidget(QWidget *widget) +void * QXcbNativeInterface::eglContextForWindow(QWindow *window) { - Q_ASSERT(widget); - if (!widget->windowHandle()) { - qDebug() << "QPlatformWindow does not exist for widget" << widget - << "cannot return EGLContext"; - return 0; - } - QPlatformGLContext *platformContext = widget->windowHandle()->glContext()->handle(); + Q_ASSERT(window); + QPlatformGLContext *platformContext = window->glContext()->handle(); if (!platformContext) { - qDebug() << "QWindow" << widget->windowHandle() << "does not have a glContext" + qDebug() << "QWindow" << window << "does not have a glContext" << "cannot return EGLContext"; return 0; } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index f60905cc3d..5cf3d8c6a6 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -59,17 +59,17 @@ public: EglContext }; - void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); - void *displayForWidget(QWidget *widget); - void *eglDisplayForWidget(QWidget *widget); - void *connectionForWidget(QWidget *widget); - void *screenForWidget(QWidget *widget); - void *graphicsDeviceForWidget(QWidget *widget); - void *eglContextForWidget(QWidget *widget); + void *displayForWindow(QWindow *window); + void *eglDisplayForWindow(QWindow *window); + void *connectionForWindow(QWindow *window); + void *screenForWindow(QWindow *window); + void *graphicsDeviceForWindow(QWindow *window); + void *eglContextForWindow(QWindow *window); private: - static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); + static QXcbScreen *qPlatformScreenForWindow(QWindow *window); }; #endif // QXCBNATIVEINTERFACE_H -- cgit v1.2.3