summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-23 10:53:15 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-27 15:27:05 +0000
commit69032adda0bf10bb51a44bbfc87752608a5f86a6 (patch)
treedf9778512d285decaad8f5425aba5cd2d5db8cd0
parent8b9346c7404287b4c546b49c23f24ccbef0f8b6e (diff)
Windows QPA: Fix debug operators.
Enclose all debug operators within QT_NO_DEBUG_STREAM, declare all public ones and make the others static. Add operators for POINT and WINDOWPLACEMENT. Task-number: QTBUG-48449 Change-Id: I33f2dba2bf486a8f5cb11f11f4e2b37cce086def Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp2
-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.cpp2
-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/qwindowsmime.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h2
-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.cpp2
-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
17 files changed, 98 insertions, 53 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/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 d24cba3c68..870e7fec07 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -249,7 +249,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
};
@@ -271,14 +271,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 3b27964b0e..9531d30e06 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -606,6 +606,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);
@@ -617,6 +618,7 @@ QDebug operator<<(QDebug d, const QFontDef &def)
<< def.hintingPreference;
return d;
}
+#endif // !QT_NO_DEBUG_STREAM
static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet)
{
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 795554698c..16cc2afef6 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -355,7 +355,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/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/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..c603b2bd09 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()
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)