From 3f885939c059605a9324a94e488793455c9cd848 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 5 May 2014 08:41:22 +0300 Subject: WinRT: Fix multi-touch on PC The pointer ID was incorrectly interpreted as a device ID, which caused creating a new QTouchDevice for each touch update and potential crashes in QtQuick. The handling has now been simplified and aligned with Windows Phone, treating all touch events as if they originate from the same device. Given that the native device has no ID, it is not possible to track the native device between events anyway (even the pointer values change). Task-number: QTBUG-38745 Change-Id: I24b6c00b765dcb49cd653638afafc04fdd80f774 Reviewed-by: Oliver Wolff Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 81 ++++++++++------------------ src/plugins/platforms/winrt/qwinrtscreen.h | 9 +--- 2 files changed, 31 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 583441f396..b7bfce5931 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -425,17 +425,8 @@ QWinRTScreen::QWinRTScreen(ICoreWindow *window) #endif , m_cursor(new QWinRTCursor(window)) , m_orientation(Qt::PrimaryOrientation) + , m_touchDevice(Q_NULLPTR) { -#ifdef Q_OS_WINPHONE // On phone, there can be only one touch device - QTouchDevice *touchDevice = new QTouchDevice; - touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure); - touchDevice->setType(QTouchDevice::TouchScreen); - touchDevice->setName(QStringLiteral("WinPhoneTouchScreen")); - Pointer pointer = { Pointer::TouchScreen, touchDevice }; - m_pointers.insert(0, pointer); - QWindowSystemInterface::registerTouchDevice(touchDevice); -#endif - Rect rect; window->get_Bounds(&rect); m_geometry = QRect(0, 0, rect.Width, rect.Height); @@ -762,47 +753,25 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a if (FAILED(pointerPoint->get_Properties(&properties))) return E_INVALIDARG; -#ifdef Q_OS_WINPHONE - quint32 pointerId = 0; - Pointer pointer = m_pointers.value(pointerId); + PointerDeviceType pointerDeviceType; +#if defined(Q_OS_WINPHONE) && _MSC_VER <= 1700 + pointerDeviceType = PointerDeviceType_Touch; #else - Pointer pointer = { Pointer::Unknown, 0 }; - quint32 pointerId; - pointerPoint->get_PointerId(&pointerId); - if (m_pointers.contains(pointerId)) { - pointer = m_pointers.value(pointerId); - } else { // We have not yet enumerated this device. Do so now... - IPointerDevice *device; - if (SUCCEEDED(pointerPoint->get_PointerDevice(&device))) { - PointerDeviceType type; - device->get_PointerDeviceType(&type); - switch (type) { - case PointerDeviceType_Touch: - pointer.type = Pointer::TouchScreen; - pointer.device = new QTouchDevice; - pointer.device->setName(QStringLiteral("WinRT TouchScreen ") + QString::number(pointerId)); - // TODO: We may want to probe the device usage flags for more accurate values for these next two - pointer.device->setType(QTouchDevice::TouchScreen); - pointer.device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure); - QWindowSystemInterface::registerTouchDevice(pointer.device); - break; - - case PointerDeviceType_Pen: - pointer.type = Pointer::Tablet; - break; - - case PointerDeviceType_Mouse: - pointer.type = Pointer::Mouse; - break; - } - - m_pointers.insert(pointerId, pointer); - device->Release(); - } + ComPtr pointerDevice; + HRESULT hr = pointerPoint->get_PointerDevice(&pointerDevice); + if (FAILED(hr)) { + qErrnoWarning(hr, "Failed to get pointer device."); + return S_OK; + } + + hr = pointerDevice->get_PointerDeviceType(&pointerDeviceType); + if (FAILED(hr)) { + qErrnoWarning(hr, "Failed to get pointer device type."); + return S_OK; } #endif - switch (pointer.type) { - case Pointer::Mouse: { + switch (pointerDeviceType) { + case PointerDeviceType_Mouse: { qint32 delta; properties->get_MouseWheelDelta(&delta); if (delta) { @@ -839,7 +808,15 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a break; } - case Pointer::TouchScreen: { + case PointerDeviceType_Touch: { + if (!m_touchDevice) { + m_touchDevice = new QTouchDevice; + m_touchDevice->setName(QStringLiteral("WinRTTouchScreen")); + m_touchDevice->setType(QTouchDevice::TouchScreen); + m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition); + QWindowSystemInterface::registerTouchDevice(m_touchDevice); + } + quint32 id; pointerPoint->get_PointerId(&id); @@ -867,7 +844,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a it.value().normalPosition = QPointF(pos.x()/m_geometry.width(), pos.y()/m_geometry.height()); it.value().pressure = pressure; - QWindowSystemInterface::handleTouchEvent(topWindow(), pointer.device, m_touchPoints.values(), mods); + QWindowSystemInterface::handleTouchEvent(topWindow(), m_touchDevice, m_touchPoints.values(), mods); // Remove released points, station others for (QHash::iterator i = m_touchPoints.begin(); i != m_touchPoints.end();) { @@ -879,7 +856,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a break; } - case Pointer::Tablet: { + case PointerDeviceType_Pen: { quint32 id; pointerPoint->get_PointerId(&id); @@ -902,7 +879,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *window, IPointerEventArgs *a float rotation; properties->get_Twist(&rotation); - QWindowSystemInterface::handleTabletEvent(topWindow(), isPressed, pos, pos, pointerId, + QWindowSystemInterface::handleTabletEvent(topWindow(), isPressed, pos, pos, 0, pointerType, pressure, xTilt, yTilt, 0, rotation, 0, id, mods); diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h index c6511e9446..753d89541c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -101,12 +101,6 @@ class QWinRTPageFlipper; class QWinRTCursor; class QWinRTInputContext; -struct Pointer { - enum Type { Unknown, Mouse, TouchScreen, Tablet }; - Type type; - QTouchDevice *device; -}; - class QWinRTScreen : public QPlatformScreen { public: @@ -165,6 +159,7 @@ private: ABI::Windows::UI::Core::ICoreWindow *m_coreWindow; ABI::Windows::UI::ViewManagement::IApplicationViewStatics *m_applicationView; ABI::Windows::ApplicationModel::Core::ICoreApplication *m_application; + QRect m_geometry; QImage::Format m_format; QSurfaceFormat m_surfaceFormat; @@ -183,7 +178,7 @@ private: #ifndef Q_OS_WINPHONE QHash > m_activeKeys; #endif - QHash m_pointers; + QTouchDevice *m_touchDevice; QHash m_touchPoints; }; -- cgit v1.2.3 From b80f732783e43dc21ddbce4b42d9bb61915a3fb6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 29 Apr 2014 12:32:34 +0200 Subject: Use XI2 event detail to determine changed mouse button The button state part of the XI2 events appears to be badly constructed on some devices and platforms. Even where supported the 'detail' field of the XI2 events is what we should be reading since it indicates the button the event refers to and not just the state of all buttons. Task-number: QTBUG-38169 Change-Id: Iedb7971194b3c27448b72c285a54100c511c17e4 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.cpp | 13 ------------- src/plugins/platforms/xcb/qxcbconnection.h | 1 - src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 12 ++++++------ 3 files changed, 6 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e3b81c2b40..f5f6c712c5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1791,19 +1791,6 @@ bool QXcbConnection::xi2GetValuatorValueIfSet(void *event, int valuatorNum, doub return true; } -bool QXcbConnection::xi2GetButtonState(void *event, int buttonNum) -{ - xXIDeviceEvent *xideviceevent = static_cast(event); - unsigned char *buttonsMaskAddr = (unsigned char*)&xideviceevent[1]; - - for (int i = 0; i < (xideviceevent->buttons_len * 4); i++) { - if (buttonNum < 8) - return (buttonsMaskAddr[i] & (1 << buttonNum)); - buttonNum -= 8; - } - return false; -} - // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1933b89a19..6e511356c4 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -532,7 +532,6 @@ private: #if defined(XCB_USE_XINPUT2) || defined(XCB_USE_XINPUT2_MAEMO) static bool xi2GetValuatorValueIfSet(void *event, int valuatorNum, double *value); static bool xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event, int opCode); - static bool xi2GetButtonState(void *event, int buttonNum); #endif xcb_connection_t *m_connection; diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 831ccba6f6..efa1691780 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -575,7 +575,7 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin #ifdef XCB_USE_XINPUT21 xXIGenericDeviceEvent *xiEvent = reinterpret_cast(event); - if (xiEvent->evtype == XI_Motion) { + if (xiEvent->evtype == XI_Motion && scrollingDevice.orientations) { xXIDeviceEvent* xiDeviceEvent = reinterpret_cast(event); if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) { QPoint rawDelta; @@ -612,20 +612,20 @@ void QXcbConnection::xi2HandleScrollEvent(void *event, ScrollingDevice &scrollin QWindowSystemInterface::handleWheelEvent(platformWindow->window(), xiEvent->time, local, global, rawDelta, angleDelta, modifiers); } } - } else if (xiEvent->evtype == XI_ButtonRelease) { + } else if (xiEvent->evtype == XI_ButtonRelease && scrollingDevice.legacyOrientations) { xXIDeviceEvent* xiDeviceEvent = reinterpret_cast(event); if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) { QPoint angleDelta; if (scrollingDevice.legacyOrientations & Qt::Vertical) { - if (xi2GetButtonState(xiDeviceEvent, 4)) + if (xiDeviceEvent->detail == 4) angleDelta.setY(120); - else if (xi2GetButtonState(xiDeviceEvent, 5)) + else if (xiDeviceEvent->detail == 5) angleDelta.setY(-120); } if (scrollingDevice.legacyOrientations & Qt::Horizontal) { - if (xi2GetButtonState(xiDeviceEvent, 6)) + if (xiDeviceEvent->detail == 6) angleDelta.setX(120); - if (xi2GetButtonState(xiDeviceEvent, 7)) + else if (xiDeviceEvent->detail == 7) angleDelta.setX(-120); } if (!angleDelta.isNull()) { -- cgit v1.2.3 From baf5eed1ef5a71cdcf4ee56cb3e9c9eaa45ea60b Mon Sep 17 00:00:00 2001 From: Daniel Seither Date: Tue, 4 Feb 2014 12:36:27 +0100 Subject: QDateTime: Fix sign handling in the timezone offset parser Previously, parsing negative timezone offsets with minutes != 00 produced wrong results. Examples (in -> out) -00:15 -> +00:15 -01:15 -> -00:45 Change-Id: I6fa30810a08bdf2996365661720b2e362e8aeb93 Reviewed-by: Thiago Macieira Reviewed-by: John Layt --- src/corelib/tools/qdatetime.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index e38a5f569a..280d516452 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -265,17 +265,24 @@ static int fromOffsetString(const QString &offsetString, bool *valid) if (size < 2 || size > 6) return 0; + // sign will be +1 for a positive and -1 for a negative offset + int sign; + // First char must be + or - - const QChar sign = offsetString.at(0); - if (sign != QLatin1Char('+') && sign != QLatin1Char('-')) + const QChar signChar = offsetString.at(0); + if (signChar == QLatin1Char('+')) + sign = 1; + else if (signChar == QLatin1Char('-')) + sign = -1; + else return 0; // Split the hour and minute parts - QStringList parts = offsetString.split(QLatin1Char(':')); + QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { // [+-]HHMM format - parts.append(parts.at(0).mid(3)); - parts[0] = parts.at(0).left(3); + parts.append(parts.at(0).mid(2)); + parts[0] = parts.at(0).left(2); } bool ok = false; @@ -288,7 +295,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) return 0; *valid = true; - return ((hour * 60) + minute) * 60; + return sign * ((hour * 60) + minute) * 60; } /***************************************************************************** -- cgit v1.2.3 From ac109e1316750175100cafc7f486b0c8ff03f716 Mon Sep 17 00:00:00 2001 From: Daniel Seither Date: Tue, 4 Feb 2014 12:39:17 +0100 Subject: QDateTime: Fix sign handling in the timezone offset writer Previously, this produced wrong results, for example -3:30 became -3:-30. Change-Id: I10efdfb48e5542b917c86b29cf8a99bfc26f7fe0 Reviewed-by: John Layt Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 280d516452..801876629c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -253,7 +253,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0')) - .arg((offset / 60) % 60, 2, 10, QLatin1Char('0')); + .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } // Parse offset in [+-]HH[:]MM format -- cgit v1.2.3 From df3720527dddad4c04ad1a6b7c07f4bd66495053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 28 Apr 2014 09:42:10 +0200 Subject: Ensure the QMenu is polished before creating the native window Call ::ensurePolished from QMenu::exec before the native window gets created. This ensures that the style handles the menu before its too late. E.g. a style which wants to create RGBA menus needs to add the appropriate flag before the native window gets created. Without this change the style cannot change to RGBA as the native window has already been created and changing the format used by QWindow is not possible after QWindow::create was called. Change-Id: Ic861037a438b4cb74c59a00be0ef2d633db538ed Reviewed-by: Friedemann Kleint Reviewed-by: Gabriel de Dietrich Reviewed-by: David Edmundson Reviewed-by: Frederik Gladhorn --- src/widgets/widgets/qmenu.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 403ebe7f49..7e48badea5 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2177,6 +2177,7 @@ QAction *QMenu::exec() QAction *QMenu::exec(const QPoint &p, QAction *action) { Q_D(QMenu); + ensurePolished(); createWinId(); QEventLoop eventLoop; d->eventLoop = &eventLoop; -- cgit v1.2.3 From f85ab84414a5d40c710c9deabe0d9b89b4757ec5 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Thu, 8 May 2014 08:58:47 +0300 Subject: Direct2D QPA: Bump copyright year to match reality Change-Id: I443b74e3d464285febc28345f35d1445e8102015 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dcontext.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h | 2 +- src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp index 85c56bc73e..8bfeac0b2a 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.h b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.h index d7015ef342..de63bc77f7 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp index 80688a1da7..1ea90c4f91 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.h b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.h index 0025463dd5..f9ccab5783 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp index 27e94e4be4..fb47851a06 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.h b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.h index 4986efb967..c563f6a8f0 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h b/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h index 3be05ee1e0..c1b7fc97a8 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dhelpers.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp index 44fc7aa927..9833d50e6c 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h index a46d5c0126..0a5a7ff58a 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.cpp index 6792d92de5..0020a95a4d 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h index ee3f7f6eed..ee1e3db3d2 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp index 85dbaab2ce..f5f4923b2f 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h index c799083d84..c9d8607497 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp index f75bb49fd9..85fbeb7d6f 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. -- cgit v1.2.3 From 295786d946aed262b01f5941dcde72d68781f6c1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 5 May 2014 17:52:47 +0200 Subject: Avoid corruption in Q(Open)GLFunctions when used on multiple threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Q(Open)GLFunctions concurrently on multiple threads had some issues due to incorrect synchronization: The m_groups list in the QOpenGLMultiGroupSharedResource, in which the Q(Open)GLFunctions instance is stored, became corrupted under certain scenarios, for example in the tst_qglthreads autotest and any two threads that happen to enter an initializeOpenGLFunctions() or QOpenGLContext::functions() call concurrently. Locking in value() has been introduced in 666c25c089acf7fcc9e9a6b7665074c6286d604e to fix such issues, however using the context group's mutex is not enough: that still allows two threads using two contexts with a different context group to concurrently enter insert(). Instead, the MultiGroupSharedResource has to have its own mutex to protect its own member variables. Task-number: QTBUG-38771 Change-Id: If01c44c2084b95e487bc9146576ca180ed8044da Reviewed-by: Jørgen Lind --- src/gui/kernel/qopenglcontext.cpp | 3 ++- src/gui/kernel/qopenglcontext_p.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 1af5c09fd2..be592153d2 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1345,7 +1345,8 @@ void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context) QOpenGLMultiGroupSharedResource instance. */ QOpenGLMultiGroupSharedResource::QOpenGLMultiGroupSharedResource() - : active(0) + : active(0), + m_mutex(QMutex::Recursive) { #ifdef QT_GL_CONTEXT_RESOURCE_DEBUG qDebug("Creating context group resource object %p.", this); diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index aa1b3b6245..711a3b1b2f 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -171,7 +171,9 @@ public: template T *value(QOpenGLContext *context) { QOpenGLContextGroup *group = context->shareGroup(); - QMutexLocker locker(&group->d_func()->m_mutex); + // Have to use our own mutex here, not the group's, since + // m_groups has to be protected too against any concurrent access. + QMutexLocker locker(&m_mutex); T *resource = static_cast(group->d_func()->m_resources.value(this, 0)); if (!resource) { resource = new T(context); @@ -183,6 +185,7 @@ public: private: QAtomicInt active; QList m_groups; + QMutex m_mutex; }; class QPaintEngineEx; -- cgit v1.2.3 From fe0348e1036d630c50895680bb9d6b3673fee8c2 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 6 May 2014 13:41:47 +0300 Subject: ANGLE D3D11: Don't use mipmaps in level 9 textures As the mipmaps levels aren't being generated on level 9, they shouldn't be used. Fall back to multisampled textures instead (which is the behavior for non-power-of-two textures anyway). This fixes an issue in which textured polygons (e.g. QML Images) turn black when scaled down. Change-Id: I648b8be473dc38f4e1b26724cbaff610e586fdbd Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- .../libGLESv2/renderer/d3d11/TextureStorage11.cpp | 2 +- ...D11-Don-t-use-mipmaps-in-level-9-textures.patch | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/angle/patches/0017-ANGLE-D3D11-Don-t-use-mipmaps-in-level-9-textures.patch (limited to 'src') diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp index fdfbe526ec..0c981ac503 100644 --- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp +++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp @@ -257,7 +257,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum D3D11_TEXTURE2D_DESC desc; desc.Width = width; // Compressed texture size constraints? desc.Height = height; - desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0; + desc.MipLevels = mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? ((levels > 0) ? levels + mLodOffset : 0) : 1; desc.ArraySize = 1; desc.Format = mTextureFormat; desc.SampleDesc.Count = 1; diff --git a/src/angle/patches/0017-ANGLE-D3D11-Don-t-use-mipmaps-in-level-9-textures.patch b/src/angle/patches/0017-ANGLE-D3D11-Don-t-use-mipmaps-in-level-9-textures.patch new file mode 100644 index 0000000000..200a8105de --- /dev/null +++ b/src/angle/patches/0017-ANGLE-D3D11-Don-t-use-mipmaps-in-level-9-textures.patch @@ -0,0 +1,31 @@ +From 9632c57033b514bfb10a0dfa7ba51ec27a944616 Mon Sep 17 00:00:00 2001 +From: Andrew Knight +Date: Tue, 6 May 2014 13:35:14 +0300 +Subject: [PATCH] ANGLE D3D11: Don't use mipmaps in level 9 textures + +As the mipmaps levels aren't being generated on level 9, they shouldn't +be used. Fall back to multisampled textures instead (which is the +behavior for non-power-of-two textures anyway). This fixes an issue in +which textured polygons (e.g. QML Images) turn black when scaled down. + +Change-Id: I648b8be473dc38f4e1b26724cbaff610e586fdbd +--- + src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp +index fdfbe52..0c981ac 100644 +--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp ++++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp +@@ -257,7 +257,7 @@ TextureStorage11_2D::TextureStorage11_2D(Renderer *renderer, int levels, GLenum + D3D11_TEXTURE2D_DESC desc; + desc.Width = width; // Compressed texture size constraints? + desc.Height = height; +- desc.MipLevels = (levels > 0) ? levels + mLodOffset : 0; ++ desc.MipLevels = mRenderer->getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 ? ((levels > 0) ? levels + mLodOffset : 0) : 1; + desc.ArraySize = 1; + desc.Format = mTextureFormat; + desc.SampleDesc.Count = 1; +-- +1.9.0.msysgit.0 + -- cgit v1.2.3 From 667f2449a300950e735250c62686c150dab0080d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 29 Apr 2014 16:45:33 +0200 Subject: Fix crash on startup when running screenreader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For exaple Qt Creator would crash when started and a screen reader (eg NVDA) is running. This is due to updateAccessibility being called during the ctor of the TextEdit and on Windows the AT can access properties in the same call resulting in accessing the text control before it's fully constructed. Also make sure to not send accessibility updates for non-widget type edits since we don't support any accessibility in Qt Quick 1. Backported from Qt 5.3.1 since it also crashes Qt Creator on startup on Mac (as soon as accessibility is enabled which may be for various reasons, and basically any app that uses a QTextEdit). Task-number: QTBUG-38659 Task-number: QTBUG-38738 Change-Id: I6e5c0dc47bd75e63fe013a9edadbabccd52c20ee Reviewed-by: Jan Arve Sæther --- src/widgets/widgets/qwidgettextcontrol.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 9cc62fd10a..54b20e36f5 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -438,7 +438,6 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_updateCurrentCharFormatAndSelection())); QObject::connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), q, SLOT(_q_emitCursorPosChanged(QTextCursor))); - QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q, SLOT(_q_contentsChanged(int,int,int))); QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged())); // convenience signal forwards @@ -501,6 +500,8 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString q->ensureCursorVisible(); emit q->cursorPositionChanged(); + + QObject::connect(doc, SIGNAL(contentsChange(int,int,int)), q, SLOT(_q_contentsChanged(int,int,int)), Qt::UniqueConnection); } void QWidgetTextControlPrivate::startDrag() @@ -646,7 +647,8 @@ void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, i { Q_Q(QWidgetTextControl); #ifndef QT_NO_ACCESSIBILITY - if (QAccessible::isActive()) { + + if (QAccessible::isActive() && q->parent() && q->parent()->isWidgetType()) { QTextCursor tmp(doc); tmp.setPosition(from); tmp.setPosition(from + charsAdded, QTextCursor::KeepAnchor); -- cgit v1.2.3 From b6de758ec68a4df87b37d641357770d186022cdf Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 8 May 2014 16:36:51 +0200 Subject: Avoid using repeat on widget textures in eglfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise widgets will not be shown on some embedded systems. Task-number: QTBUG-38866 Change-Id: Id16408dc7eb657c052bbe3bdb86e35ab2f062632 Reviewed-by: Jørgen Lind --- src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp index 24e9ccd39f..ab92bac37d 100644 --- a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp @@ -100,9 +100,8 @@ void QEGLPlatformBackingStore::updateTexture() glBindTexture(GL_TEXTURE_2D, m_bsTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - // QOpenGLTextureBlitter requires GL_REPEAT for the time being - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_image.width(), m_image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); } else { glBindTexture(GL_TEXTURE_2D, m_bsTexture); -- cgit v1.2.3 From 78e57834acc4213d0c5e3b3d9c3bdbc20c32f12a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 May 2014 16:27:39 -0700 Subject: Document that env variables are preferable to cmdline options Environment variables are passed along to child processes, command-line options aren't. Change-Id: Ia52c1d8cfeeb2f7490e73ac50b58ba07c2eebfa8 Reviewed-by: Friedemann Kleint Reviewed-by: Leena Miettinen --- src/gui/kernel/qguiapplication.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index ab71fe9081..c87c60e842 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -466,7 +466,14 @@ static QWindowGeometrySpecification windowGeometrySpecification; \section1 Supported Command Line Options - All Qt programs automatically support the following command line options: + All Qt programs automatically support a set of command-line options that + allow modifying the way Qt will interact with the windowing system. Some of + the options are also accessible via environment variables, which are the + preferred form if the application can launch GUI sub-processes or other + applications (environment variables will be inherited by child processes). + When in doubt, use the environment variables. + + The options currently supported are the following: \list \li \c{-platform} \e {platformName[:options]}, specifies the -- cgit v1.2.3 From cd9c59b5d6c149f57d2bdb0cd2a08ec6eb84a766 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 May 2014 16:31:10 -0700 Subject: Document that the -reverse option is only for debugging and its default You should never force that option. Just let Qt automatically detect from the environment. Change-Id: I43ae4951969d2067cc111eff6302921a0af82658 Reviewed-by: Friedemann Kleint Reviewed-by: Leena Miettinen --- src/gui/kernel/qguiapplication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c87c60e842..1122a9c7a4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -497,7 +497,9 @@ static QWindowGeometrySpecification windowGeometrySpecification; the main window using the X11-syntax. For example: \c {-qwindowgeometry 100x100+50+50} \li \c{-reverse}, sets the application's layout direction to - Qt::RightToLeft + Qt::RightToLeft. This option is intended to aid debugging and should + not be used in production. The default value is automatically detected + from the user's locale (see also QLocale::textDirection()). \li \c{-session} \e session, restores the application from an earlier \l{Session Management}{session}. \li -qwindowgeometry, sets the geometry of the first window -- cgit v1.2.3 From 7a89ee08cea4aa1292029e485822d5a5e772faf7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 May 2014 16:33:19 -0700 Subject: Doc: fix -qwindowgeometry and -qwindowtitle option docs The former was documented twice and the latter was missing the qdoc formatting. Change-Id: Id8dfb21a0c2fd26134b5738448971fe2627a12d6 Reviewed-by: Friedemann Kleint Reviewed-by: Leena Miettinen Reviewed-by: David Faure --- src/gui/kernel/qguiapplication.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1122a9c7a4..15d8e2f758 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -496,14 +496,13 @@ static QWindowGeometrySpecification windowGeometrySpecification; \li \c {-qwindowgeometry} \e geometry, specifies window geometry for the main window using the X11-syntax. For example: \c {-qwindowgeometry 100x100+50+50} + \li \c {-qwindowtitle}, sets the title of the first window \li \c{-reverse}, sets the application's layout direction to Qt::RightToLeft. This option is intended to aid debugging and should not be used in production. The default value is automatically detected from the user's locale (see also QLocale::textDirection()). \li \c{-session} \e session, restores the application from an earlier \l{Session Management}{session}. - \li -qwindowgeometry, sets the geometry of the first window - \li -qwindowtitle, sets the title of the first window \endlist The following standard command line options are available for X11: -- cgit v1.2.3 From 918f20ee476d0cc8a4426c1abf4f44612afe13e1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 May 2014 16:34:58 -0700 Subject: Document the X11 DISPLAY variable in the -display option docs Change-Id: I20412616c91d187e2befc39134a480369347b8cb Reviewed-by: Friedemann Kleint Reviewed-by: Leena Miettinen --- src/gui/kernel/qguiapplication.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 15d8e2f758..8ccff4321d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -509,6 +509,8 @@ static QWindowGeometrySpecification windowGeometrySpecification; \list \li \c {-display} \e {hostname:screen_number}, switches displays on X11. + + Overrides the \c DISPLAY environment variable. \li \c {-geometry} \e geometry, same as \c {-qwindowgeometry}. \endlist -- cgit v1.2.3 From df70d5ad80b465e284a467bb4d327a617ee17552 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 15 Feb 2014 21:21:48 -0800 Subject: Limit the QString pretty outputs to 256 characters Change-Id: I88e71e517827af7d82e3a47d88d40787051ed827 Reviewed-by: Sergio Ahumada --- src/testlib/qtestcase.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index cc58b51743..ffcc7abbfe 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2143,18 +2143,26 @@ char *toHexRepresentation(const char *ba, int length) char *toPrettyUnicode(const ushort *p, int length) { // keep it simple for the vast majority of cases - QScopedArrayPointer buffer(new char[length * 6 + 3]); + bool trimmed = false; + QScopedArrayPointer buffer(new char[256]); const ushort *end = p + length; char *dst = buffer.data(); *dst++ = '"'; for ( ; p != end; ++p) { + if (dst - buffer.data() > 245) { + // plus the the quote, the three dots and NUL, it's 250, 251 or 255 + trimmed = true; + break; + } + if (*p < 0x7f && *p >= 0x20 && *p != '\\') { *dst++ = *p; continue; } // write as an escape sequence + // this means we may advance dst to buffer.data() + 246 or 250 *dst++ = '\\'; switch (*p) { case 0x22: @@ -2186,6 +2194,11 @@ char *toPrettyUnicode(const ushort *p, int length) } *dst++ = '"'; + if (trimmed) { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } *dst++ = '\0'; return buffer.take(); } -- cgit v1.2.3 From ec8102166449b9b323948c0a8f5fabfa38705139 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Fri, 9 May 2014 21:03:25 +0930 Subject: Enable support for OpenGL 4 on OS X 10.9 Change-Id: Ifc3aeea8bf4bada821d09cc329748cad16923d6a Reviewed-by: Laszlo Agocs Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopengl.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 190c05ba26..ef5ab9aa65 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -112,17 +112,19 @@ typedef GLfloat GLdouble; # endif // Q_OS_MAC #endif // QT_OPENGL_ES_2 -// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3 -// and desktops apart from Mac can support OpenGL 4 +// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3. +// Desktops, apart from Mac OS X prior to 10.9 can support OpenGL 4. #if !defined(QT_OPENGL_ES_2) # if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) # define QT_OPENGL_3 # define QT_OPENGL_3_2 # endif -#if !defined(Q_OS_MAC) +# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) # define QT_OPENGL_4 +# endif +# if !defined(Q_OS_MAC) # define QT_OPENGL_4_3 -#endif +# endif #endif QT_BEGIN_NAMESPACE -- cgit v1.2.3 From f2a40fa07123748ece2fc93790345379f15ef07f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 14 Apr 2014 15:31:06 -0700 Subject: Don't assume QLocale::codecForLocale always returns non-null It may return null during program exit, due to QCoreGlobalData global static already having been destroyed. If that's the case, QTextStream needs to fall back to Latin 1, like QString::toLocal8Bit and fromLocal8Bit already do. Task-number: QTBUG-38316 Change-Id: I5949c8dec15b60f4a13b5d9307ed6abfc799fe20 Reviewed-by: Olivier Goffart --- src/corelib/io/qtextstream.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 163b087436..288a939ab2 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -569,7 +569,9 @@ void QTextStreamPrivate::flushWriteBuffer() #endif // convert from unicode to raw data - QByteArray data = codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState); + // codec might be null if we're already inside global destructors (QTestCodec::codecForLocale returned null) + QByteArray data = Q_LIKELY(codec) ? codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState) + : writeBuffer.toLatin1(); #else QByteArray data = writeBuffer.toLocal8Bit(); #endif -- cgit v1.2.3 From 0a0cc6afc8be1ab38367ad803a303f35f29ed5de Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 10 Apr 2014 11:07:46 -0700 Subject: Doc: change the name of the QTemporaryDir parameter name Make it very clear that this is a path, so it's relative to the working dir, not relative to tempPath(). Task-number: QTBUG-38266 Change-Id: Ib7ca8df76b5a03c1631fe00d6b329d86538d4b5a Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qtemporarydir.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 2c526847b4..1e615956d7 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -218,25 +218,25 @@ QTemporaryDir::QTemporaryDir() } /*! - Constructs a QTemporaryFile with a template name of \a templateName. + Constructs a QTemporaryDir with a template of \a templatePath. - If \a templateName is a relative path, the path will be relative to the + If \a templatePath is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct \a - templateName if you want use the system's temporary directory. + templatePath if you want use the system's temporary directory. - If the \a templateName ends with XXXXXX it will be used as the dynamic portion + If the \a templatePath ends with XXXXXX it will be used as the dynamic portion of the directory name, otherwise it will be appended. Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported. \sa QDir::tempPath() */ -QTemporaryDir::QTemporaryDir(const QString &templateName) +QTemporaryDir::QTemporaryDir(const QString &templatePath) : d_ptr(new QTemporaryDirPrivate) { - if (templateName.isEmpty()) + if (templatePath.isEmpty()) d_ptr->create(defaultTemplateName()); else - d_ptr->create(templateName); + d_ptr->create(templatePath); } /*! -- cgit v1.2.3 From 0065b55da42b8c6ee0095264b5275fb708887c9d Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Fri, 2 May 2014 00:10:21 +0200 Subject: Ignore expired certificate during certificate validation OpenSSL has a bug when validating a chain with two certificates. If a certificate exists twice (which is a valid use case for renewed CAs), and the first one it hits is expired (which depends on the order on data structure internal to OpenSSL), it will fail to validate the chain. This is only a bandaid fix, which trades improved chain validation for error reporting accuracy. However given that reissuing of CA certs is a real problem that is only getting worse, this fix is needed. See also: https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html#WARNINGS [ChangeLog][QtNetwork][QSslSocket] Added a workaround to an OpenSSL problem that may cause errors when the trust store contains two certificates of the issuing CA, one of which is expired. Task-number: QTBUG-38896 Change-Id: I8f17972ac94555648098624e470fff0eff2e7940 Reviewed-by: Richard J. Moore Reviewed-by: Frederik Gladhorn --- src/network/ssl/qsslcontext.cpp | 23 ++++++++++++----------- src/network/ssl/qsslsocket_openssl.cpp | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp index 9c68218062..f5e5352d5e 100644 --- a/src/network/ssl/qsslcontext.cpp +++ b/src/network/ssl/qsslcontext.cpp @@ -214,22 +214,23 @@ init_context: } // Add all our CAs to this store. - QList expiredCerts; foreach (const QSslCertificate &caCertificate, sslContext->sslConfiguration.caCertificates()) { - // add expired certs later, so that the - // valid ones are used before the expired ones - if (caCertificate.expiryDate() < QDateTime::currentDateTime()) { - expiredCerts.append(caCertificate); - } else { + // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: + // + // If several CA certificates matching the name, key identifier, and + // serial number condition are available, only the first one will be + // examined. This may lead to unexpected results if the same CA + // certificate is available with different expiration dates. If a + // ``certificate expired'' verification error occurs, no other + // certificate will be searched. Make sure to not have expired + // certificates mixed with valid ones. + // + // See also: QSslSocketBackendPrivate::verify() + if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) { q_X509_STORE_add_cert(sslContext->ctx->cert_store, (X509 *)caCertificate.handle()); } } - // now add the expired certs - foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(sslContext->ctx->cert_store, reinterpret_cast(caCertificate.handle())); - } - if (QSslSocketPrivate::s_loadRootCertsOnDemand && allowRootCertOnDemandLoading) { // tell OpenSSL the directories where to look up the root certs on demand QList unixDirs = QSslSocketPrivate::unixRootCertDirectories(); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 1b3928fdfb..45e2fabfe9 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1598,23 +1598,23 @@ QList QSslSocketBackendPrivate::verify(QList certifi setDefaultCaCertificates(defaultCaCertificates() + systemCaCertificates()); } - QList expiredCerts; - foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) { - // add expired certs later, so that the - // valid ones are used before the expired ones - if (caCertificate.expiryDate() < QDateTime::currentDateTime()) { - expiredCerts.append(caCertificate); - } else { + // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: + // + // If several CA certificates matching the name, key identifier, and + // serial number condition are available, only the first one will be + // examined. This may lead to unexpected results if the same CA + // certificate is available with different expiration dates. If a + // ``certificate expired'' verification error occurs, no other + // certificate will be searched. Make sure to not have expired + // certificates mixed with valid ones. + // + // See also: QSslContext::fromConfiguration() + if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) { q_X509_STORE_add_cert(certStore, reinterpret_cast(caCertificate.handle())); } } - // now add the expired certs - foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(certStore, reinterpret_cast(caCertificate.handle())); - } - QMutexLocker sslErrorListMutexLocker(&_q_sslErrorList()->mutex); // Register a custom callback to get all verification errors. -- cgit v1.2.3 From 3cf9621fa02b17a36dacf336adcc9ed993de7699 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 12 May 2014 08:28:59 +0200 Subject: Respect fixed pitch request when font family is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In particular, if you have a
 tag in your HTML, this will
