src/opengl/qwindowsurface_gl.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/opengl/qwindowsurface_gl.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/opengl/qwindowsurface_gl.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -49,12 +49,12 @@
 #include <qglpixelbuffer.h>
 #include <qcolormap.h>
 #include <qdesktopwidget.h>
+#include <private/qwidget_p.h>
 #include "qdebug.h"
 
 #ifdef Q_WS_X11
 #include <private/qt_x11_p.h>
 #include <qx11info_x11.h>
-#include <private/qwidget_p.h>
 
 #ifndef QT_OPENGL_ES
 #include <GL/glx.h>
@@ -195,6 +195,9 @@
         if (!initializing && !widget && !cleanedUp) {
             initializing = true;
             widget = new QGLWidget;
+            // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+            if (QWidgetPrivate::allWidgets)
+                QWidgetPrivate::allWidgets->remove(widget);
             initializing = false;
         }
         return widget;
@@ -364,14 +367,14 @@
     if (ctxpriv->eglSurface == EGL_NO_SURFACE) {
         qWarning() << "hijackWindow() could not create EGL surface";
     }
-    qDebug("QGLWindowSurface - using EGLConfig %d", ctxpriv->eglContext->config());
+    qDebug("QGLWindowSurface - using EGLConfig %d", reinterpret_cast<int>(ctxpriv->eglContext->config()));
 #endif
 
     widgetPrivate->extraData()->glContext = ctx;
 
     union { QGLContext **ctxPtr; void **voidPtr; };
 
-    connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(deleted(QObject *)));
+    connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(deleted(QObject*)));
 
     voidPtr = &widgetPrivate->extraData()->glContext;
     d_ptr->contexts << ctxPtr;
@@ -490,7 +493,6 @@
             }
 #endif
             d_ptr->paintedRegion = QRegion();
-
             context()->swapBuffers();
         } else {
             glFlush();
@@ -622,7 +624,7 @@
 
         QGLShaderProgram *blitProgram =
             QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram();
-        blitProgram->enable();
+        blitProgram->bind();
         blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/);
 
         // The shader manager's blit program does not multiply the
@@ -685,11 +687,13 @@
     d_ptr->size = rect.size();
 
     if (d_ptr->ctx) {
+#ifndef QT_OPENGL_ES_2
         if (d_ptr->destructive_swap_buffers) {
             glBindTexture(target, d_ptr->tex_id);
             glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
             glBindTexture(target, 0);
         }
+#endif
         return;
     }
 
@@ -753,11 +757,7 @@
 
             glMatrixMode(GL_PROJECTION);
             glLoadIdentity();
-#ifndef QT_OPENGL_ES
             glOrtho(0, d_ptr->pb->width(), d_ptr->pb->height(), 0, -999999, 999999);
-#else
-            glOrthof(0, d_ptr->pb->width(), d_ptr->pb->height(), 0, -999999, 999999);
-#endif
 
             d_ptr->pb->d_ptr->qctx->d_func()->internal_context = true;
             return;
@@ -771,6 +771,7 @@
 
     ctx->makeCurrent();
 
+#ifndef QT_OPENGL_ES_2
     if (d_ptr->destructive_swap_buffers) {
         glGenTextures(1, &d_ptr->tex_id);
         glBindTexture(target, d_ptr->tex_id);
@@ -780,6 +781,7 @@
         glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
         glBindTexture(target, 0);
     }
+#endif
 
     qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this;;
     d_ptr->ctx = ctx;