From 77924a0276674e3dd3627e33c5ea7005e5ee0d13 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Dec 2012 21:40:30 -0800 Subject: Remove some dead code from qtriangulator.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CompareEdges functor class is never used anywhere. Clang saw it through to the static function that never got used: qtriangulator.cpp:227:12: error: unused function 'comparePoints' [-Werror,-Wunused-function] static int comparePoints(const QPodPoint &u, const QPodPoint &v) ^ Change-Id: I67d821e454daf82bd8107bf20f787aff9496e878 Reviewed-by: Samuel Rødal --- src/gui/opengl/qtriangulator.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp index b506ffdc6a..d31c260f3d 100644 --- a/src/gui/opengl/qtriangulator.cpp +++ b/src/gui/opengl/qtriangulator.cpp @@ -220,23 +220,6 @@ static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, c return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; } -// Return: -// -1 if u < v -// 0 if u == v -// 1 if u > v -static int comparePoints(const QPodPoint &u, const QPodPoint &v) -{ - if (u.y < v.y) - return -1; - if (u.y > v.y) - return 1; - if (u.x < v.x) - return -1; - if (u.x > v.x) - return 1; - return 0; -} - //============================================================================// // QIntersectionPoint // //============================================================================// @@ -632,16 +615,6 @@ public: bool pointingUp, originallyPointingUp; }; - friend class CompareEdges; - class CompareEdges - { - public: - inline CompareEdges(ComplexToSimple *parent) : m_parent(parent) { } - bool operator () (int i, int j) const; - private: - ComplexToSimple *m_parent; - }; - struct Intersection { bool operator < (const Intersection &other) const {return other.intersectionPoint < intersectionPoint;} @@ -1653,18 +1626,6 @@ void QTriangulator::ComplexToSimple::removeUnusedPoints() { } } -template -bool QTriangulator::ComplexToSimple::CompareEdges::operator () (int i, int j) const -{ - int cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).from), - m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).from)); - if (cmp == 0) { - cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).to), - m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).to)); - } - return cmp > 0; -} - template inline bool QTriangulator::ComplexToSimple::Event::operator < (const Event &other) const { -- cgit v1.2.3 From 248ccb2889aec76cb99c25998534c97b48b98c4a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 11 Dec 2012 14:07:16 +0100 Subject: Fix possible crash in QTextDocument With trailing spaces in some cases, we would not get the "no justification at end of paragraph" special case, and continue in the code, getting the unexpected case where line_length becomes < 0 which would lead to memory corruption because we were writing outside our buffers. I added an assert to catch this type of bug earlier, and I added the trailing spaces to the test for the end of the paragraph. The test case added is one example which would crash. Task-number: QTBUG-27354 Change-Id: Id720a6fa55dbc709ce04dd5321e55687bf960d75 Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 82cff6a043..37d6276f6b 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1852,7 +1852,7 @@ void QTextEngine::justify(const QScriptLine &line) itemize(); if (!forceJustification) { - int end = line.from + (int)line.length; + int end = line.from + (int)line.length + line.trailingSpaces; if (end == layoutData->string.length()) return; // no justification at end of paragraph if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) @@ -1907,6 +1907,8 @@ void QTextEngine::justify(const QScriptLine &line) int gs = log_clusters[start]; int ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]); + Q_ASSERT(ge <= si.num_glyphs); + const QGlyphLayout g = shapedGlyphs(&si); for (int i = gs; i < ge; ++i) { -- cgit v1.2.3 From 4250fa2cf607a21dedc0588497498f82e77fb390 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 2 Jan 2013 14:21:36 +0100 Subject: Revert "Enable module build with QT_NO_ACCESSIBILITY" This reverts commit b7f63c6bf74a0eb62bb49c1085584da1b3714a06. It made compilation fail in qstylehelper_p.h if QT_NO_ACCESSIBILITY was defined - which it is by default on linux without dbus. Change-Id: I313f5138460d28c44dad128d175df0e53a99287d Reviewed-by: Jens Bache-Wiig Reviewed-by: Frederik Gladhorn --- src/gui/accessible/qaccessible.cpp | 14 ++++++++++---- src/gui/accessible/qaccessible.h | 3 --- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 47d159380d..f55037c37a 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY - /*! \class QAccessible \brief The QAccessible class provides enums and static functions @@ -439,19 +437,23 @@ QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0; static bool accessibility_active = false; static bool cleanupAdded = false; +#ifndef QT_NO_ACCESSIBILITY static QPlatformAccessibility *platformAccessibility() { QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); return pfIntegration ? pfIntegration->accessibility() : 0; } +#endif /*! \internal */ void QAccessible::cleanup() { +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->cleanup(); +#endif } static void qAccessibleCleanup() @@ -595,8 +597,10 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) mo = mo->superClass(); } +#ifndef QT_NO_ACCESSIBILITY if (object == qApp) return new QAccessibleApplication; +#endif return 0; } @@ -636,8 +640,10 @@ void QAccessible::setRootObject(QObject *object) return; } +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->setRootObject(object); +#endif } /*! @@ -669,8 +675,10 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event) if (!isActive()) return; +#ifndef QT_NO_ACCESSIBILITY if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) pfAccessibility->notifyAccessibilityUpdate(event); +#endif } #if QT_DEPRECATED_SINCE(5, 0) @@ -1524,7 +1532,5 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) #endif -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 5bcf9e7d0d..5f61634ba2 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -57,7 +57,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#ifndef QT_NO_ACCESSIBILITY class QAccessibleInterface; class QAccessibleEvent; @@ -677,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r } #endif -#endif // QT_NO_ACCESSIBILITY - QT_END_NAMESPACE QT_END_HEADER -- cgit v1.2.3 From cf2a75e41bc6715958d170d42f37fc6bb609f830 Mon Sep 17 00:00:00 2001 From: Jon Severinsson Date: Tue, 23 Oct 2012 18:52:29 +0200 Subject: Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons() Previous commit b2363a935c8dac fixed keyboardModifiers() after QPA event processing, but broke QTestLib, which expects spontaneous input events sent to qApp->notify() to update keyboardModifiers() and mouseButtons(). The commit also did not fix mouseButtons() after QPA event processing, and missed keyboardModifiers() after QPA Tablet event processing. This commit fixes all these shortcommings in b2363a935c8dac. Includes test case by David Faure Task-Number: QTBUG-26887 Change-Id: I8518b06c4ce86ea7b35120e3353a45ea2a81d356 Reviewed-by: David Faure (KDE) Reviewed-by: Lars Knoll --- src/gui/kernel/qguiapplication.cpp | 7 +++++-- src/gui/kernel/qwindowsysteminterface_p.h | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 72e95c996c..190d52776a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1392,7 +1392,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo // Ignore mouse events that don't change the current state. return; } - buttons = e->buttons; + mouse_buttons = buttons = e->buttons; if (button & e->buttons) { ulong doubleClickInterval = static_cast(qApp->styleHints()->mouseDoubleClickInterval()); doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; @@ -1688,7 +1688,10 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T type = e->down ? QEvent::TabletPress : QEvent::TabletRelease; tabletState = e->down; } + QWindow *window = e->window.data(); + modifier_buttons = e->modifiers; + bool localValid = true; // If window is null, pick one based on the global position and make sure all // subsequent events up to the release are delivered to that same window. @@ -1719,7 +1722,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T QTabletEvent ev(type, local, e->global, e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, e->tangentialPressure, e->rotation, e->z, - e->mods, e->uid); + e->modifiers, e->uid); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(window, &ev); #else diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index e8d2a85dd9..dfdf7e9e93 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -302,10 +302,10 @@ public: TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure, qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods) - : InputEvent(w, time, Tablet, Qt::NoModifier), + : InputEvent(w, time, Tablet, mods), down(down), local(local), global(global), device(device), pointerType(pointerType), pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure), - rotation(rotation), z(z), uid(uid), mods(mods) { } + rotation(rotation), z(z), uid(uid) { } bool down; QPointF local; QPointF global; @@ -318,7 +318,6 @@ public: qreal rotation; int z; qint64 uid; - Qt::KeyboardModifiers mods; }; class TabletEnterProximityEvent : public InputEvent { -- cgit v1.2.3 From bd04a3d136ed3384aa754f288201b5675a912596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 4 Jan 2013 10:06:08 +0100 Subject: Fixed wrong emits of x/y/width/height changed signals in QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should only emit these when the corresponding property value changes. Since these are changed asynchronously in the case of a platform window, we should not emit them in the setter, as they are already properly emitted in QGuiApplicationPrivate::processGeometryChangeEvent(). Change-Id: I5ac00601ddb4e7a8ff02376e5f5135d427913119 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b6d592e050..22ad748fb5 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1105,16 +1105,16 @@ void QWindow::setGeometry(const QRect &rect) d->platformWindow->setGeometry(rect); } else { d->geometry = rect; - } - if (rect.x() != oldRect.x()) - emit xChanged(rect.x()); - if (rect.y() != oldRect.y()) - emit yChanged(rect.y()); - if (rect.width() != oldRect.width()) - emit widthChanged(rect.width()); - if (rect.height() != oldRect.height()) - emit heightChanged(rect.height()); + if (rect.x() != oldRect.x()) + emit xChanged(rect.x()); + if (rect.y() != oldRect.y()) + emit yChanged(rect.y()); + if (rect.width() != oldRect.width()) + emit widthChanged(rect.width()); + if (rect.height() != oldRect.height()) + emit heightChanged(rect.height()); + } } /*! -- cgit v1.2.3