become a QFont with family "Courier New" and fixedPitch==true.
On Android, there's no "Courier New" font, and since the
style hint is AnyStyle, we will just return Roboto, which is
a proportional font.

Note that this exactly matches the condition when fetching the
fallback families for the font in the loadEngine() function,
which was introduced by 06568ff89c48dee8aab278b8b0538c331aa84595
in Qt 4.

[ChangeLog][Text] Respect QFont::fixedPitch() for fallbacks
when font family cannot be matched.

Task-number: QTBUG-36083
Change-Id: I64787c547dc492b9dd3c49f1edf0d9626d198260
Reviewed-by: Jørgen Lind 
Reviewed-by: Konstantin Ritt 
---
 src/gui/text/qfontdatabase.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 558258c30e..06438103ad 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2501,10 +2501,14 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
 
     if (!engine) {
         if (!request.family.isEmpty()) {
+            QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
+            if (styleHint == QFont::AnyStyle && request.fixedPitch)
+                styleHint = QFont::TypeWriter;
+
             QStringList fallbacks = request.fallBackFamilies
                                   + fallbackFamilies(request.family,
                                                      QFont::Style(request.style),
-                                                     QFont::StyleHint(request.styleHint),
+                                                     styleHint,
                                                      QChar::Script(script));
             if (script > QChar::Script_Common)
                 fallbacks += QString(); // Find the first font matching the specified script.
-- 
cgit v1.2.3


From 793b7e80083d77b0804a40b5732a8888c9ce5cd8 Mon Sep 17 00:00:00 2001
From: Andrey Volykhin 
Date: Thu, 8 May 2014 17:10:25 +0400
Subject: QTextLayout: Fix cursor position calculation for BiDi text

Due excess 'break' in loop, function xToCursor() with "CursorOnCharacter" option
for BiDI text returns wrong cursor position (start glyph position) all time.

Task-number: QTBUG-38846
Change-Id: Iba6671905e0785da6f343db19d6c3bb3e2cf5e8a
Reviewed-by: Andrey Volykhin 
Reviewed-by: Konstantin Ritt 
Reviewed-by: Eskil Abrahamsen Blomfeldt 
---
 src/gui/text/qtextlayout.cpp | 1 -
 1 file changed, 1 deletion(-)

(limited to 'src')

diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index c3cf2e56bb..84ad9038d5 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2810,7 +2810,6 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
                                 break;
                             glyph_pos = gs;
                             edge = pos;
-                            break;
                         }
                         pos -= glyphs.effectiveAdvance(gs);
                         ++gs;
-- 
cgit v1.2.3


From 17dda3917d6d11e59c4f6df2c42bd3ce803eee6b Mon Sep 17 00:00:00 2001
From: Louai Al-Khanji 
Date: Thu, 8 May 2014 10:23:19 +0300
Subject: Direct2D QPA: Never queue more than one frame

Microsoft recommends setting the maximum frame latency to 1:

http://blogs.windows.com/windows/b/appbuilder/archive/2013/12/18/optimizing-directx-apps-for-low-latency-input-and-longer-battery-life.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/hh780339(v=vs.85).aspx

Apparently it slightly reduces power consumption and it also slightly
increases performance. So let's set it.

Change-Id: I8a540f1e54e83d6dc13f25564e10b751e202ce66
Reviewed-by: Risto Avila 
Reviewed-by: Friedemann Kleint 
---
 src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp
index 1ea90c4f91..d757789935 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dcontext.cpp
@@ -90,7 +90,7 @@ public:
             return false;
         }
 
