Ensure the itemTransform in QInputPanel is always up to date
authorLars Knoll <lars.knoll@nokia.com>
Wed, 7 Sep 2011 19:55:47 +0000 (21:55 +0200)
committerLars Knoll <lars.knoll@nokia.com>
Thu, 8 Sep 2011 08:33:48 +0000 (10:33 +0200)
Hook into the render loop and update the itemTransform in
the QInputPanel before we repaint.

Change-Id: If9122ba0fbe31cff3bfcc3edc48f684cc9b16984
Reviewed-on: http://codereview.qt-project.org/4405
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Vesa Rantanen <vesa.rantanen@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/declarative/items/qsgcanvas.cpp
src/declarative/items/qsgcanvas_p.h

index 979fc16..6e81656 100644 (file)
@@ -70,6 +70,13 @@ DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP)
 
 extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
 
+void QSGCanvasRenderLoop::updateFocusItemTransform()
+{
+    QSGItem *focus = renderer->activeFocusItem();
+    if (focus && qApp->inputPanel()->inputItem() == focus)
+        qApp->inputPanel()->setInputItemTranform(QSGItemPrivate::get(focus)->itemToCanvasTransform());
+}
+
 class QSGCanvasPlainRenderLoop : public QObject, public QSGCanvasRenderLoop
 {
 public:
@@ -85,6 +92,7 @@ public:
     virtual void paint() {
         if (animationRunning && animationDriver())
             animationDriver()->advance();
+        updateFocusItemTransform();
         syncSceneGraph();
         makeCurrent();
         glViewport(0, 0, size.width(), size.height());
@@ -2030,6 +2038,7 @@ void QSGCanvasRenderThread::sync(bool guiAlreadyLocked)
     renderThreadAwakened = false;
 
     polishItems();
+    updateFocusItemTransform();
 
     wake();
     wait();
index acd52a8..b0c63f0 100644 (file)
@@ -68,6 +68,7 @@
 #include <qopenglcontext.h>
 #include <QtGui/qopenglframebufferobject.h>
 #include <QtGui/qevent.h>
+#include <QtGui/qinputpanel.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -204,6 +205,7 @@ protected:
     void renderSceneGraph(const QSize &size) { d->renderSceneGraph(size); }
     void polishItems() { d->polishItems(); }
     QAnimationDriver *animationDriver() const { return d->animationDriver; }
+    void updateFocusItemTransform();
 
     inline QOpenGLContext *glContext() const { return gl; }
     void createGLContext();