summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-07-30 13:47:36 +0200
committerLiang Qi <liang.qi@qt.io>2019-07-30 13:47:36 +0200
commit71ec1d6d79c16c46837dbd10f1cd2a53027a6682 (patch)
tree5008d058a0ea3ef379c36ad2364d9b2bc78f3aaf /src/plugins
parent31753adebe0f19b90f332e81e1a9b063b40f982d (diff)
parent75f51d2f40746205484b969a72a56d75d5d8ff39 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: qmake/generators/win32/mingw_make.cpp Change-Id: I2f790bc8572bd22fea01edf7ca74595b29f063eb
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h11
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm3
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp18
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.cpp38
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.h1
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm2
7 files changed, 87 insertions, 16 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index 2398e6351e..9be6814ae7 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -49,7 +49,14 @@
QT_BEGIN_NAMESPACE
-class QNSWindowBackingStore : public QRasterBackingStore
+class QCocoaBackingStore : public QRasterBackingStore
+{
+protected:
+ QCocoaBackingStore(QWindow *window);
+ QCFType<CGColorSpaceRef> colorSpace() const;
+};
+
+class QNSWindowBackingStore : public QCocoaBackingStore
{
public:
QNSWindowBackingStore(QWindow *window);
@@ -64,7 +71,7 @@ private:
void redrawRoundedBottomCorners(CGRect) const;
};
-class QCALayerBackingStore : public QPlatformBackingStore
+class QCALayerBackingStore : public QCocoaBackingStore
{
public:
QCALayerBackingStore(QWindow *window);
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 01b4894324..6015257f4e 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -48,11 +48,24 @@
QT_BEGIN_NAMESPACE
-QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
+QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
: QRasterBackingStore(window)
{
}
+QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
+{
+ NSView *view = static_cast<QCocoaWindow *>(window()->handle())->view();
+ return QCFType<CGColorSpaceRef>::constructFromGet(view.window.colorSpace.CGColorSpace);
+}
+
+// ----------------------------------------------------------------------------
+
+QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
+ : QCocoaBackingStore(window)
+{
+}
+
QNSWindowBackingStore::~QNSWindowBackingStore()
{
}
@@ -175,11 +188,10 @@ void QNSWindowBackingStore::flush(QWindow *window, const QRegion &region, const
Q_ASSERT_X(graphicsContext, "QCocoaBackingStore",
"Focusing the view should give us a current graphics context");
- // Prevent potentially costly color conversion by assigning the display color space
- // to the backingstore image. This does not copy the underlying image data.
- CGColorSpaceRef displayColorSpace = view.window.screen.colorSpace.CGColorSpace;
+ // Tag backingstore image with color space based on the window.
+ // Note: This does not copy the underlying image data.
QCFType<CGImageRef> cgImage = CGImageCreateCopyWithColorSpace(
- QCFType<CGImageRef>(m_image.toCGImage()), displayColorSpace);
+ QCFType<CGImageRef>(m_image.toCGImage()), colorSpace());
// Create temporary image to use for blitting, without copying image data
NSImage *backingStoreImage = [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
@@ -293,7 +305,7 @@ void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const
// ----------------------------------------------------------------------------
QCALayerBackingStore::QCALayerBackingStore(QWindow *window)
- : QPlatformBackingStore(window)
+ : QCocoaBackingStore(window)
{
qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window;
m_buffers.resize(1);
@@ -432,11 +444,7 @@ bool QCALayerBackingStore::recreateBackBufferIfNeeded()
<< "based on requested" << m_requestedSize << "and dpr =" << devicePixelRatio;
static auto pixelFormat = QImage::toPixelFormat(QImage::Format_ARGB32_Premultiplied);
-
- NSView *view = static_cast<QCocoaWindow *>(window()->handle())->view();
- auto colorSpace = QCFType<CGColorSpaceRef>::constructFromGet(view.window.screen.colorSpace.CGColorSpace);
-
- m_buffers.back().reset(new GraphicsBuffer(requestedBufferSize, devicePixelRatio, pixelFormat, colorSpace));
+ m_buffers.back().reset(new GraphicsBuffer(requestedBufferSize, devicePixelRatio, pixelFormat, colorSpace()));
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 26df604f1c..8f3c192745 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1648,6 +1648,9 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
[nsWindow setDepthLimit:NSWindowDepthTwentyfourBitRGB];
}
+ if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace)
+ nsWindow.colorSpace = NSColorSpace.sRGBColorSpace;
+
return nsWindow;
}
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 4b54051e0c..4f0f846749 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -1301,7 +1301,23 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, MSG msg,
|| code == Qt::Key_Control
|| code == Qt::Key_Meta
|| code == Qt::Key_Alt)) {
- // Someone ate the key down event
+
+ // Workaround for QTBUG-77153:
+ // The Surface Pen eraser button generates Meta+F18/19/20 keystrokes,
+ // but when it is not touching the screen the Fn Down is eaten and only
+ // a Fn Up with the previous state as "not pressed" is generated, which
+ // would be ignored. We detect this case and synthesize the expected events.
+ if ((msg.lParam & 0x40000000) == 0 &&
+ Qt::KeyboardModifier(state) == Qt::NoModifier &&
+ ((code == Qt::Key_F18) || (code == Qt::Key_F19) || (code == Qt::Key_F20))) {
+ QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
+ Qt::MetaModifier, scancode,
+ quint32(msg.wParam), MetaLeft);
+ QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code,
+ Qt::NoModifier, scancode,
+ quint32(msg.wParam), 0);
+ result = true;
+ }
} else {
if (!code)
code = asciiToKeycode(rec->ascii ? char(rec->ascii) : char(msg.wParam), state);
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
index 3014b30c38..962e4ab938 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
@@ -43,6 +43,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QHash>
#include <QtCore/qfunctions_winrt.h>
+#include <QtCore/private/qfsfileengine_p.h>
#include <wrl.h>
#include <windows.storage.h>
@@ -196,7 +197,19 @@ bool QWinRTFileEngine::open(QIODevice::OpenMode openMode)
hr = QWinRTFunctions::await(op, d->stream.GetAddressOf());
RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::OpenError, false);
- d->openMode = openMode;
+ const ProcessOpenModeResult res = processOpenModeFlags(openMode);
+ if (!res.ok) {
+ setError(QFileDevice::OpenError, res.error);
+ return false;
+ }
+ d->openMode = res.openMode;
+ if (d->openMode & QIODevice::Truncate) {
+ if (!setSize(0)) {
+ close();
+ setError(QFileDevice::OpenError, QLatin1String("Could not truncate file"));
+ return false;
+ }
+ }
return SUCCEEDED(hr);
}
@@ -257,6 +270,29 @@ qint64 QWinRTFileEngine::size() const
return qint64(size);
}
+bool QWinRTFileEngine::setSize(qint64 size)
+{
+ Q_D(QWinRTFileEngine);
+ if (!d->stream) {
+ setError(QFileDevice::ResizeError, QLatin1String("File must be open to be resized"));
+ return false;
+ }
+
+ if (size < 0) {
+ setError(QFileDevice::ResizeError, QLatin1String("File size cannot be negative"));
+ return false;
+ }
+
+ HRESULT hr = d->stream->put_Size(static_cast<quint64>(size));
+ RETURN_AND_SET_ERROR_IF_FAILED(QFileDevice::ResizeError, false);
+ if (!flush()) {
+ setError(QFileDevice::ResizeError, QLatin1String("Could not flush file"));
+ return false;
+ }
+
+ return true;
+}
+
qint64 QWinRTFileEngine::pos() const
{
Q_D(const QWinRTFileEngine);
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h
index 4485917c9e..453565a95a 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.h
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.h
@@ -79,6 +79,7 @@ public:
bool close() override;
bool flush() override;
qint64 size() const override;
+ bool setSize(qint64 size) override;
qint64 pos() const override;
bool seek(qint64 pos) override;
bool remove() override;
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index c162cca048..968ca68619 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -5327,10 +5327,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
const CGRect barRect = [cell barRectFlipped:hasTicks];
if (drawBar) {
+ [cell drawBarInside:barRect flipped:!verticalFlip];
// This ain't HIG kosher: force unfilled bar look.
if (hasDoubleTicks)
slider.numberOfTickMarks = numberOfTickMarks;
- [cell drawBarInside:barRect flipped:!verticalFlip];
}
if (hasTicks && drawTicks) {