From ef77c16cb00ef3788e58da8b35cb91eaf2eaa591 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 10 Apr 2014 13:50:01 +0300 Subject: Make HarfBuzz-NG the default shaper on Mac For AAT shaping support, we need either the pre-QPA shaping trick or the new HarfBuzz on Mac; prefer the latter. Disable some test cases aimed to test the HB-old behavior; enable ones that should guarantee shaping-unaware behavior. [ChangeLog][OS X] Use CoreText text shaping engine for support of complex scripts. If required, the shaping engine used in previous versions can be preferred by configuring Qt with -no-harfbuzz. Alternatively, the QT_HARFBUZZ environment variable could be set to "old". Task-number: QTBUG-18980 (relates) Task-number: QTBUG-38246 Change-Id: Iee6fe4f5bc047e77259182b8585385c5febd02b3 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 35950c709b..967ba24fcf 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1556,8 +1556,10 @@ void QTextEngine::itemize() const #ifdef QT_ENABLE_HARFBUZZ_NG analysis = scriptAnalysis.data(); if (useHarfbuzzNG) { + // ### pretend HB-old behavior for now for (int i = 0; i < length; ++i) { switch (analysis[i].script) { + case QChar::Script_Latin: case QChar::Script_Han: case QChar::Script_Hiragana: case QChar::Script_Katakana: -- cgit v1.2.3 From 0ec07b68ad34e135451dd5291732bf73d297ba0c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 10 Apr 2014 13:50:53 +0300 Subject: Improve the Unicode script itemization implementation Make it closer to the Unicode specs (UAX#24): * Common now inherits the preceding character's script, if any; * In a combining character sequence, if the base character is of Common script, the entire sequence is treated like if it were of the first non-Inherited, non-Common script in the sequence. See http://www.unicode.org/reports/tr24/tr24-21.html for more details. [ChangeLog][QtGui] Fixed regression in arabic text rendering. Task-number: QTBUG-28813 Task-number: QTBUG-29930 (related) Task-number: QTBUG-35836 Change-Id: Id85761965b08ca94c674d5f3613fe58b82b2ce9c Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Ahmed Saidi --- src/gui/text/qtextengine.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 967ba24fcf..34788dc4dc 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -122,20 +122,9 @@ private: return; const int end = start + length; for (int i = start + 1; i < end; ++i) { - // According to the unicode spec we should be treating characters in the Common script - // (punctuation, spaces, etc) as being the same script as the surrounding text for the - // purpose of splitting up text. This is important because, for example, a fullstop - // (0x2E) can be used to indicate an abbreviation and so must be treated as part of a - // word. Thus it must be passed along with the word in languages that have to calculate - // word breaks. For example the thai word "ครม." has no word breaks but the word "ครม" - // does. - // Unfortuntely because we split up the strings for both wordwrapping and for setting - // the font and because Japanese and Chinese are also aliases of the script "Common", - // doing this would break too many things. So instead we only pass the full stop - // along, and nothing else. if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel && m_analysis[i].flags == m_analysis[start].flags - && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.')) + && m_analysis[i].script == m_analysis[start].script && m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject && i - start < MaxItemLength) continue; @@ -1515,26 +1504,22 @@ void QTextEngine::itemize() const while (uc < e) { switch (*uc) { case QChar::ObjectReplacementCharacter: - analysis->script = QChar::Script_Common; analysis->flags = QScriptAnalysis::Object; break; case QChar::LineSeparator: if (analysis->bidiLevel % 2) --analysis->bidiLevel; - analysis->script = QChar::Script_Common; analysis->flags = QScriptAnalysis::LineOrParagraphSeparator; if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) *const_cast(uc) = 0x21B5; // visual line separator break; case QChar::Tabulation: - analysis->script = QChar::Script_Common; analysis->flags = QScriptAnalysis::Tab; analysis->bidiLevel = control.baseLevel(); break; case QChar::Space: case QChar::Nbsp: if (option.flags() & QTextOption::ShowTabsAndSpaces) { - analysis->script = QChar::Script_Common; analysis->flags = QScriptAnalysis::Space; analysis->bidiLevel = control.baseLevel(); break; -- cgit v1.2.3 From 7aac93b6ce4e88c8e47c4b2cd8c283daeac5cdb3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 10 Apr 2014 11:49:48 +0200 Subject: Remove internal public function from QOpenGLFunctions QOpenGLContext uses glGetTexLevelParameteriv on desktop OpenGL and so it got recently added to QOpenGLFunctions as part of the dynamic GL loading support. This is unnecessary since such desktop-only code can use the versioned wrappers (QOpenGLFunction_1_0 for example). In related upcoming changes in 5.4 the function is removed. This change has to be backported to 5.3 to prevent introducing this public API unnecessarily. Change-Id: I6fc331091e4e6416e430bf985afcc17a392fc2e3 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qopenglcontext.cpp | 10 ++++++++-- src/gui/opengl/qopenglfunctions.cpp | 25 ++----------------------- src/gui/opengl/qopenglfunctions.h | 24 ------------------------ 3 files changed, 10 insertions(+), 49 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 7382d63a06..dbca05037b 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -61,6 +61,10 @@ #include +#ifndef QT_OPENGL_ES_2 +#include +#endif + QT_BEGIN_NAMESPACE class QOpenGLVersionProfilePrivate @@ -366,7 +370,9 @@ int QOpenGLContextPrivate::maxTextureSize() GLint size; GLint next = 64; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); + QOpenGLFunctions_1_0 *gl1funcs = q->versionFunctions(); + gl1funcs->initializeOpenGLFunctions(); + gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); if (size == 0) { return max_texture_size; } @@ -377,7 +383,7 @@ int QOpenGLContextPrivate::maxTextureSize() if (next > max_texture_size) break; funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); + gl1funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); } while (next > size); max_texture_size = size; diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index eb2c98e1f5..af536fa927 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -2011,12 +2011,6 @@ void QOpenGLFunctions::initializeOpenGLFunctions() This convenience function will do nothing on OpenGL ES 1.x systems. */ -/*! - \fn void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) - - \internal -*/ - /*! \fn bool QOpenGLFunctions::isInitialized(const QOpenGLFunctionsPrivate *d) \internal @@ -3174,15 +3168,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop (target, offset, size, data); } -#ifndef QT_OPENGL_ES_2 -// Desktop only - -static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) -{ - RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params); -} - -#ifndef QT_OPENGL_DYNAMIC +#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC) // Special translation functions for ES-specific calls on desktop GL static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth) @@ -3194,10 +3180,7 @@ static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLcla { ::glDepthRange(zNear, zFar); } - -#endif // QT_OPENGL_DYNAMIC - -#endif // QT_OPENGL_ES2 +#endif // !ES && !DYNAMIC QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) { @@ -3256,8 +3239,6 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) TexParameteriv = qopenglfResolveTexParameteriv; TexSubImage2D = qopenglfResolveTexSubImage2D; Viewport = qopenglfResolveViewport; - - GetTexLevelParameteriv = qopenglfResolveGetTexLevelParameteriv; } else { #ifndef QT_OPENGL_DYNAMIC // Use the functions directly. This requires linking QtGui to an OpenGL implementation. @@ -3308,8 +3289,6 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) TexParameteriv = ::glTexParameteriv; TexSubImage2D = ::glTexSubImage2D; Viewport = ::glViewport; - - GetTexLevelParameteriv = ::glGetTexLevelParameteriv; #else // QT_OPENGL_DYNAMIC // This should not happen. qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities"); diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 03c12200d5..de1de39db2 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -407,9 +407,6 @@ public: void glVertexAttrib4fv(GLuint indx, const GLfloat* values); void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); - // OpenGL1, not GLES2 - void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params); - protected: QOpenGLFunctionsPrivate *d_ptr; static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } @@ -565,9 +562,6 @@ struct QOpenGLFunctionsPrivate void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values); void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); - // OpenGL1 only, not GLES2 - void (QOPENGLF_APIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params); - // Special non-ES OpenGL variants, not to be called directly void (QOPENGLF_APIENTRYP ClearDepth)(GLdouble depth); void (QOPENGLF_APIENTRYP DepthRange)(GLdouble zNear, GLdouble zFar); @@ -2154,24 +2148,6 @@ inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLe Q_OPENGL_FUNCTIONS_DEBUG } -// OpenGL1, not GLES2 - -inline void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) -{ -#ifdef QT_OPENGL_ES_2 - Q_UNUSED(target); - Q_UNUSED(level); - Q_UNUSED(pname); - Q_UNUSED(params); - // Cannot get here. - qFatal("QOpenGLFunctions: glGetTexLevelParameteriv not available with OpenGL ES"); -#else - Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); - d_ptr->GetTexLevelParameteriv(target, level, pname, params); -#endif - Q_OPENGL_FUNCTIONS_DEBUG -} - QT_END_NAMESPACE #endif // QT_NO_OPENGL -- cgit v1.2.3 From d449c0e0e4e39606e0421090b9356c46bc29030c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 22 Jan 2014 14:17:31 +0100 Subject: When a window loses focus to a popup, event has PopupFocusReason MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to debe31e047060d790fb32c06e514d9df476df8bf : a popup window can have focus, but a QQuickWindow needs to know why it loses focus when a menu is opened, so that for example copy/cut/paste Actions can apply to the text which did have focus before the menu opened. The event's focus reason provides enough information to deal with this situation. Task-number: QTBUG-36292 Task-number: QTBUG-36332 Change-Id: Ifae999a364a61b125a4764c9db204a167bddf0b7 Reviewed-by: Jørgen Lind --- src/gui/kernel/qguiapplication.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index bdedc9d75f..ab71fe9081 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1872,7 +1872,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate return; if (previous) { - QFocusEvent focusOut(QEvent::FocusOut, e->reason); + Qt::FocusReason r = e->reason; + if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) && + newFocus && (newFocus->flags() & Qt::Popup) == Qt::Popup) + r = Qt::PopupFocusReason; + QFocusEvent focusOut(QEvent::FocusOut, r); QCoreApplication::sendSpontaneousEvent(previous, &focusOut); QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)), qApp, SLOT(_q_updateFocusObject(QObject*))); @@ -1881,7 +1885,11 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate } if (QGuiApplicationPrivate::focus_window) { - QFocusEvent focusIn(QEvent::FocusIn, e->reason); + Qt::FocusReason r = e->reason; + if ((r == Qt::OtherFocusReason || r == Qt::ActiveWindowFocusReason) && + previous && (previous->flags() & Qt::Popup) == Qt::Popup) + r = Qt::PopupFocusReason; + QFocusEvent focusIn(QEvent::FocusIn, r); QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn); QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)), qApp, SLOT(_q_updateFocusObject(QObject*))); -- cgit v1.2.3