-        ComPtr dxgiDevice;
+        ComPtr dxgiDevice;
         ComPtr dxgiAdapter;
 
         hr = d3dDevice.As(&dxgiDevice);
@@ -99,6 +99,9 @@ public:
             return false;
         }
 
+        // Ensure that DXGI doesn't queue more than one frame at a time.
+        dxgiDevice->SetMaximumFrameLatency(1);
+
         hr = dxgiDevice->GetAdapter(&dxgiAdapter);
         if (FAILED(hr)) {
             qWarning("%s: Failed to probe DXGI Device for parent DXGI Adapter: %#x", __FUNCTION__, hr);
-- 
cgit v1.2.3


From 6c42ddf31f5b502a1189a7b6eb6de33775b95e94 Mon Sep 17 00:00:00 2001
From: Louai Al-Khanji 
Date: Fri, 9 May 2014 11:15:55 +0300
Subject: Direct2D QPA: Choose linear interpolation for smooth pixmap transform

Let's do the same thing the raster engine does. Much faster too.

Change-Id: I88ea9d2c2ac78feee1193b75a9e96c62a7bd5979
Reviewed-by: Risto Avila 
Reviewed-by: Friedemann Kleint 
---
 src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 6e8d9b0baf..ca2dcf908d 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -382,8 +382,7 @@ public:
     inline D2D1_INTERPOLATION_MODE interpolationMode() const
     {
         Q_Q(const QWindowsDirect2DPaintEngine);
-        // XXX are we choosing the right d2d interpolation modes?
-        return (q->state()->renderHints & QPainter::SmoothPixmapTransform) ? D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC
+        return (q->state()->renderHints & QPainter::SmoothPixmapTransform) ? D2D1_INTERPOLATION_MODE_LINEAR
                                                                            : D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
     }
 
-- 
cgit v1.2.3


From a669564597f1d9aebe6f992d890b730c7be10f6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= 
Date: Wed, 30 Apr 2014 14:50:46 +0200
Subject: Allow QFont lookups using localized family names by adding family
 alias

After fbaa6d3ca6fc269 QFont family names are non-localized on iOS/OS X,
which means applications that try to initialize QFont with a localized
family name (explicitly, or from user input), will fail, and get the
fallback font instead.

We now add font family aliases for the localized family names, so that
font matching will work even for localized family names. Note that
QFontDatabase::families() still returns a non-localized list.

Task-number: QTBUG-38628
Change-Id: Id351befa69916ce162c939733bbfcc774f075120
Reviewed-by: Eskil Abrahamsen Blomfeldt 
---
 src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 1c0e888758..9248785696 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -196,13 +196,20 @@ void QCoreTextFontDatabase::populateFontDatabase()
     QCFType familyNames = availableFamilyNames();
     const int numberOfFamilies = CFArrayGetCount(familyNames);
     for (int i = 0; i < numberOfFamilies; ++i) {
-        QString familyName = QCFString::toQString((CFStringRef) CFArrayGetValueAtIndex(familyNames, i));
+        CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i);
+        QString familyName = QCFString::toQString(familyNameRef);
 
         // Don't populate internal fonts
         if (familyName.startsWith(QLatin1Char('.')) || familyName == QStringLiteral("LastResort"))
             continue;
 
         QPlatformFontDatabase::registerFontFamily(familyName);
+
+#if defined(Q_OS_OSX)
+        QString localizedFamilyName = QString::fromNSString([[NSFontManager sharedFontManager] localizedNameForFamily:(NSString*)familyNameRef face:nil]);
+        if (familyName != localizedFamilyName)
+            QPlatformFontDatabase::registerAliasToFontFamily(familyName, localizedFamilyName);
+#endif
     }
 }
 
