summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-04-26 16:21:58 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-04-28 15:38:51 +0200
commitef77e8b65149a29a541044239fccf5e14b95e94d (patch)
tree8182a140efbb517407f1039b6795c67819a31405 /src/plugins/platforms
parentfbef41167aa4aede67bc1ec904142e2e5e12c7fc (diff)
Added QWindowContext and got wiggly up and running with xcb.
(cherry picked from commit c980e4ef4ebc7699a6c3a7529d3f08ebafc21ffe)
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.cpp99
-rw-r--r--src/plugins/platforms/glxconvenience/qglxconvenience.h12
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp13
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h8
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp38
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindowsurface.cpp4
11 files changed, 90 insertions, 122 deletions
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
index 7cee3e2ea1..abf7b83e04 100644
--- a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.cpp
@@ -66,7 +66,7 @@ enum {
#undef FontChange
#endif
-QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit)
+QVector<int> qglx_buildSpec(const QWindowFormat &format, int drawableBit)
{
QVector<int> spec(48);
int i = 0;
@@ -75,54 +75,37 @@ QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit
spec[i++] = 0;
spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = drawableBit;
- if (format.rgba()) {
- spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
- spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
- spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
- spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
- if (format.alpha()) {
- spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
- }
-
- spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
-
- if (format.alpha()) {
- spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize();
- }
-
- } else {
- spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works....
- spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8;
+ spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
+ spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
+ spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
+ spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
+ if (format.hasAlpha()) {
+ spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
}
- spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False;
+ spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.swapBehavior() != QWindowFormat::SingleBuffer ? True : False;
spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False;
- if (format.depth()) {
- spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
- }
+ spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
- if (format.stencil()) {
- spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
- }
- if (format.sampleBuffers()) {
+ spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
+
+ if (format.samples() > 1) {
spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
spec[i++] = 1;
spec[i++] = GLX_SAMPLES_ARB;
- spec[i++] = format.samples() == -1 ? 4 : format.samples();
+ spec[i++] = format.samples();
}
spec[i++] = XNone;
return spec;
}
-GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindowFormat &format, int drawableBit)
+GLXFBConfig qglx_findConfig(Display *display, int screen , const QWindowFormat &format, int drawableBit)
{
bool reduced = true;
GLXFBConfig chosenConfig = 0;
- QPlatformWindowFormat reducedFormat = format;
+ QWindowFormat reducedFormat = format;
while (!chosenConfig && reduced) {
QVector<int> spec = qglx_buildSpec(reducedFormat, drawableBit);
int confcount = 0;
@@ -133,7 +116,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
for (int i = 0; i < confcount; i++) {
chosenConfig = configs[i];
// Make sure we try to get an ARGB visual if the format asked for an alpha:
- if (reducedFormat.alpha()) {
+ if (reducedFormat.hasAlpha()) {
int alphaSize;
glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
if (alphaSize > 0)
@@ -145,7 +128,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
XFree(configs);
}
- reducedFormat = qglx_reducePlatformWindowFormat(reducedFormat,&reduced);
+ reducedFormat = qglx_reduceWindowFormat(reducedFormat,&reduced);
}
if (!chosenConfig)
@@ -154,16 +137,16 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow
return chosenConfig;
}
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format)
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QWindowFormat &format)
{
GLXFBConfig config = qglx_findConfig(display,screen,format);
XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display,config);
return visualInfo;
}
-QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx)
+QWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext)
{
- QPlatformWindowFormat format;
+ QWindowFormat format;
int redSize = 0;
int greenSize = 0;
int blueSize = 0;
@@ -172,16 +155,9 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
int stencilSize = 0;
int sampleBuffers = 0;
int sampleCount = 0;
- int level = 0;
- int rgba = 0;
int stereo = 0;
- int accumSizeA = 0;
- int accumSizeR = 0;
- int accumSizeG = 0;
- int accumSizeB = 0;
XVisualInfo *vi = glXGetVisualFromFBConfig(display,config);
- glXGetConfig(display,vi,GLX_RGBA,&rgba);
XFree(vi);
glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize);
@@ -190,12 +166,7 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize);
glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize);
glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers);
- glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level);
glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG);
- glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB);
format.setRedBufferSize(redSize);
format.setGreenBufferSize(greenSize);
@@ -203,39 +174,31 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB
format.setAlphaBufferSize(alphaSize);
format.setDepthBufferSize(depthSize);
format.setStencilBufferSize(stencilSize);
- format.setSampleBuffers(sampleBuffers);
- if (format.sampleBuffers()) {
+ if (sampleBuffers) {
glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount);
format.setSamples(sampleCount);
}
- format.setDirectRendering(glXIsDirect(display, ctx));
- format.setRgba(rgba);
format.setStereo(stereo);
- format.setAccumBufferSize(accumSizeB);
return format;
}
-QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced)
+QWindowFormat qglx_reduceWindowFormat(const QWindowFormat &format, bool *reduced)
{
- QPlatformWindowFormat retFormat = format;
+ QWindowFormat retFormat = format;
*reduced = true;
- if (retFormat.sampleBuffers()) {
- retFormat.setSampleBuffers(false);
+ if (retFormat.samples() > 1) {
+ retFormat.setSamples(0);
} else if (retFormat.stereo()) {
retFormat.setStereo(false);
- } else if (retFormat.accum()) {
- retFormat.setAccum(false);
- }else if (retFormat.stencil()) {
- retFormat.setStencil(false);
- }else if (retFormat.alpha()) {
- retFormat.setAlpha(false);
- }else if (retFormat.depth()) {
- retFormat.setDepth(false);
- }else if (retFormat.doubleBuffer()) {
- retFormat.setDoubleBuffer(false);
+ }else if (retFormat.stencilBufferSize() > 0) {
+ retFormat.setStencilBufferSize(0);
+ }else if (retFormat.hasAlpha()) {
+ retFormat.setAlphaBufferSize(0);
+ }else if (retFormat.depthBufferSize() > 0) {
+ retFormat.setDepthBufferSize(0);
}else{
*reduced = false;
}
diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.h b/src/plugins/platforms/glxconvenience/qglxconvenience.h
index 2c59dbb324..765a08a39d 100644
--- a/src/plugins/platforms/glxconvenience/qglxconvenience.h
+++ b/src/plugins/platforms/glxconvenience/qglxconvenience.h
@@ -42,15 +42,15 @@
#ifndef QGLXCONVENIENCE_H
#define QGLXCONVENIENCE_H
-#include <QPlatformWindowFormat>
+#include <QWindowFormat>
#include <X11/Xlib.h>
#include <GL/glx.h>
-XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format);
-GLXFBConfig qglx_findConfig(Display *display, int screen, const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
-QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
-QVector<int> qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
-QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced);
+XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QWindowFormat &format);
+GLXFBConfig qglx_findConfig(Display *display, int screen, const QWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
+QWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context);
+QVector<int> qglx_buildSpec(const QWindowFormat &format, int drawableBit = GLX_WINDOW_BIT);
+QWindowFormat qglx_reduceWindowFormat(const QWindowFormat &format, bool *reduced);
#endif // QGLXCONVENIENCE_H
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 190221c5f4..3af627c324 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -50,6 +50,8 @@
#include <X11/Xutil.h>
#include <GL/glx.h>
+#include <QtGui/QWindowContext>
+
#include "qglxintegration.h"
#include "qglxconvenience.h"
@@ -57,18 +59,17 @@
#include <dlfcn.h>
#endif
-QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format)
+QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QWindowFormat &format)
: QPlatformGLContext()
, m_screen(screen)
, m_drawable((Drawable)window)
, m_context(0)
{
Q_XCB_NOOP(m_screen->connection());
- const QPlatformGLContext *sharePlatformContext;
- sharePlatformContext = format.sharedGLContext();
+ const QWindowContext *shareContext = format.sharedContext();
GLXContext shareGlxContext = 0;
- if (sharePlatformContext)
- shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext();
+ if (shareContext)
+ shareGlxContext = static_cast<const QGLXContext*>(shareContext->handle())->glxContext();
GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format);
m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE);
@@ -148,7 +149,7 @@ void* QGLXContext::getProcAddress(const QString& procName)
return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.toLatin1().data()));
}
-QPlatformWindowFormat QGLXContext::platformWindowFormat() const
+QWindowFormat QGLXContext::windowFormat() const
{
return m_windowFormat;
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 99b72a04b5..4450083959 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -45,7 +45,7 @@
#include "qxcbwindow.h"
#include <QtGui/QPlatformGLContext>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <QtCore/QMutex>
@@ -54,7 +54,7 @@
class QGLXContext : public QPlatformGLContext
{
public:
- QGLXContext(Window window, QXcbScreen *xd, const QPlatformWindowFormat &format);
+ QGLXContext(Window window, QXcbScreen *xd, const QWindowFormat &format);
~QGLXContext();
virtual void makeCurrent();
@@ -64,13 +64,13 @@ public:
GLXContext glxContext() const { return m_context; }
- QPlatformWindowFormat platformWindowFormat() const;
+ QWindowFormat windowFormat() const;
private:
QXcbScreen *m_screen;
Drawable m_drawable;
GLXContext m_context;
- QPlatformWindowFormat m_windowFormat;
+ QWindowFormat m_windowFormat;
QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context);
};
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7ad12fe8b1..bae02fda2e 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -147,15 +147,16 @@ QXcbWindow *platformWindowFromId(xcb_window_t id)
{
QWidget *widget = QWidget::find(id);
if (widget)
- return static_cast<QXcbWindow *>(widget->platformWindow());
+ return static_cast<QXcbWindow *>(widget->windowHandle()->handle());
return 0;
}
-#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, window, handler) \
+#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \
{ \
event_t *e = (event_t *)event; \
- if (QXcbWindow *platformWindow = platformWindowFromId(e->window)) { \
- QObjectPrivate *d = QObjectPrivate::get(platformWindow->widget()); \
+ if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) { \
+ QWindow *windowHandle = platformWindow->window(); \
+ QObjectPrivate *d = QObjectPrivate::get(windowHandle->widget()); \
if (!d->wasDeleted) \
platformWindow->handler(e); \
} \
@@ -166,7 +167,7 @@ break;
{ \
event_t *e = (event_t *)event; \
if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \
- m_keyboard->handler(platformWindow->widget(), e); \
+ m_keyboard->handler(platformWindow->window()->widget(), e); \
} \
break;
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 9df5f14114..80f375c6b2 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -87,16 +87,15 @@ QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) cons
return new QRasterPixmapData(type);
}
-QPlatformWindow *QXcbIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
{
- Q_UNUSED(winId);
- return new QXcbWindow(widget);
+ return new QXcbWindow(window);
}
-QWindowSurface *QXcbIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QWindowSurface *QXcbIntegration::createWindowSurface(QWindow *window, WId winId) const
{
Q_UNUSED(winId);
- return new QXcbWindowSurface(widget);
+ return new QXcbWindowSurface(window->widget());
}
QList<QPlatformScreen *> QXcbIntegration::screens() const
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index d27fd716ab..0de6f15657 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -57,8 +57,8 @@ public:
bool hasCapability(Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
- QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
- QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ QWindowSurface *createWindowSurface(QWindow *window, WId winId) const;
QList<QPlatformScreen *> screens() const;
void moveToScreen(QWidget *window, int screen);
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index b2ca1beb6e..bef2d573d0 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -48,6 +48,8 @@
#include <QtCore/QDebug>
+#include <QtGui/qwindowcontext_qpa.h>
+
#if defined(XCB_USE_EGL)
#include "../eglconvenience/qeglplatformcontext.h"
#elif defined (XCB_USE_DRI2)
@@ -162,14 +164,14 @@ void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget)
void * QXcbNativeInterface::eglContextForWidget(QWidget *widget)
{
Q_ASSERT(widget);
- if (!widget->platformWindow()) {
+ if (!widget->windowHandle()) {
qDebug() << "QPlatformWindow does not exist for widget" << widget
<< "cannot return EGLContext";
return 0;
}
- QPlatformGLContext *platformContext = widget->platformWindow()->glContext();
+ QPlatformGLContext *platformContext = widget->windowHandle()->glContext()->handle();
if (!platformContext) {
- qDebug() << "QPlatformWindow" << widget->platformWindow() << "does not have a glContext"
+ qDebug() << "QWindow" << widget->windowHandle() << "does not have a glContext"
<< "cannot return EGLContext";
return 0;
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 0456638ab9..bc794446b2 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -85,10 +85,11 @@ static inline bool isTransient(const QWidget *w)
&& !w->testAttribute(Qt::WA_X11BypassTransientForHint));
}
-QXcbWindow::QXcbWindow(QWidget *tlw)
- : QPlatformWindow(tlw)
+QXcbWindow::QXcbWindow(QWindow *window)
+ : QPlatformWindow(window)
, m_context(0)
{
+ QWidget *tlw = window->widget();
m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw));
setConnection(m_screen->connection());
@@ -112,14 +113,14 @@ QXcbWindow::QXcbWindow(QWidget *tlw)
};
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
- if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL
+ if (window->surfaceType() == QWindow::OpenGLSurface
&& QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
{
#if defined(XCB_USE_GLX)
- XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat());
+ XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window->requestedWindowFormat());
#elif defined(XCB_USE_EGL)
EGLDisplay eglDisplay = connection()->egl_display();
- EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,tlw->platformWindowFormat(),true);
+ EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,window->requestedWindowFormat(),true);
VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this), eglDisplay, eglConfig);
XVisualInfo visualInfoTemplate;
@@ -243,7 +244,8 @@ void QXcbWindow::setVisible(bool visible)
{
xcb_wm_hints_t hints;
if (visible) {
- if (widget()->isMinimized())
+ // TODO: QWindow::isMinimized() or similar
+ if (window()->widget()->isMinimized())
xcb_wm_hints_set_iconic(&hints);
else
xcb_wm_hints_set_normal(&hints);
@@ -453,7 +455,7 @@ WId QXcbWindow::winId() const
void QXcbWindow::setParent(const QPlatformWindow *parent)
{
QPoint topLeft = geometry().topLeft();
- Q_XCB_CALL(xcb_reparent_window(xcb_connection(), window(), static_cast<const QXcbWindow *>(parent)->window(), topLeft.x(), topLeft.y()));
+ Q_XCB_CALL(xcb_reparent_window(xcb_connection(), xcb_window(), static_cast<const QXcbWindow *>(parent)->xcb_window(), topLeft.x(), topLeft.y()));
}
void QXcbWindow::setWindowTitle(const QString &title)
@@ -498,10 +500,10 @@ QPlatformGLContext *QXcbWindow::glContext() const
if (!m_context) {
#if defined(XCB_USE_GLX)
QXcbWindow *that = const_cast<QXcbWindow *>(this);
- that->m_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat());
+ that->m_context = new QGLXContext(m_window, m_screen, window()->requestedWindowFormat());
#elif defined(XCB_USE_EGL)
EGLDisplay display = connection()->egl_display();
- EGLConfig config = q_configFromQPlatformWindowFormat(display,widget()->platformWindowFormat(),true);
+ EGLConfig config = q_configFromQPlatformWindowFormat(display,window()->requestedWindowFormat(),true);
QVector<EGLint> eglContextAttrs;
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
eglContextAttrs.append(2);
@@ -520,11 +522,11 @@ QPlatformGLContext *QXcbWindow::glContext() const
void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
{
- QWindowSurface *surface = widget()->windowSurface();
+ QWindowSurface *surface = window()->widget()->windowSurface();
if (surface) {
QRect rect(event->x, event->y, event->width, event->height);
- surface->flush(widget(), rect, QPoint());
+ surface->flush(window()->widget(), rect, QPoint());
}
}
@@ -532,7 +534,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
{
if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) {
if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) {
- QWindowSystemInterface::handleCloseEvent(widget());
+ QWindowSystemInterface::handleCloseEvent(window()->widget());
} else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_PING)) {
xcb_client_message_event_t reply = *event;
@@ -568,7 +570,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
return;
QPlatformWindow::setGeometry(rect);
- QWindowSystemInterface::handleGeometryChange(widget(), rect);
+ QWindowSystemInterface::handleGeometryChange(window()->widget(), rect);
#if XCB_USE_DRI2
if (m_context)
@@ -616,7 +618,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event)
&& (modifiers & Qt::AltModifier))
|| (event->detail == 6 || event->detail == 7));
- QWindowSystemInterface::handleWheelEvent(widget(), event->time,
+ QWindowSystemInterface::handleWheelEvent(window()->widget(), event->time,
local, global, delta, hor ? Qt::Horizontal : Qt::Vertical);
return;
}
@@ -647,22 +649,22 @@ void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_times
buttons ^= button; // X event uses state *before*, Qt uses state *after*
- QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons);
+ QWindowSystemInterface::handleMouseEvent(window()->widget(), time, local, global, buttons);
}
void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *)
{
- QWindowSystemInterface::handleEnterEvent(widget());
+ QWindowSystemInterface::handleEnterEvent(window()->widget());
}
void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *)
{
- QWindowSystemInterface::handleLeaveEvent(widget());
+ QWindowSystemInterface::handleLeaveEvent(window()->widget());
}
void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *)
{
- QWindowSystemInterface::handleWindowActivated(widget());
+ QWindowSystemInterface::handleWindowActivated(window()->widget());
}
void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index e049837253..3ed58b33d3 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -43,7 +43,7 @@
#define QXCBWINDOW_H
#include <QtGui/QPlatformWindow>
-#include <QtGui/QPlatformWindowFormat>
+#include <QtGui/QWindowFormat>
#include <xcb/xcb.h>
#include <xcb/sync.h>
@@ -55,7 +55,7 @@ class QXcbScreen;
class QXcbWindow : public QXcbObject, public QPlatformWindow
{
public:
- QXcbWindow(QWidget *tlw);
+ QXcbWindow(QWindow *window);
~QXcbWindow();
void setGeometry(const QRect &rect);
@@ -73,7 +73,7 @@ public:
QPlatformGLContext *glContext() const;
- xcb_window_t window() const { return m_window; }
+ xcb_window_t xcb_window() const { return m_window; }
void handleExposeEvent(const xcb_expose_event_t *event);
void handleClientMessageEvent(const xcb_client_message_event_t *event);
diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
index 718f09383c..89e6bd7ed7 100644
--- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp
@@ -204,14 +204,14 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoi
Q_XCB_NOOP(connection());
- QXcbWindow *window = static_cast<QXcbWindow *>(widget->window()->platformWindow());
+ QXcbWindow *window = static_cast<QXcbWindow *>(widget->windowHandle()->handle());
extern QWidgetData* qt_widget_data(QWidget *);
QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft();
QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); ++i)
- m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset));
+ m_image->put(window->xcb_window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset));
Q_XCB_NOOP(connection());