diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-26 10:01:56 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-26 10:02:56 +0100 |
commit | ee6aa999ab0439dcb7a95af3dc9905a6daf13491 (patch) | |
tree | 8c83fc72ce62676b8431a1226f9cb9d6f39da4a0 /src/quick | |
parent | f449534020adc8623ebfced5daae331ef56c4421 (diff) | |
parent | ce38c71b1c300f700a9ff004b7c163cc290ecae9 (diff) |
Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative into stable
Change-Id: I0bf06be69927d5961f1bdb4948c3572ef6111923
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/designer/designerwindowmanager.cpp | 4 | ||||
-rw-r--r-- | src/quick/designer/designerwindowmanager_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 15 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextnode.cpp | 7 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 22 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 12 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 41 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop_p.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop_p.h | 2 |
14 files changed, 84 insertions, 28 deletions
diff --git a/src/quick/designer/designerwindowmanager.cpp b/src/quick/designer/designerwindowmanager.cpp index c4a95d254b..25ea5e7f93 100644 --- a/src/quick/designer/designerwindowmanager.cpp +++ b/src/quick/designer/designerwindowmanager.cpp @@ -90,10 +90,6 @@ QImage DesignerWindowManager::grab(QQuickWindow *) return QImage(); } -void DesignerWindowManager::resize(QQuickWindow *, const QSize &) -{ -} - void DesignerWindowManager::maybeUpdate(QQuickWindow *) { } diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h index 1bab8c8508..7414f4e3ba 100644 --- a/src/quick/designer/designerwindowmanager_p.h +++ b/src/quick/designer/designerwindowmanager_p.h @@ -82,7 +82,6 @@ public: void makeOpenGLContext(QQuickWindow *window); void exposureChanged(QQuickWindow *window); QImage grab(QQuickWindow *window); - void resize(QQuickWindow *window, const QSize &size); void maybeUpdate(QQuickWindow *window); void update(QQuickWindow *window); // identical for this implementation. diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index ebc32c89eb..a5b78b28e1 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -188,6 +188,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickTextEdit>(uri,major,minor,"TextEdit"); qmlRegisterType<QQuickTextEdit,1>(uri,2,1,"TextEdit"); qmlRegisterType<QQuickTextInput>(uri,major,minor,"TextInput"); + qmlRegisterType<QQuickTextInput,2>(uri,2,2,"TextInput"); qmlRegisterType<QQuickViewSection>(uri,major,minor,"ViewSection"); qmlRegisterType<QQuickItemLayer>(); diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 93ea677d2c..b46387ba47 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1212,6 +1212,17 @@ bool QQuickTextInput::hasAcceptableInput() const state. */ +/*! + \qmlsignal QtQuick::TextInput::onEditingFinished() + \since 5.2 + + This handler is called when the Return or Enter key is pressed or + the text input loses focus. Note that if there is a validator or + inputMask set on the text input and enter/return is pressed, this + handler will only be called if the input follows + the inputMask and the validator returns an acceptable state. +*/ + #ifndef QT_NO_IM Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const { @@ -2522,6 +2533,9 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) && !persistentSelection) deselect(); + if (hasAcceptableInput(m_text) || fixup()) + emit q->editingFinished(); + #ifndef QT_NO_IM q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); @@ -4105,6 +4119,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput(m_text) || fixup()) { emit q->accepted(); + emit q->editingFinished(); } event->ignore(); return; diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 2b72afb9dc..5f0250aaf1 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -284,6 +284,7 @@ Q_SIGNALS: void selectedTextChanged(); void accepted(); void acceptableInputChanged(); + Q_REVISION(2) void editingFinished(); void colorChanged(); void selectionColorChanged(); void selectedTextColorChanged(); diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index dd314c892d..18ee1a479d 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -143,10 +143,13 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun QSGNode *parentNode) { QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext(); - QRawFontPrivate *fontP = QRawFontPrivate::get(glyphs.rawFont()); - QSGGlyphNode *node = m_useNativeRenderer || !fontP->fontEngine->smoothScalable + QRawFont font = glyphs.rawFont(); + bool smoothScalable = QFontDatabase().isSmoothlyScalable(font.familyName(), + font.styleName()); + QSGGlyphNode *node = m_useNativeRenderer || !smoothScalable ? sg->sceneGraphContext()->createNativeGlyphNode(sg) : sg->sceneGraphContext()->createGlyphNode(sg); + node->setOwnerElement(m_ownerElement); node->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs); node->setStyle(style); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f65ff469a5..3a8e177bbb 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -216,6 +216,7 @@ void QQuickWindow::exposeEvent(QExposeEvent *) /*! \reimp */ void QQuickWindow::resizeEvent(QResizeEvent *) { + d_func()->windowManager->resize(this); } /*! \reimp */ @@ -774,23 +775,24 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, oldActiveFocusItem = activeFocusItem; newActiveFocusItem = scope; - Q_ASSERT(oldActiveFocusItem); - #ifndef QT_NO_IM qApp->inputMethod()->commit(); #endif activeFocusItem = 0; - QFocusEvent event(QEvent::FocusOut, reason); - q->sendEvent(oldActiveFocusItem, &event); - QQuickItem *afi = oldActiveFocusItem; - while (afi && afi != scope) { - if (QQuickItemPrivate::get(afi)->activeFocus) { - QQuickItemPrivate::get(afi)->activeFocus = false; - changed << afi; + if (oldActiveFocusItem) { + QFocusEvent event(QEvent::FocusOut, reason); + q->sendEvent(oldActiveFocusItem, &event); + + QQuickItem *afi = oldActiveFocusItem; + while (afi && afi != scope) { + if (QQuickItemPrivate::get(afi)->activeFocus) { + QQuickItemPrivate::get(afi)->activeFocus = false; + changed << afi; + } + afi = afi->parentItem(); } - afi = afi->parentItem(); } } diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp index 909def2c19..2849eff304 100644 --- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp +++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp @@ -222,7 +222,7 @@ QByteArray qsgShaderRewriter_insertZAttributes(const char *input, QSurfaceFormat braceDepth--; if (braceDepth == 0) { result += QByteArray::fromRawData(voidPos, tok.pos - 1 - voidPos); - result += QByteArrayLiteral(" gl_Position.z = gl_Position.z * _qt_zRange + _qt_order;\n"); + result += QByteArrayLiteral(" gl_Position.z = (gl_Position.z * _qt_zRange + _qt_order) * gl_Position.w;\n"); result += QByteArray(tok.pos - 1); return result; } diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index fa095b8165..afde7939f2 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -340,6 +340,7 @@ QSGRenderContext::QSGRenderContext(QSGContext *context) , m_depthStencilManager(0) , m_distanceFieldCacheManager(0) , m_brokenIBOs(false) + , m_serializedRender(false) { } @@ -348,8 +349,13 @@ QSGRenderContext::~QSGRenderContext() invalidate(); } +static QBasicMutex qsg_framerender_mutex; + void QSGRenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) { + if (m_serializedRender) + qsg_framerender_mutex.lock(); + if (fboId) { QSGBindableFboId bindable(fboId); renderer->renderScene(bindable); @@ -357,6 +363,9 @@ void QSGRenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) renderer->renderScene(); } + if (m_serializedRender) + qsg_framerender_mutex.unlock(); + } /*! @@ -442,6 +451,9 @@ void QSGRenderContext::initialize(QOpenGLContext *context) const char *vendor = (const char *) glGetString(GL_VENDOR); if (strstr(vendor, "nouveau")) m_brokenIBOs = true; + const char *renderer = (const char *) glGetString(GL_RENDERER); + if (strstr(renderer, "llvmpipe")) + m_serializedRender = true; #endif emit initialized(); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 270f108373..c562a909c5 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -132,6 +132,7 @@ protected: QSet<QFontEngine *> m_fontEnginesToClean; bool m_brokenIBOs; + bool m_serializedRender; }; diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index 7b06399f08..72bad16c63 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -61,6 +61,7 @@ public: virtual void show(QQuickWindow *window) = 0; virtual void hide(QQuickWindow *window) = 0; + virtual void resize(QQuickWindow *) {}; virtual void windowDestroyed(QQuickWindow *window) = 0; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 0c46747e53..850a463c3e 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -402,8 +402,8 @@ bool QSGRenderThread::event(QEvent *e) case WM_TryRelease: { QSG_RT_DEBUG("WM_TryRelease"); mutex.lock(); - if (!window) { - WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e); + WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e); + if (!window || wme->inDestructor) { QSG_RT_DEBUG(" - setting exit flag and invalidating GL"); invalidateOpenGL(wme->window, wme->inDestructor); active = gl; @@ -506,7 +506,10 @@ void QSGRenderThread::sync() Q_ASSERT_X(wm->m_locked, "QSGRenderThread::sync()", "sync triggered on bad terms as gui is not already locked..."); - if (windowSize.width() > 0 && windowSize.height() > 0) { + bool current = false; + if (windowSize.width() > 0 && windowSize.height() > 0) + current = gl->makeCurrent(window); + if (current) { gl->makeCurrent(window); QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); bool hadRenderer = d->renderer != 0; @@ -578,8 +581,10 @@ void QSGRenderThread::syncAndRender() d->animationController->unlock(); } - if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0) { - gl->makeCurrent(window); + bool current = false; + if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0) + current = gl->makeCurrent(window); + if (current) { d->renderSceneGraph(windowSize); #ifndef QSG_NO_RENDER_TIMING if (profileFrames) @@ -654,10 +659,8 @@ void QSGRenderThread::run() while (active) { if (window) { - if (!sgrc->openglContext()) { - gl->makeCurrent(window); + if (!sgrc->openglContext() && windowSize.width() > 0 && windowSize.height() > 0 && gl->makeCurrent(window)) sgrc->initialize(gl); - } syncAndRender(); } @@ -814,6 +817,7 @@ void QSGThreadedRenderLoop::show(QQuickWindow *window) win.thread = new QSGRenderThread(this, QQuickWindowPrivate::get(window)->context); win.timerId = 0; win.updateDuringSync = false; + win.gotBrokenExposeFromPlatformPlugin = false; m_windows << win; } @@ -879,6 +883,18 @@ void QSGThreadedRenderLoop::exposureChanged(QQuickWindow *window) } } +void QSGThreadedRenderLoop::resize(QQuickWindow *window) +{ + Window *w = windowFor(m_windows, window); + if (w + && w->gotBrokenExposeFromPlatformPlugin + && window->width() > 0 && window->height() > 0 + && w->window->geometry().intersects(w->window->screen()->availableGeometry())) { + w->gotBrokenExposeFromPlatformPlugin = false; + handleExposure(w); + } +} + /*! Will post an event to the render thread that this window should @@ -888,6 +904,15 @@ void QSGThreadedRenderLoop::handleExposure(Window *w) { QSG_GUI_DEBUG(w->window, "handleExposure"); + if (w->window->width() <= 0 || w->window->height() <= 0 + || !w->window->geometry().intersects(w->window->screen()->availableGeometry())) { +#ifndef QT_NO_DEBUG + qWarning("QSGThreadedRenderLoop: expose event received for window with invalid geometry."); +#endif + w->gotBrokenExposeFromPlatformPlugin = true; + return; + } + // Because we are going to bind a GL context to it, make sure it // is created. if (!w->window->handle()) diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index 5943d0bd08..844d180788 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -60,6 +60,7 @@ public: void show(QQuickWindow *window); void hide(QQuickWindow *window); + void resize(QQuickWindow *window); void windowDestroyed(QQuickWindow *window); void exposureChanged(QQuickWindow *window); @@ -89,6 +90,7 @@ private: QSGRenderThread *thread; int timerId; uint updateDuringSync : 1; + uint gotBrokenExposeFromPlatformPlugin : 1; }; friend class QSGRenderThread; diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h index ff5529646b..e4ee688c9f 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop_p.h +++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h @@ -81,8 +81,6 @@ public: void render(); void renderWindow(QQuickWindow *window); - void resize(QQuickWindow *, const QSize &) { } - bool event(QEvent *event); bool anyoneShowing() const; |