-- 
cgit v1.2.3


From 5a060a5ad322629f1a1ee0c850db94932543fee5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= 
Date: Wed, 30 Apr 2014 15:26:57 +0200
Subject: CoreText: Prevent creation of CGContext for glyphs with empty
 bounding box

If the alphaMapBoundingBox of a glyph is empty we don't want to create
a CGBitmapContext on it, as that will fail, and any further operations
on the invalid context will result in possibly fatal errors from CG.

This issue can be observed when drawing some glyphs of the Apple Color
Emoji font.

Change-Id: Ia45ba858b5fb6afa91e6d686a9c55e350d4095f3
Reviewed-by: Gunnar Sletta 
---
 src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src')

diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 0460f11139..6e2c8a2a9a 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -559,6 +559,9 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
     QImage im(br.width.ceil().toInt(), br.height.ceil().toInt(), imageFormat);
     im.fill(0);
 
+    if (!im.width() || !im.height())
+        return im;
+
 #ifndef Q_OS_IOS
     CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
 #else
@@ -568,9 +571,11 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
 #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
     cgflags |= kCGBitmapByteOrder32Host;
 #endif
+
     CGContextRef ctx = CGBitmapContextCreate(im.bits(), im.width(), im.height(),
                                              8, im.bytesPerLine(), colorspace,
                                              cgflags);
