diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-05-05 11:50:16 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-05-10 10:38:22 (GMT) |
commit | 6f39ecdabdae9b2132729a2a9940e5febaa420d2 (patch) | |
tree | 87a2fc2be2e0d7a94545b2f9cad16d8facd1abde /src/plugins/platforms | |
parent | e7918f5d940ca0a01bfe71e22e6aedcc2005b65f (diff) | |
download | Qt-6f39ecdabdae9b2132729a2a9940e5febaa420d2.zip Qt-6f39ecdabdae9b2132729a2a9940e5febaa420d2.tar.gz Qt-6f39ecdabdae9b2132729a2a9940e5febaa420d2.tar.bz2 |
Small GL related fixes
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/testlite/qglxintegration.cpp | 30 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.cpp | 13 |
2 files changed, 37 insertions, 6 deletions
diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 88764f3..79596f5 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QDebug> #include <QLibrary> #include <QGLFormat> @@ -54,7 +55,6 @@ #include <dlfcn.h> #endif - QT_BEGIN_NAMESPACE GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) @@ -171,7 +171,11 @@ bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) widget->x(), widget->y(), widget->width(), widget->height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, CWBackPixel|CWBorderPixel|CWColormap, &windowAttribs); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLWidgetSurface::create" << hex << "parent" << parentWindow << "win:" << m_winId << widget; +#endif + XSetWindowBackgroundPixmap(m_xd->display, m_winId, XNone); XMapWindow(m_xd->display, m_winId); XFree(visualInfo); @@ -180,7 +184,15 @@ bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) void QGLXGLWidgetSurface::setGeometry(const QRect& rect) { - XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLWidgetSurface::setGeometry" << rect << hex << m_xd->display << m_winId << "toplevel?" << m_widget->isWindow(); +#endif + //### toplevel QGLWidgets do have a separate X window owned by the surface, but it has a + // local geometry + if (m_widget->isWindow()) + XMoveResizeWindow(m_xd->display, m_winId, 0, 0, rect.width(), rect.height()); + else + XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); } bool QGLXGLWidgetSurface::filterEvent(QEvent *e) @@ -191,12 +203,18 @@ bool QGLXGLWidgetSurface::filterEvent(QEvent *e) // which would otherwise destroy our window along with it. XUnmapWindow(m_xd->display, m_winId); XReparentWindow(m_xd->display, m_winId, m_xd->rootWindow(), 0, 0); +#ifdef MYX11_DEBUG + qDebug() << "filterEvent unmap" << hex << m_winId; +#endif } if (e->type() == QEvent::ParentChange) { // Once we've got a new parent, we need to reparent the window and show it again: XReparentWindow(m_xd->display, m_winId, m_widget->window()->winId(), m_widget->x(), m_widget->y()); XMapWindow(m_xd->display, m_winId); +#ifdef MYX11_DEBUG + qDebug() << "filterEvent reparent" << hex << m_winId << "to:" << m_widget->window()->winId(); +#endif } return false; // Allow the event to pass through to QGLWidget @@ -241,6 +259,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC QGLXGLWidgetSurface* surface = static_cast<QGLXGLWidgetSurface*>(glWidget->platformSurface()); m_config = surface->config(); m_drawable = (Drawable)surface->winId(); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create" << hex << m_config << m_drawable; +#endif } else { if (!widget->isTopLevel()) { @@ -254,6 +275,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC } m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create context" << m_context; +#endif // Get the XVisualInfo for the window: // XWindowAttributes windowAttribs; @@ -273,7 +297,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC void QGLXGLContext::makeCurrent() { +#ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); +#endif glXMakeCurrent(m_xd->display, m_drawable, m_context); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 242f335..b5ae4fc 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -69,6 +69,8 @@ #undef ATOM #undef X11 +//#define MYX11_DEBUG + QT_BEGIN_NAMESPACE static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); @@ -158,6 +160,9 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif } width = -1; @@ -673,7 +678,7 @@ GC QTestLiteWindow::createGC() void QTestLiteWindow::paintEvent() { #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; #endif widget()->windowSurface()->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); @@ -694,7 +699,7 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) height = e->height; #ifdef MYX11_DEBUG - qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; #endif QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, width, height)); @@ -833,7 +838,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) } #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << window << "flags" << flags; + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; #endif Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); @@ -963,7 +968,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) void QTestLiteWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << window; + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif if (visible) XMapWindow(xd->display, x_window); |