summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.pro3
-rw-r--r--src/gui/image/qimage.cpp3
-rw-r--r--src/gui/kernel/qevent.cpp9
-rw-r--r--src/gui/kernel/qguiapplication.cpp9
-rw-r--r--src/gui/kernel/qguiapplication_p.h7
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp41
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h3
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp12
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp.cpp6
-rw-r--r--src/gui/painting/qpagelayout.cpp33
-rw-r--r--src/gui/painting/qpagesize.cpp14
-rw-r--r--src/gui/painting/qpathclipper.cpp8
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp3
14 files changed, 75 insertions, 78 deletions
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 55837bcf3b..462f133ff8 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -23,8 +23,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
-load(qt_module)
-
# Code coverage with TestCocoon
# The following is required as extra compilers use $$QMAKE_CXX instead of $(CXX).
# Without this, testcocoon.prf is read only after $$QMAKE_CXX is used by the
@@ -50,6 +48,7 @@ include(itemmodels/itemmodels.pri)
QMAKE_LIBS += $$QMAKE_LIBS_GUI
+load(qt_module)
load(cmake_functions)
win32: CMAKE_WINDOWS_BUILD = True
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 37b7b18522..f902f1b715 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4416,7 +4416,8 @@ QImage QImage::smoothScaled(int w, int h) const {
src = src.convertToFormat(QImage::Format_RGB32);
}
src = qSmoothScaleImage(src, w, h);
- copyMetadata(src.d, d);
+ if (!src.isNull())
+ copyMetadata(src.d, d);
return src;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 78a4dc4f35..d8b1367833 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -761,6 +761,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
g = QCursor::pos();
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
@@ -796,6 +798,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
else
@@ -832,7 +836,10 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
-{}
+{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
+}
/*!
Constructs a wheel event object.
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1d050bba97..a79a602088 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -199,6 +199,9 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true;
QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
+// enable the fix for QTBUG-50199; TODO remove this check in 5.7
+bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false;
+
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
@@ -587,7 +590,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
: QCoreApplication(p)
{
- d_func()->init(); }
+}
/*!
Destructs the application.
@@ -1300,6 +1303,8 @@ void QGuiApplicationPrivate::eventDispatcherReady()
void QGuiApplicationPrivate::init()
{
+ QCoreApplicationPrivate::init();
+
QCoreApplicationPrivate::is_app_running = false; // Starting up.
bool loadTestability = false;
@@ -1453,6 +1458,8 @@ void QGuiApplicationPrivate::init()
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
+
+ scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING");
}
extern void qt_cleanupFontDatabase();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index c1efb5c0c0..830d716ed8 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -81,6 +81,8 @@ public:
QGuiApplicationPrivate(int &argc, char **argv, int flags);
~QGuiApplicationPrivate();
+ void init();
+
void createPlatformIntegration();
void createEventDispatcher() Q_DECL_OVERRIDE;
void eventDispatcherReady() Q_DECL_OVERRIDE;
@@ -300,6 +302,9 @@ public:
static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false);
+ // enable the fix for QTBUG-50199; TODO remove this check in 5.7
+ static bool scrollNoPhaseAllowed;
+
protected:
virtual void notifyThemeChanged();
bool tryCloseRemainingWindows(QWindowList processedWindows);
@@ -310,8 +315,6 @@ protected:
private:
friend class QDragManager;
- void init();
-
static QGuiApplicationPrivate *self;
static QTouchDevice *m_fakeTouchDevice;
static int m_fakeMouseSourcePointId;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 7547e58346..01e27d72d4 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -318,6 +318,9 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local,
void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
Qt::MouseEventSource source, bool invertedScrolling)
{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase)
+ phase = Qt::ScrollUpdate;
+
// Qt 4 sends two separate wheel events for horizontal and vertical
// deltas. For Qt 5 we want to send the deltas in one event, but at the
// same time preserve source and behavior compatibility with Qt 4.
@@ -865,7 +868,9 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QP
{
bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleMouseEvent(w, timestamp, local, global, b, mods);
+ const qreal factor = QHighDpiScaling::factor(w);
+ QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor,
+ global * factor, b, mods);
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}
@@ -914,36 +919,14 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
#endif
}
-static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
-{
- QWindowSystemInterface::TouchPoint p;
- p.id = pt.id();
- p.flags = pt.flags();
- p.normalPosition = pt.normalizedPos();
- p.area = pt.screenRect();
- p.pressure = pt.pressure();
- p.state = pt.state();
- p.velocity = pt.velocity();
- p.rawPositions = pt.rawScreenPositions();
- return p;
-}
-static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
-{
- QList<struct QWindowSystemInterface::TouchPoint> newList;
- newList.reserve(pointList.size());
- for (const QTouchEvent::TouchPoint &p : pointList)
- newList.append(touchPoint(p));
-
- return newList;
-}
-
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
{
bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods);
+ QWindowSystemInterface::handleTouchEvent(w, device,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);
QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
}
@@ -958,5 +941,13 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
return true;
}
+QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD,
+ QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted)
+ : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),
+ qt4Orientation(qt4O), localPos(local), globalPos(global),
+ phase(!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase ? Qt::ScrollUpdate : phase),
+ source(src), inverted(inverted)
+{
+}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 4bb0e83a97..3ccf815c54 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -242,8 +242,7 @@ public:
class WheelEvent : public InputEvent {
public:
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
- Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false)
- : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted) { }
+ Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false);
QPoint pixelDelta;
QPoint angleDelta;
int qt4Delta;
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 5cbcdf83d4..ba0d1871d1 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -147,12 +147,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom())
return;
- int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
- int lasty = stroker->spans[stroker->current_span-1].y;
+ if (stroker->current_span > 0) {
+ const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
+ const int lasty = stroker->spans[stroker->current_span-1].y;
- if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) {
- stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData);
- stroker->current_span = 0;
+ if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) {
+ stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData);
+ stroker->current_span = 0;
+ }
}
stroker->spans[stroker->current_span].x = ushort(x);
diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp
index 81ae0f43ba..b72ca3da3d 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp.cpp
+++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp
@@ -495,7 +495,7 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l
const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ const uchar *line = data->texture.scanLine(y) + x * 3;
fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
return buffer;
}
@@ -503,7 +503,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const
const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ const uchar *line = data->texture.scanLine(y) + x * 2;
fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
return buffer;
}
@@ -511,7 +511,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const
const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ const uchar *line = data->texture.scanLine(y) + x * 3;
fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
return buffer;
}
diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp
index 317e6d241a..f3f7f5f956 100644
--- a/src/gui/painting/qpagelayout.cpp
+++ b/src/gui/painting/qpagelayout.cpp
@@ -949,40 +949,37 @@ QRect QPageLayout::paintRectPixels(int resolution) const
QDebug operator<<(QDebug dbg, const QPageLayout &layout)
{
QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ dbg.noquote();
+ dbg << "QPageLayout(";
if (layout.isValid()) {
- QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)");
- QString units;
+ const QMarginsF margins = layout.margins();
+ dbg << '"' << layout.pageSize().name() << "\", "
+ << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape")
+ << ", l:" << margins.left() << " r:" << margins.right() << " t:"
+ << margins.top() << " b:" << margins.bottom() << ' ';
switch (layout.units()) {
case QPageLayout::Millimeter:
- units = QStringLiteral("mm");
+ dbg << "mm";
break;
case QPageLayout::Point:
- units = QStringLiteral("pt");
+ dbg << "pt";
break;
case QPageLayout::Inch:
- units = QStringLiteral("in");
+ dbg << "in";
break;
case QPageLayout::Pica:
- units = QStringLiteral("pc");
+ dbg << "pc";
break;
case QPageLayout::Didot:
- units = QStringLiteral("DD");
+ dbg << "DD";
break;
case QPageLayout::Cicero:
- units = QStringLiteral("CC");
+ dbg << "CC";
break;
}
- output = output.arg(layout.pageSize().name())
- .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape"))
- .arg(layout.margins().left())
- .arg(layout.margins().right())
- .arg(layout.margins().top())
- .arg(layout.margins().bottom())
- .arg(units);
- dbg.nospace() << output;
- } else {
- dbg.nospace() << "QPageLayout()";
}
+ dbg << ')';
return dbg;
}
#endif
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index c5a2e7288b..f53285d9cb 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -1861,17 +1861,17 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution)
QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
{
QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ dbg.noquote();
+ dbg << "QPageSize(";
if (pageSize.isValid()) {
- QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)");
- output = output.arg(pageSize.name())
- .arg(pageSize.key())
- .arg(pageSize.sizePoints().width())
- .arg(pageSize.sizePoints().height())
- .arg(pageSize.id());
- dbg.nospace() << output;
+ dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key()
+ << "\", " << pageSize.sizePoints().width() << 'x'
+ << pageSize.sizePoints().height() << "pt, id=" << pageSize.id();
} else {
dbg.nospace() << "QPageSize()";
}
+ dbg << ')';
return dbg;
}
#endif
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 861d651756..48ae3cfc80 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -258,8 +258,6 @@ class SegmentTree
public:
SegmentTree(QPathSegments &segments);
- QRectF boundingRect() const;
-
void produceIntersections(int segment);
private:
@@ -310,12 +308,6 @@ SegmentTree::SegmentTree(QPathSegments &segments)
m_tree[0] = root;
}
-QRectF SegmentTree::boundingRect() const
-{
- return QRectF(QPointF(m_bounds.x1, m_bounds.y1),
- QPointF(m_bounds.x2, m_bounds.y2));
-}
-
static inline qreal coordinate(const QPointF &pos, int axis)
{
return axis == 0 ? pos.x() : pos.y();
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 3207325755..9d62a03f4c 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1075,8 +1075,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
if (glyph_buffer_size < pitch * info.height) {
glyph_buffer_size = pitch * info.height;
glyph_buffer.reset(new uchar[glyph_buffer_size]);
+ memset(glyph_buffer.data(), 0, glyph_buffer_size);
}
- memset(glyph_buffer.data(), 0, glyph_buffer_size);
if (slot->format == FT_GLYPH_FORMAT_OUTLINE) {
FT_Bitmap bitmap;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 3ee6177f3c..fa73507c16 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2753,8 +2753,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
QFixed ellipsisWidth;
QString ellipsisText;
{
- QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common);
- QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast<QFontEngineMulti *>(fe)->engine(0) : fe;
+ QFontEngine *engine = fnt.d->engineForScript(QChar::Script_Common);
QChar ellipsisChar(0x2026);