+    Q_ASSERT(ctx);
     CGContextSetFontSize(ctx, fontDef.pixelSize);
     CGContextSetShouldAntialias(ctx, (aa || fontDef.pointSize > antialiasingThreshold)
                                  && !(fontDef.styleStrategy & QFont::NoAntialias));
-- 
cgit v1.2.3


From 5883b6a22c7a484d2fed032d0c51f240f0ef9cd0 Mon Sep 17 00:00:00 2001
From: Andreas Holzammer 
Date: Tue, 29 Apr 2014 19:16:23 +0200
Subject: [QNX]Clear transparent regions

If a region gets painted the buffer beneath needs
to be cleared, as it could be that there are
leftovers from the last blit.

Change-Id: I51f19aa010015059e9a6d9d5e5e4f25fb9532d4e
Reviewed-by: Rafael Roquetto 
Reviewed-by: Fabian Bumberger 
---
 .../platforms/qnx/qqnxrasterbackingstore.cpp        | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

(limited to 'src')

diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index 57914cf2fb..3109388fb2 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -41,6 +41,8 @@
 
 #include "qqnxrasterbackingstore.h"
 #include "qqnxrasterwindow.h"
+#include "qqnxscreen.h"
+#include "qqnxglobal.h"
 
 #include 
 
@@ -167,6 +169,25 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion)
     m_hasUnflushedPaintOperations = true;
 
     platformWindow()->adjustBufferSize();
