summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-11-04 20:18:14 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-11-04 20:18:14 +0100
commit4159ee840549df11287294f0928e90f35f3e06ff (patch)
tree4a3947e37d54bdb78b4042e9ced20dbf181b5a2c /src/plugins/platforms/windows
parent59dbf1786f22ec4ac88d8f9d38cac5cfb82acaea (diff)
parentc8c39ecc37c156ac2677de09a26548dfc274b564 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: config.tests/unix/ptrsize.test configure src/corelib/global/qnamespace.h src/network/socket/qabstractsocket.cpp tests/auto/other/networkselftest/networkselftest.pro Change-Id: Ic78abb4a34f9068567cea876861d4220f5a07672
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp44
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp52
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp17
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp48
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h9
22 files changed, 167 insertions, 79 deletions
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 97459a4d97..8936b96b1f 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -69,6 +69,7 @@ static const char formatTextHtmlC[] = "text/html";
\ingroup qt-lighthouse-win
*/
+#ifndef QT_NO_DEBUG_STREAM
static QDebug operator<<(QDebug d, const QMimeData *mimeData)
{
QDebugStateSaver saver(d);
@@ -93,6 +94,7 @@ static QDebug operator<<(QDebug d, const QMimeData *mimeData)
d << ')';
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
/*!
\class QWindowsClipboardRetrievalMimeData
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 4d18e7ea58..02accfae01 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -201,12 +201,14 @@ void QWindowsUser32DLL::init()
bool QWindowsUser32DLL::initTouch()
{
- QSystemLibrary library(QStringLiteral("user32"));
- isTouchWindow = (IsTouchWindow)(library.resolve("IsTouchWindow"));
- registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
- unregisterTouchWindow = (UnregisterTouchWindow)(library.resolve("UnregisterTouchWindow"));
- getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
- closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle"));
+ if (!isTouchWindow && QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
+ QSystemLibrary library(QStringLiteral("user32"));
+ isTouchWindow = (IsTouchWindow)(library.resolve("IsTouchWindow"));
+ registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
+ unregisterTouchWindow = (UnregisterTouchWindow)(library.resolve("UnregisterTouchWindow"));
+ getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
+ closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle"));
+ }
return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle;
}
@@ -359,6 +361,36 @@ QWindowsContext::~QWindowsContext()
m_instance = 0;
}
+bool QWindowsContext::initTouch()
+{
+ return initTouch(QWindowsIntegration::instance()->options());
+}
+
+bool QWindowsContext::initTouch(unsigned integrationOptions)
+{
+ if (d->m_systemInfo & QWindowsContext::SI_SupportsTouch)
+ return true;
+
+ QTouchDevice *touchDevice = d->m_mouseHandler.ensureTouchDevice();
+ if (!touchDevice)
+ return false;
+
+#ifndef Q_OS_WINCE
+ if (!QWindowsContext::user32dll.initTouch()) {
+ delete touchDevice;
+ return false;
+ }
+#endif // !Q_OS_WINCE
+
+ if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch))
+ touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation);
+
+ QWindowSystemInterface::registerTouchDevice(touchDevice);
+
+ d->m_systemInfo |= QWindowsContext::SI_SupportsTouch;
+ return true;
+}
+
void QWindowsContext::setTabletAbsoluteRange(int a)
{
#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index d2a3481b28..641e3ed41f 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -170,6 +170,9 @@ public:
explicit QWindowsContext();
~QWindowsContext();
+ bool initTouch();
+ bool initTouch(unsigned integrationOptions); // For calls from QWindowsIntegration::QWindowsIntegration() only.
+
int defaultDPI() const;
QString registerWindowClass(const QWindow *w);
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index da0ba27e3a..b983ba3354 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -360,6 +360,7 @@ public:
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DEBUG_STREAM
/* Output UID (IID, CLSID) as C++ constants.
* The constants are contained in the Windows SDK libs, but not for MinGW. */
static inline QString guidToString(const GUID &g)
@@ -385,6 +386,7 @@ inline QDebug operator<<(QDebug d, const GUID &g)
d << guidToString(g);
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
// Return an allocated wchar_t array from a QString, reserve more memory if desired.
static wchar_t *qStringToWCharArray(const QString &s, size_t reserveSize = 0)
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 719553fa7c..fcd9911a56 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -247,7 +247,7 @@ private:
QWindowsDragCursorWindow *m_touchDragWindow;
ULONG m_refs;
-#ifndef QT_NO_DEBUG_OUTPUT
+#ifndef QT_NO_DEBUG_STREAM
friend QDebug operator<<(QDebug, const QWindowsOleDropSource::CursorEntry &);
#endif
};
@@ -269,14 +269,14 @@ QWindowsOleDropSource::~QWindowsOleDropSource()
qCDebug(lcQpaMime) << __FUNCTION__;
}
-#ifndef QT_NO_DEBUG_OUTPUT
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QWindowsOleDropSource::CursorEntry &e)
{
d << "CursorEntry:" << e.pixmap.size() << '#' << e.cacheKey
<< "HCURSOR" << e.cursor->cursor << "hotspot:" << e.hotSpot;
return d;
}
-#endif // !QT_NO_DEBUG_OUTPUT
+#endif // !QT_NO_DEBUG_STREAM
static qreal dragScaleFactor()
{
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index eb8262262f..a30e545807 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -40,6 +40,7 @@
#include <QtGui/QFont>
#include <QtGui/QGuiApplication>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtCore/qmath.h>
#include <QtCore/QDebug>
@@ -607,6 +608,7 @@ static inline bool initDirectWrite(QWindowsFontEngineData *d)
\ingroup qt-lighthouse-win
*/
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QFontDef &def)
{
QDebugStateSaver saver(d);
@@ -618,6 +620,7 @@ QDebug operator<<(QDebug d, const QFontDef &def)
<< def.hintingPreference;
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
{
@@ -1099,8 +1102,11 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
QFontEngine *fontEngine = 0;
#if !defined(QT_NO_DIRECTWRITE)
- if (hintingPreference == QFont::PreferDefaultHinting
- || hintingPreference == QFont::PreferFullHinting)
+ bool useDirectWrite = (hintingPreference == QFont::PreferNoHinting)
+ || (hintingPreference == QFont::PreferVerticalHinting)
+ || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting);
+
+ if (!useDirectWrite)
#endif
{
GUID guid;
@@ -1703,7 +1709,8 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
#if !defined(QT_NO_DIRECTWRITE)
bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting)
- || (request.hintingPreference == QFont::PreferVerticalHinting);
+ || (request.hintingPreference == QFont::PreferVerticalHinting)
+ || (QHighDpiScaling::isActive() && request.hintingPreference == QFont::PreferDefaultHinting);
if (useDirectWrite && initDirectWrite(data.data())) {
const QString fam = QString::fromWCharArray(lf.lfFaceName);
const QString nameSubstitute = QWindowsFontEngineDirectWrite::fontNameSubstitute(fam);
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h
index efb5421996..10b6315aab 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h
@@ -118,6 +118,10 @@ private:
QMap<QString, UniqueFontData> m_uniqueFontData;
};
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug, const QFontDef &def);
+#endif
+
QT_END_NAMESPACE
#endif // QWINDOWSFONTDATABASE_H
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index d827607bc5..361e7f4445 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -353,7 +353,7 @@ static bool addFontToDatabase(const QString &faceName,
const QFont::Weight weight = QPlatformFontDatabase::weightFromInteger(tm->tmWeight);
const QFont::Stretch stretch = QFont::Unstretched;
-#ifndef QT_NO_DEBUG_OUTPUT
+#ifndef QT_NO_DEBUG_STREAM
if (QWindowsContext::verbose > 2) {
QString message;
QTextStream str(&message);
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index e372acc747..a06707b84c 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -284,6 +284,7 @@ static inline void initPixelFormatDescriptor(PIXELFORMATDESCRIPTOR *d)
d->nVersion = 1;
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd)
{
QDebugStateSaver saver(d);
@@ -326,6 +327,32 @@ QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd)
return d;
}
+QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
+ << s.defaultFormat;
+ if (s.extensions & QOpenGLStaticContext::SampleBuffers)
+ d << ",SampleBuffers";
+ if (s.hasExtensions())
+ d << ", Extension-API present";
+ d << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
+ if (QWindowsContext::verbose > 1)
+ d << s.extensionNames;
+ return d;
+}
+
+QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF)
+ << " profile: " << f.profile << " options: " << f.options;
+ return d;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
// Check whether an obtained PIXELFORMATDESCRIPTOR matches the request.
static inline bool
isAcceptableFormat(const QWindowsOpenGLAdditionalFormat &additional,
@@ -900,15 +927,6 @@ void QWindowsOpenGLContextFormat::apply(QSurfaceFormat *format) const
format->setOption(QSurfaceFormat::DeprecatedFunctions);
}
-QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f)
-{
- QDebugStateSaver saver(d);
- d.nospace();
- d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF)
- << " profile: " << f.profile << " options: " << f.options;
- return d;
-}
-
/*!
\class QOpenGLTemporaryContext
\brief A temporary context that can be instantiated on the stack.
@@ -1013,22 +1031,6 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
return result;
}
-QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
-{
- QDebugStateSaver saver(d);
- d.nospace();
- d << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
- << s.defaultFormat;
- if (s.extensions & QOpenGLStaticContext::SampleBuffers)
- d << ",SampleBuffers";
- if (s.hasExtensions())
- d << ", Extension-API present";
- d << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
- if (QWindowsContext::verbose > 1)
- d << s.extensionNames;
- return d;
-}
-
/*!
\class QWindowsGLContext
\brief Open GL context.
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index 516fa0707e..ba617f13ce 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -85,7 +85,11 @@ struct QWindowsOpenGLContextFormat
QSurfaceFormat::FormatOptions options;
};
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &);
QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &);
+QDebug operator<<(QDebug d, const QOpenGLStaticContext &s);
+#endif
struct QWindowsOpengl32DLL
{
@@ -224,8 +228,6 @@ public:
static QWindowsOpengl32DLL opengl32;
};
-QDebug operator<<(QDebug d, const QOpenGLStaticContext &);
-
class QWindowsGLContext : public QWindowsOpenGLContext
{
public:
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 7322af95d1..2f61baa8a1 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -229,17 +229,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramL
dpiAwarenessSet = true;
}
- QTouchDevice *touchDevice = m_context.touchDevice();
- if (touchDevice) {
-#ifdef Q_OS_WINCE
- touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation);
-#else
- if (!(m_options & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) {
- touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation);
- }
-#endif
- QWindowSystemInterface::registerTouchDevice(touchDevice);
- }
+ m_context.initTouch(m_options);
}
QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index 52a4ca26dc..0a2ba9b0e7 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -378,7 +378,7 @@ static bool canGetData(int cf, IDataObject * pDataObj)
return true;
}
-#ifndef QT_NO_DEBUG_OUTPUT
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const FORMATETC &tc)
{
QDebugStateSaver saver(d);
@@ -443,7 +443,7 @@ QDebug operator<<(QDebug d, IDataObject *dataObj)
d << ')';
return d;
}
-#endif // !QT_NO_DEBUG_OUTPUT
+#endif // !QT_NO_DEBUG_STREAM
/*!
\class QWindowsMime
diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h
index 17fddef1bc..1ec0dccdf8 100644
--- a/src/plugins/platforms/windows/qwindowsmime.h
+++ b/src/plugins/platforms/windows/qwindowsmime.h
@@ -93,7 +93,7 @@ private:
mutable int m_internalMimeCount;
};
-#ifndef QT_NO_DEBUG_OUTPUT
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug, const FORMATETC &);
QDebug operator<<(QDebug d, IDataObject *);
#endif
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index bd801edc4f..80f3d3e2b8 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -151,12 +151,19 @@ static inline QTouchDevice *createTouchDevice()
QWindowsMouseHandler::QWindowsMouseHandler() :
m_windowUnderMouse(0),
m_trackedWindow(0),
- m_touchDevice(createTouchDevice()),
+ m_touchDevice(Q_NULLPTR),
m_leftButtonDown(false),
m_previousCaptureWindow(0)
{
}
+QTouchDevice *QWindowsMouseHandler::ensureTouchDevice()
+{
+ if (!m_touchDevice)
+ m_touchDevice = createTouchDevice();
+ return m_touchDevice;
+}
+
Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
{
Qt::MouseButtons result = 0;
@@ -477,7 +484,11 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
- Q_ASSERT(m_touchDevice);
+ if (!QWindowsContext::instance()->initTouch()) {
+ qWarning("Unable to initialize touch handling.");
+ return true;
+ }
+
const QScreen *screen = window->screen();
if (!screen)
screen = QGuiApplication::primaryScreen();
@@ -493,8 +504,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
touchPoints.reserve(winTouchPointCount);
Qt::TouchPointStates allStates = 0;
- Q_ASSERT(QWindowsContext::user32dll.getTouchInputInfo);
-
QWindowsContext::user32dll.getTouchInputInfo((HANDLE) msg.lParam, msg.wParam, winTouchInputs.data(), sizeof(TOUCHINPUT));
for (int i = 0; i < winTouchPointCount; ++i) {
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index 61aa8d6084..4b5078567d 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -52,6 +52,7 @@ public:
QWindowsMouseHandler();
QTouchDevice *touchDevice() const { return m_touchDevice; }
+ QTouchDevice *ensureTouchDevice();
bool translateMouseEvent(QWindow *widget, HWND hwnd,
QtWindows::WindowsEventType t, MSG msg,
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index befd06f1a2..e32a7e32af 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -98,6 +98,7 @@ GpuDescription GpuDescription::detect()
#endif
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const GpuDescription &gd)
{
QDebugStateSaver s(d);
@@ -109,6 +110,7 @@ QDebug operator<<(QDebug d, const GpuDescription &gd)
<< ", version=" << gd.driverVersion << ", " << gd.description << ')';
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
// Return printable string formatted like the output of the dxdiag tool.
QString GpuDescription::toString() const
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h
index 3cd8bf4d4b..f22031aa4e 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.h
+++ b/src/plugins/platforms/windows/qwindowsopengltester.h
@@ -60,7 +60,9 @@ struct GpuDescription
QByteArray description;
};
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const GpuDescription &gd);
+#endif
class QWindowsOpenGLTester
{
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index e6abfb2403..de4ef79b81 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -172,6 +172,7 @@ static inline WindowsScreenDataList monitorData()
return result;
}
+#ifndef QT_NO_DEBUG_STREAM
static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
{
QDebugStateSaver saver(dbg);
@@ -192,6 +193,7 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
dbg << " lock screen";
return dbg;
}
+#endif // !QT_NO_DEBUG_STREAM
// Return the cursor to be shared by all screens (virtual desktop).
static inline QSharedPointer<QPlatformCursor> sharedCursor()
@@ -278,8 +280,11 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags)
qreal QWindowsScreen::pixelDensity() const
{
- const qreal physicalDpi = m_data.geometry.width() / m_data.physicalSizeMM.width() * qreal(25.4);
- return qRound(physicalDpi / 96);
+ // QTBUG-49195: Use logical DPI instead of physical DPI to calculate
+ // the pixel density since it is reflects the Windows UI scaling.
+ // High DPI auto scaling should be disabled when the user chooses
+ // small fonts on a High DPI monitor, resulting in lower logical DPI.
+ return qRound(logicalDpi().first / 96);
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 3951401273..b27811df9e 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -302,8 +302,11 @@ static inline QTabletEvent::PointerType pointerType(unsigned currentCursor)
return QTabletEvent::UnknownPointer;
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
{
+ QDebugStateSaver saver(d);
+ d.nospace();
d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure
<< ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".."
<< t.maxTanPressure << " area:" << t.minX << t.minY <<t.minZ
@@ -311,6 +314,7 @@ QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
<< " pointer " << t.currentPointerType;
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueId, const UINT cursorType) const
{
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 718ae98572..a6d2771206 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -97,7 +97,9 @@ struct QWindowsTabletDeviceData
int currentPointerType;
};
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t);
+#endif
class QWindowsTabletSupport
{
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 5cb34e7fd3..01e2a804bd 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -106,20 +106,6 @@ static QByteArray debugWinExStyle(DWORD exStyle)
return rc;
}
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
-QDebug operator<<(QDebug d, const MINMAXINFO &i)
-{
- QDebugStateSaver saver(d);
- d.nospace();
- d << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ','
- << i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x
- << ',' << i.ptMaxPosition.y << " mintrack="
- << i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y
- << " maxtrack=" << i.ptMaxTrackSize.x << ',' << i.ptMaxTrackSize.y;
- return d;
-}
-#endif // !Q_OS_WINCE
-
static inline QSize qSizeOfRect(const RECT &rect)
{
return QSize(rect.right -rect.left, rect.bottom - rect.top);
@@ -138,6 +124,7 @@ static inline RECT RECTfromQRect(const QRect &rect)
return result;
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const RECT &r)
{
QDebugStateSaver saver(d);
@@ -147,7 +134,13 @@ QDebug operator<<(QDebug d, const RECT &r)
return d;
}
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_NCCALCSIZE
+QDebug operator<<(QDebug d, const POINT &p)
+{
+ d << p.x << ',' << p.y;
+ return d;
+}
+
+# ifndef Q_OS_WINCE
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
{
QDebugStateSaver saver(d);
@@ -156,7 +149,30 @@ QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
<< ' ' << qrectFromRECT(p.rgrc[1]) << ' ' << qrectFromRECT(p.rgrc[2]);
return d;
}
-#endif // !Q_OS_WINCE
+
+QDebug operator<<(QDebug d, const MINMAXINFO &i)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ','
+ << i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x
+ << ',' << i.ptMaxPosition.y << " mintrack="
+ << i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y
+ << " maxtrack=" << i.ptMaxTrackSize.x << ',' << i.ptMaxTrackSize.y;
+ return d;
+}
+
+QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "WINDOWPLACEMENT(flags=0x" << hex << wp.flags << dec << ", showCmd="
+ << wp.showCmd << ", ptMinPosition=" << wp.ptMinPosition << ", ptMaxPosition=" << wp.ptMaxPosition
+ << ", rcNormalPosition=" << wp.rcNormalPosition;
+ return d;
+}
+# endif // !Q_OS_WINCE
+#endif // !QT_NO_DEBUG_STREAM
// QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT
// is in workspace/available area coordinates.
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index c73c8ca8f3..583d3a4267 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -290,12 +290,15 @@ private:
void *m_surface;
};
-// Debug
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const RECT &r);
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO/WM_NCCALCSIZE
+QDebug operator<<(QDebug d, const POINT &);
+# ifndef Q_OS_WINCE
QDebug operator<<(QDebug d, const MINMAXINFO &i);
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p);
-#endif
+QDebug operator<<(QDebug d, const WINDOWPLACEMENT &);
+# endif // !Q_OS_WINCE
+#endif // !QT_NO_DEBUG_STREAM
// ---------- QWindowsGeometryHint inline functions.
QPoint QWindowsGeometryHint::mapToGlobal(HWND hwnd, const QPoint &qp)