+
+    if (window()->requestedFormat().alphaBufferSize() != 0) {
+        foreach (const QRect &r, region.rects()) {
+            // Clear transparent regions
+            const int bg[] = {
+                               SCREEN_BLIT_COLOR, 0x00000000,
+                               SCREEN_BLIT_DESTINATION_X, r.x(),
+                               SCREEN_BLIT_DESTINATION_Y, r.y(),
+                               SCREEN_BLIT_DESTINATION_WIDTH, r.width(),
+                               SCREEN_BLIT_DESTINATION_HEIGHT, r.height(),
+                               SCREEN_BLIT_END
+                              };
+            Q_SCREEN_CHECKERROR(screen_fill(platformWindow()->screen()->nativeContext(),
+                                            platformWindow()->renderBuffer().nativeBuffer(), bg),
+                                "failed to clear transparent regions");
+        }
+        Q_SCREEN_CHECKERROR(screen_flush_blits(platformWindow()->screen()->nativeContext(), 0),
+                            "failed to flush blits");
+    }
 }
 
 void QQnxRasterBackingStore::endPaint()
-- 
cgit v1.2.3


From da6dc40f75feead6c40786b720abd79962bd97e4 Mon Sep 17 00:00:00 2001
From: Bernd Weimer 
Date: Fri, 2 May 2014 16:00:42 +0200
Subject: QNX: Don't build QNX-only parts on BlackBerry

Only really required source files will be included when building for
BlackBerry.

Change-Id: Ic66b09221c48672358bba7601bc18663ad7fa07a
Reviewed-by: Wolfgang Bremer 
Reviewed-by: Oswald Buddenhagen 
Reviewed-by: Rafael Roquetto 
---
 src/plugins/platforms/qnx/qnx.pro             | 20 ++++++++++++--------
 src/plugins/platforms/qnx/qqnxintegration.cpp |  4 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

(limited to 'src')

diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 856b7d2abe..b5c6b48931 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -121,18 +121,22 @@ CONFIG(blackberry-playbook) {
 CONFIG(qqnx_pps) {
     DEFINES += QQNX_PPS
 
-    SOURCES += qqnxnavigatorpps.cpp \
-               qqnxnavigatoreventnotifier.cpp \
-               qqnxvirtualkeyboardpps.cpp \
-               qqnxclipboard.cpp \
+    SOURCES += qqnxclipboard.cpp \
                qqnxbuttoneventnotifier.cpp
 
-    HEADERS += qqnxnavigatorpps.h \
-               qqnxnavigatoreventnotifier.h \
-               qqnxvirtualkeyboardpps.h \
-               qqnxclipboard.h \
+    HEADERS += qqnxclipboard.h \
                qqnxbuttoneventnotifier.h
 
+    !blackberry {
+        SOURCES += qqnxnavigatorpps.cpp \
+                   qqnxnavigatoreventnotifier.cpp \
+                   qqnxvirtualkeyboardpps.cpp
+
+        HEADERS += qqnxnavigatorpps.h \
+                   qqnxnavigatoreventnotifier.h \
+                   qqnxvirtualkeyboardpps.h
+    }
+
     LIBS += -lpps
     !contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard
 
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index 41ca2b5e18..1110eb5f28 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -67,12 +67,12 @@
 #include "qqnxvirtualkeyboardbps.h"
 #elif defined(QQNX_PPS)
 #include "qqnxnavigatorpps.h"
+#include "qqnxnavigatoreventnotifier.h"
 #include "qqnxvirtualkeyboardpps.h"
 #endif
 
 #if defined(QQNX_PPS)
 #  include "qqnxbuttoneventnotifier.h"
-#  include "qqnxnavigatoreventnotifier.h"
 #  include "qqnxclipboard.h"
 
 #  if defined(QQNX_IMF)
@@ -284,7 +284,7 @@ QQnxIntegration::~QQnxIntegration()
 #endif
 
     // Stop/destroy navigator event notifier
-#if defined(QQNX_PPS)
+#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
     delete m_navigatorEventNotifier;
 #endif
     delete m_navigatorEventHandler;
-- 
cgit v1.2.3


From d075df993c078478e2eb8ff909dfe63ae1b2a6d7 Mon Sep 17 00:00:00 2001
From: Nedim Hadzic 
Date: Tue, 29 Apr 2014 12:27:20 +0200
Subject: QPpsObject compile added for QNX platform

QPpsObject was only compiled for BlackBerry and not for QNX. Now, QNX
platform is included together with lpps lib.

Change-Id: Ib521664b430b202c0e67987d0bfda8373d2be70e
Reviewed-by: Bernd Weimer 
Reviewed-by: Rafael Roquetto 
---
 src/corelib/kernel/kernel.pri | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 1fec528b31..819c10e99f 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -164,11 +164,17 @@ vxworks {
 
 blackberry {
         SOURCES += \
-                kernel/qeventdispatcher_blackberry.cpp \
+                kernel/qeventdispatcher_blackberry.cpp
+        HEADERS += \
+                kernel/qeventdispatcher_blackberry_p.h
+}
+
+qqnx_pps {
+        LIBS_PRIVATE += -lpps
+        SOURCES += \
                 kernel/qppsattribute.cpp \
                 kernel/qppsobject.cpp
         HEADERS += \
-                kernel/qeventdispatcher_blackberry_p.h \
                 kernel/qppsattribute_p.h \
                 kernel/qppsattributeprivate_p.h \
                 kernel/qppsobject_p.h \
-- 
cgit v1.2.3


From 8094bb537ac87d477b04b6d486653983c8423e02 Mon Sep 17 00:00:00 2001
From: Bernd Weimer 
Date: Tue, 6 May 2014 10:40:03 +0200
Subject: QNX: Silence startup warnings

Missing PPS objects for navigator, virtual keyboard and buttons can be
expected on QNX and should not lead to warnings.
Virtual keyboard info message does not contain locale object any more.

Change-Id: I447d439ffbf4ea6e03f6a8bca4422a9a121d85f4
Reviewed-by: Frank Osterfeld 
Reviewed-by: Rafael Roquetto 
---
 .../platforms/qnx/qqnxbuttoneventnotifier.cpp      |  2 ++
 .../platforms/qnx/qqnxnavigatoreventnotifier.cpp   |  3 ++-
 .../platforms/qnx/qqnxvirtualkeyboardpps.cpp       | 30 +++++-----------------
 3 files changed, 10 insertions(+), 25 deletions(-)

(limited to 'src')

diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
index 2f531efd8b..d3f843ac39 100644
--- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
@@ -90,7 +90,9 @@ void QQnxButtonEventNotifier::start()
     errno = 0;
     m_fd = qt_safe_open(ppsPath, O_RDONLY);
     if (m_fd == -1) {
+#if defined(Q_OS_BLACKBERRY) || defined (QQNXBUTTON_DEBUG)
         qWarning("QQNX: failed to open buttons pps, errno=%d", errno);
+#endif
         return;
     }
 
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
index 640944fb45..8c8f1b2afe 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
@@ -93,7 +93,8 @@ void QQnxNavigatorEventNotifier::start()
     errno = 0;
     m_fd = open(navigatorControlPath, O_RDWR);
     if (m_fd == -1) {
-        qWarning("QQNX: failed to open navigator pps, errno=%d", errno);
+        qNavigatorEventNotifierDebug() << Q_FUNC_INFO << ": failed to open navigator pps:"
+                                                      << strerror(errno);
         return;
     }
 
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
index 2b6ee3d1dc..78180ec4a7 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
@@ -128,15 +128,16 @@ bool QQnxVirtualKeyboardPps::connect()
     m_fd = ::open(ms_PPSPath, O_RDWR);
     if (m_fd == -1)
     {
-        qCritical("QQnxVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
-                ms_PPSPath, strerror(errno), errno);
+        qVirtualKeyboardDebug() << Q_FUNC_INFO << ": Unable to open" << ms_PPSPath
+                                               << ":" << strerror(errno);
         close();
         return false;
     }
 
     m_buffer = new char[ms_bufferSize];
     if (!m_buffer) {
-        qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.",  ms_bufferSize);
+        qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. "
+                  "Size is unavailable.",  ms_bufferSize);
         return false;
     }
 
@@ -156,7 +157,7 @@ bool QQnxVirtualKeyboardPps::queryPPSInfo()
 
     // Request info, requires id to regenerate res message.
     pps_encoder_add_string(m_encoder, "msg", "info");
-    pps_encoder_add_string(m_encoder, "id", "libWebView");
+    pps_encoder_add_string(m_encoder, "id", "1");
 
     return writeCurrentPPSEncoder();
 }
@@ -220,7 +221,6 @@ void QQnxVirtualKeyboardPps::ppsDataReady()
 void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
 {
     int newHeight = 0;
-    const char *value;
 
     if (pps_decoder_push(m_decoder, "dat") != PPS_DECODER_OK) {
         qCritical("QQnxVirtualKeyboard: Keyboard PPS dat object not found");
@@ -230,27 +230,9 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
         qCritical("QQnxVirtualKeyboard: Keyboard PPS size field not found");
         return;
     }
-    if (pps_decoder_push(m_decoder, "locale") != PPS_DECODER_OK) {
-        qCritical("QQnxVirtualKeyboard: Keyboard PPS locale object not found");
-        return;
-    }
-    if (pps_decoder_get_string(m_decoder, "languageId", &value) != PPS_DECODER_OK) {
-        qCritical("QQnxVirtualKeyboard: Keyboard PPS languageId field not found");
-        return;
-    }
-    const QString languageId = QString::fromLatin1(value);
-    if (pps_decoder_get_string(m_decoder, "countryId", &value) != PPS_DECODER_OK) {
-        qCritical("QQnxVirtualKeyboard: Keyboard PPS size countryId not found");
-        return;
-    }
-    const QString countryId = QString::fromLatin1(value);
-
     setHeight(newHeight);
 
-    const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId);
-    setLocale(locale);
-
-    qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight << "locale=" << locale;
+    qVirtualKeyboardDebug() << Q_FUNC_INFO << "size=" << newHeight;
 }
 
 bool QQnxVirtualKeyboardPps::showKeyboard()
-- 
cgit v1.2.3


From 79d35b331a825aa166b22bc002f8f4b48ae55a00 Mon Sep 17 00:00:00 2001
From: Andy Shaw 
Date: Tue, 13 May 2014 13:43:36 +0200
Subject: Fix horizontal scrolling on Windows when ALT + mouse wheel is used

Task-number: QTBUG-30833
Change-Id: I366d2979060ba67f745f7c783dee8d7669ebdf57
Reviewed-by: Friedemann Kleint 
---
 src/plugins/platforms/windows/qwindowsmousehandler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index dfa400285a..5c9add4baa 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -364,7 +364,7 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
         delta = (int) msg.wParam;
 
     Qt::Orientation orientation = (msg.message == WM_MOUSEHWHEEL
-                                  || (buttons & Qt::AltModifier)) ?
+                                  || (mods & Qt::AltModifier)) ?
                                   Qt::Horizontal : Qt::Vertical;
 
     // according to the MSDN documentation on WM_MOUSEHWHEEL:
-- 
cgit v1.2.3


From 2406a8b45f2ba25ab250d36f520dd903b88189f2 Mon Sep 17 00:00:00 2001
From: Laszlo Agocs 
Date: Mon, 12 May 2014 18:11:25 +0200
Subject: Remove an unused workaround and fix up the comments in the glyph
 cache

This old workaround is not necessary and could not be used anyhow since
it would affect a way too wide range of drivers. Modern drivers should
be able to honor the default GL_UNPACK_ALIGNMENT of 4 even for 1 byte
per pixel formats like GL_ALPHA. Instead, document why the behavior
is correct.

Change-Id: I1687448ba92875c8ff772ccc371894e88ff64096
Reviewed-by: Gunnar Sletta 
---
 src/gui/opengl/qopengltextureglyphcache.cpp | 31 ++---------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

(limited to 'src')

diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index ac88d9d3a5..f721d5cb8c 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -408,41 +408,14 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
 #endif
         funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits());
     } else {
-        // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
-        // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
-        // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
-        // multiple of four bytes per line, and most of the glyph shows up correctly in the
-        // texture, which makes me think that this is a driver bug.
-        // One workaround is to make sure the mask width is a multiple of four bytes, for instance
-        // by converting it to a format with four bytes per pixel. Another is to copy one line at a
-        // time.
-
-#if 0
-        if (!ctx->d_func()->workaround_brokenAlphaTexSubImage_init) {
-            // don't know which driver versions exhibit this bug, so be conservative for now
-            const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION)));
-            glctx->d_func()->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0;
-            glctx->d_func()->workaround_brokenAlphaTexSubImage_init = true;
-        }
-#endif
-
-#if 0
-        if (ctx->d_func()->workaround_brokenAlphaTexSubImage) {
-            for (int i = 0; i < maskHeight; ++i)
-                funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
-        } else {
-#endif
-
+        // The scanlines in mask are 32-bit aligned, even for mono or 8-bit formats. This
+        // is good because it matches the default of 4 bytes for GL_UNPACK_ALIGNMENT.
 #if !defined(QT_OPENGL_ES_2)
         const GLenum format = isCoreProfile() ? GL_RED : GL_ALPHA;
 #else
         const GLenum format = GL_ALPHA;
 #endif
         funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits());
-
-#if 0
-        }
-#endif
     }
 }
 
-- 
cgit v1.2.3


From c8de2a8b5f5d0b9b3bc1d8ed8d3027ac40b00ee3 Mon Sep 17 00:00:00 2001
From: Kai Koehne 
Date: Thu, 8 May 2014 09:14:44 +0200
Subject: Fix MSVC warnings in qspdyprotocolhandler

Fix warnings about 'truncation of constant value':

qspdyprotocolhandler.cpp(583) : warning C4309: '=' : truncation of constant value
qspdyprotocolhandler.cpp(656) : warning C4309: '=' : truncation of constant value
qspdyprotocolhandler.cpp(659) : warning C4309: '=' : truncation of constant value

Change-Id: I3c32b9f47c06da9b50f5c94871a2ee455b3a5cb6
Reviewed-by: Peter Hartmann 
---
 src/network/access/qspdyprotocolhandler.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
index 6d22ebeb35..32a804e9f4 100644
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -598,7 +598,7 @@ void QSpdyProtocolHandler::sendControlFrame(FrameType type,
 {
     // frame type and stream ID
     char header[8];
-    header[0] = 0x80; // leftmost bit == 1 -> is a control frame
+    header[0] = 0x80u; // leftmost bit == 1 -> is a control frame
     header[1] = 0x03; // 3 bit == version 3
     header[2] = 0;
     switch (type) {
@@ -671,10 +671,10 @@ void QSpdyProtocolHandler::sendSYN_STREAM(HttpMessagePair messagePair,
         prioAndSlot[0] = 0x00; // == prio 0 (highest)
         break;
     case QHttpNetworkRequest::NormalPriority:
-        prioAndSlot[0] = 0x80; // == prio 4
+        prioAndSlot[0] = 0x80u; // == prio 4
         break;
     case QHttpNetworkRequest::LowPriority:
-        prioAndSlot[0] = 0xe0; // == prio 7 (lowest)
+        prioAndSlot[0] = 0xe0u; // == prio 7 (lowest)
         break;
     }
     prioAndSlot[1] = 0x00; // slot in client certificates (not supported currently)
-- 
cgit v1.2.3