summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:16:14 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:19:31 +0200
commit7f8719e663edae8b08d34cc67cb5000e8402d3d7 (patch)
treeb098d2c8077a88c2ada577ac874e1416adaf66f7 /src/plugins/platforms
parentaf851c290b7cea22f26bb8c852b0029696469d74 (diff)
parenteb82959d6688f9e58be4b67670afba3649f1f799 (diff)
Merge remote-tracking branch 'origin/5.5' into HEAD
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp71
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp24
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp84
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp25
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h1
10 files changed, 143 insertions, 111 deletions
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index bfcc9e9bce..4cea845c36 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -71,22 +71,23 @@ static const char formatTextHtmlC[] = "text/html";
QDebug operator<<(QDebug d, const QMimeData &m)
{
- QDebug nospace = d.nospace();
+ QDebugStateSaver saver(d);
+ d.nospace();
const QStringList formats = m.formats();
- nospace << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n'
+ d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n'
<< " Text=" << m.hasText() << " HTML=" << m.hasHtml()
<< " Color=" << m.hasColor() << " Image=" << m.hasImage()
<< " URLs=" << m.hasUrls() << '\n';
if (m.hasText())
- nospace << " Text: '" << m.text() << "'\n";
+ d << " Text: '" << m.text() << "'\n";
if (m.hasHtml())
- nospace << " HTML: '" << m.html() << "'\n";
+ d << " HTML: '" << m.html() << "'\n";
if (m.hasColor())
- nospace << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n';
+ d << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n';
if (m.hasImage())
- nospace << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n';
+ d << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n';
if (m.hasUrls())
- nospace << " URLs: " << m.urls() << '\n';
+ d << " URLs: " << m.urls() << '\n';
return d;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 7d7ea031a5..a532e92397 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -566,8 +566,8 @@ QString QWindowsContext::registerWindowClass(QString cname,
d->m_registeredWindowClassNames.insert(cname);
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << ' ' << cname
- << " style=0x" << QString::number(style, 16)
- << " brush=" << brush << " icon=" << icon << " atom=" << atom;
+ << " style=0x" << hex << style << dec
+ << " brush=" << brush << " icon=" << icon << " atom=" << atom;
return cname;
}
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 3284795fc1..da0ba27e3a 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -379,7 +379,12 @@ static inline QString guidToString(const GUID &g)
}
inline QDebug operator<<(QDebug d, const GUID &g)
-{ d.nospace() << guidToString(g); return d; }
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << guidToString(g);
+ return d;
+}
// 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/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 28fb3b6498..a544b9d81e 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -608,11 +608,13 @@ static inline bool initDirectWrite(QWindowsFontEngineData *d)
QDebug operator<<(QDebug d, const QFontDef &def)
{
- d.nospace() << "Family=" << def.family << " Stylename=" << def.styleName
- << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize
- << " styleHint=" << def.styleHint << " weight=" << def.weight
- << " stretch=" << def.stretch << " hintingPreference="
- << def.hintingPreference << ' ';
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "Family=" << def.family << " Stylename=" << def.styleName
+ << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize
+ << " styleHint=" << def.styleHint << " weight=" << def.weight
+ << " stretch=" << def.stretch << " hintingPreference="
+ << def.hintingPreference;
return d;
}
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index d9eec9f603..a7c14ed2ac 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -286,40 +286,41 @@ static inline void initPixelFormatDescriptor(PIXELFORMATDESCRIPTOR *d)
QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd)
{
- QDebug nsp = d.nospace();
- nsp << "PIXELFORMATDESCRIPTOR "
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "PIXELFORMATDESCRIPTOR "
<< "dwFlags=" << hex << showbase << pd.dwFlags << dec << noshowbase;
- if (pd.dwFlags & PFD_DRAW_TO_WINDOW) nsp << " PFD_DRAW_TO_WINDOW";
- if (pd.dwFlags & PFD_DRAW_TO_BITMAP) nsp << " PFD_DRAW_TO_BITMAP";
- if (pd.dwFlags & PFD_SUPPORT_GDI) nsp << " PFD_SUPPORT_GDI";
- if (pd.dwFlags & PFD_SUPPORT_OPENGL) nsp << " PFD_SUPPORT_OPENGL";
- if (pd.dwFlags & PFD_GENERIC_ACCELERATED) nsp << " PFD_GENERIC_ACCELERATED";
- if (pd.dwFlags & PFD_SUPPORT_DIRECTDRAW) nsp << " PFD_SUPPORT_DIRECTDRAW";
- if (pd.dwFlags & PFD_DIRECT3D_ACCELERATED) nsp << " PFD_DIRECT3D_ACCELERATED";
- if (pd.dwFlags & PFD_SUPPORT_COMPOSITION) nsp << " PFD_SUPPORT_COMPOSITION";
- if (pd.dwFlags & PFD_GENERIC_FORMAT) nsp << " PFD_GENERIC_FORMAT";
- if (pd.dwFlags & PFD_NEED_PALETTE) nsp << " PFD_NEED_PALETTE";
- if (pd.dwFlags & PFD_NEED_SYSTEM_PALETTE) nsp << " PFD_NEED_SYSTEM_PALETTE";
- if (pd.dwFlags & PFD_DOUBLEBUFFER) nsp << " PFD_DOUBLEBUFFER";
- if (pd.dwFlags & PFD_STEREO) nsp << " PFD_STEREO";
- if (pd.dwFlags & PFD_SWAP_LAYER_BUFFERS) nsp << " PFD_SWAP_LAYER_BUFFERS";
- if (hasGLOverlay(pd)) nsp << " overlay";
- nsp << " iPixelType=" << pd.iPixelType << " cColorBits=" << pd.cColorBits
+ if (pd.dwFlags & PFD_DRAW_TO_WINDOW) d << " PFD_DRAW_TO_WINDOW";
+ if (pd.dwFlags & PFD_DRAW_TO_BITMAP) d << " PFD_DRAW_TO_BITMAP";
+ if (pd.dwFlags & PFD_SUPPORT_GDI) d << " PFD_SUPPORT_GDI";
+ if (pd.dwFlags & PFD_SUPPORT_OPENGL) d << " PFD_SUPPORT_OPENGL";
+ if (pd.dwFlags & PFD_GENERIC_ACCELERATED) d << " PFD_GENERIC_ACCELERATED";
+ if (pd.dwFlags & PFD_SUPPORT_DIRECTDRAW) d << " PFD_SUPPORT_DIRECTDRAW";
+ if (pd.dwFlags & PFD_DIRECT3D_ACCELERATED) d << " PFD_DIRECT3D_ACCELERATED";
+ if (pd.dwFlags & PFD_SUPPORT_COMPOSITION) d << " PFD_SUPPORT_COMPOSITION";
+ if (pd.dwFlags & PFD_GENERIC_FORMAT) d << " PFD_GENERIC_FORMAT";
+ if (pd.dwFlags & PFD_NEED_PALETTE) d << " PFD_NEED_PALETTE";
+ if (pd.dwFlags & PFD_NEED_SYSTEM_PALETTE) d << " PFD_NEED_SYSTEM_PALETTE";
+ if (pd.dwFlags & PFD_DOUBLEBUFFER) d << " PFD_DOUBLEBUFFER";
+ if (pd.dwFlags & PFD_STEREO) d << " PFD_STEREO";
+ if (pd.dwFlags & PFD_SWAP_LAYER_BUFFERS) d << " PFD_SWAP_LAYER_BUFFERS";
+ if (hasGLOverlay(pd)) d << " overlay";
+ d << " iPixelType=" << pd.iPixelType << " cColorBits=" << pd.cColorBits
<< " cRedBits=" << pd.cRedBits << " cRedShift=" << pd.cRedShift
<< " cGreenBits=" << pd.cGreenBits << " cGreenShift=" << pd.cGreenShift
<< " cBlueBits=" << pd.cBlueBits << " cBlueShift=" << pd.cBlueShift;
- nsp << " cDepthBits=" << pd.cDepthBits;
+ d << " cDepthBits=" << pd.cDepthBits;
if (pd.cStencilBits)
- nsp << " cStencilBits=" << pd.cStencilBits;
+ d << " cStencilBits=" << pd.cStencilBits;
if (pd.cAuxBuffers)
- nsp << " cAuxBuffers=" << pd.cAuxBuffers;
- nsp << " iLayerType=" << pd.iLayerType;
+ d << " cAuxBuffers=" << pd.cAuxBuffers;
+ d << " iLayerType=" << pd.iLayerType;
if (pd.dwVisibleMask)
- nsp << " dwVisibleMask=" << pd.dwVisibleMask;
+ d << " dwVisibleMask=" << pd.dwVisibleMask;
if (pd.cAlphaBits)
- nsp << " cAlphaBits=" << pd.cAlphaBits << " cAlphaShift=" << pd.cAlphaShift;
+ d << " cAlphaBits=" << pd.cAlphaBits << " cAlphaShift=" << pd.cAlphaShift;
if (pd.cAccumBits)
- nsp << " cAccumBits=" << pd.cAccumBits << " cAccumRedBits=" << pd.cAccumRedBits
+ d << " cAccumBits=" << pd.cAccumBits << " cAccumRedBits=" << pd.cAccumRedBits
<< " cAccumGreenBits=" << pd.cAccumGreenBits << " cAccumBlueBits=" << pd.cAccumBlueBits
<< " cAccumAlphaBits=" << pd.cAccumAlphaBits;
return d;
@@ -906,9 +907,10 @@ void QWindowsOpenGLContextFormat::apply(QSurfaceFormat *format) const
QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &f)
{
- d.nospace() << "ContextFormat: v" << (f.version >> 8) << '.'
- << (f.version & 0xFF) << " profile: " << f.profile
- << " options: " << f.options;
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "ContextFormat: v" << (f.version >> 8) << '.' << (f.version & 0xFF)
+ << " profile: " << f.profile << " options: " << f.options;
return d;
}
@@ -1018,16 +1020,17 @@ QOpenGLStaticContext *QOpenGLStaticContext::create(bool softwareRendering)
QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
{
- QDebug nsp = d.nospace();
- nsp << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "OpenGL: " << s.vendor << ',' << s.renderer << " default "
<< s.defaultFormat;
if (s.extensions & QOpenGLStaticContext::SampleBuffers)
- nsp << ",SampleBuffers";
+ d << ",SampleBuffers";
if (s.hasExtensions())
- nsp << ", Extension-API present";
- nsp << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
+ d << ", Extension-API present";
+ d << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
if (QWindowsContext::verbose > 1)
- nsp << s.extensionNames;
+ d << s.extensionNames;
return d;
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 1041ecf44d..9b0f126241 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -315,13 +315,12 @@ QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const
QWindowsWindowData obtained = QWindowsWindowData::create(window, requested, window->title());
qCDebug(lcQpaWindows).nospace()
- << __FUNCTION__ << '<' << window
- << "\n Requested: " << requested.geometry << "frame incl.: "
+ << __FUNCTION__ << ' ' << window
+ << "\n Requested: " << requested.geometry << " frame incl.="
<< QWindowsGeometryHint::positionIncludesFrame(window)
- << " Flags=" << requested.flags
- << "\n Obtained : " << obtained.geometry << " Margins "<< obtained.frame
- << " Flags=" << obtained.flags
- << " Handle=" << obtained.hwnd << '\n';
+ << ' ' << requested.flags
+ << "\n Obtained : " << obtained.geometry << " margins=" << obtained.frame
+ << " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n';
if (obtained.hwnd) {
if (requested.flags != obtained.flags)
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 28e2aadf14..7756c77001 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -173,20 +173,22 @@ static inline WindowsScreenDataList monitorData()
static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
{
- QDebug nospace = dbg.nospace();
- nospace << "Screen " << d.name << ' '
- << d.geometry.width() << 'x' << d.geometry.height() << '+' << d.geometry.x() << '+' << d.geometry.y()
- << " avail: "
- << d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y()
- << " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
- << " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth
- << " Format: " << d.format;
+ QDebugStateSaver saver(dbg);
+ dbg.nospace();
+ dbg.noquote();
+ dbg << "Screen \"" << d.name << "\" "
+ << d.geometry.width() << 'x' << d.geometry.height() << '+' << d.geometry.x() << '+' << d.geometry.y()
+ << " avail: "
+ << d.availableGeometry.width() << 'x' << d.availableGeometry.height() << '+' << d.availableGeometry.x() << '+' << d.availableGeometry.y()
+ << " physical: " << d.physicalSizeMM.width() << 'x' << d.physicalSizeMM.height()
+ << " DPI: " << d.dpi.first << 'x' << d.dpi.second << " Depth: " << d.depth
+ << " Format: " << d.format;
if (d.flags & QWindowsScreenData::PrimaryScreen)
- nospace << " primary";
+ dbg << " primary";
if (d.flags & QWindowsScreenData::VirtualDesktop)
- nospace << " virtual desktop";
+ dbg << " virtual desktop";
if (d.flags & QWindowsScreenData::LockScreen)
- nospace << " lock screen";
+ dbg << " lock screen";
return dbg;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index b19510073a..923040fd71 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -109,12 +109,13 @@ static QByteArray debugWinExStyle(DWORD exStyle)
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
QDebug operator<<(QDebug d, const MINMAXINFO &i)
{
- d.nospace() << "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;
+ 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
@@ -139,18 +140,20 @@ static inline RECT RECTfromQRect(const QRect &rect)
QDebug operator<<(QDebug d, const RECT &r)
{
- d.nospace() << "RECT: left/top=" << r.left << ',' << r.top
- << " right/bottom=" << r.right << ',' << r.bottom;
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "RECT: left/top=" << r.left << ',' << r.top
+ << " right/bottom=" << r.right << ',' << r.bottom;
return d;
}
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_NCCALCSIZE
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
{
- qDebug().nospace() << "NCCALCSIZE_PARAMS "
- << qrectFromRECT(p.rgrc[0])
- << ' ' << qrectFromRECT(p.rgrc[1]) << ' '
- << qrectFromRECT(p.rgrc[2]);
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "NCCALCSIZE_PARAMS " << qrectFromRECT(p.rgrc[0])
+ << ' ' << qrectFromRECT(p.rgrc[1]) << ' ' << qrectFromRECT(p.rgrc[2]);
return d;
}
#endif // !Q_OS_WINCE
@@ -417,13 +420,18 @@ struct WindowCreationData
QDebug operator<<(QDebug debug, const WindowCreationData &d)
{
- debug.nospace() << d.flags
- << " topLevel=" << d.topLevel << " popup="
- << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop
- << " embedded=" << d.embedded
- << " tool=" << d.tool << " style=" << debugWinStyle(d.style)
- << " exStyle=" << debugWinExStyle(d.exStyle)
- << " parent=" << d.parentHandle;
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+ debug << "WindowCreationData: " << d.flags
+ << "\n topLevel=" << d.topLevel;
+ if (d.parentHandle)
+ debug << " parent=" << d.parentHandle;
+ debug << " popup=" << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop
+ << " embedded=" << d.embedded << " tool=" << d.tool
+ << "\n style=" << debugWinStyle(d.style);
+ if (d.exStyle)
+ debug << "\n exStyle=" << debugWinExStyle(d.exStyle);
return debug;
}
@@ -614,8 +622,8 @@ QWindowsWindowData
QWindowsContext::instance()->setWindowCreationContext(context);
qCDebug(lcQpaWindows).nospace()
- << "CreateWindowEx: " << w << *this << " class=" <<windowClassName << " title=" << title
- << "\nrequested: " << rect << ": "
+ << "CreateWindowEx: " << w << " class=" << windowClassName << " title=" << title
+ << '\n' << *this << "\nrequested: " << rect << ": "
<< context->frameWidth << 'x' << context->frameHeight
<< '+' << context->frameX << '+' << context->frameY
<< " custom margins: " << context->customMargins;
@@ -631,7 +639,7 @@ QWindowsWindowData
#endif
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
- << context->obtainedGeometry << context->margins;
+ << context->obtainedGeometry << ' ' << context->margins;
if (!result.hwnd) {
qErrnoWarning("%s: CreateWindowEx failed", __FUNCTION__);
@@ -732,9 +740,9 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle)
qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__);
const QMargins result(qAbs(rect.left), qAbs(rect.top),
qAbs(rect.right), qAbs(rect.bottom));
- qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style= 0x"
- << QString::number(style, 16) << " exStyle=0x" << QString::number(exStyle, 16) << ' ' << rect << ' ' << result;
-
+ qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style="
+ << showbase << hex << style << " exStyle=" << exStyle << dec << noshowbase
+ << ' ' << rect << ' ' << result;
return result;
}
@@ -853,12 +861,12 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
}
qCDebug(lcQpaWindows).nospace()
- << __FUNCTION__ << ' ' << w << geometry
- << " pos incl. frame" << QWindowsGeometryHint::positionIncludesFrame(w)
- << " frame: " << frameWidth << 'x' << frameHeight << '+'
+ << __FUNCTION__ << ' ' << w << ' ' << geometry
+ << " pos incl. frame=" << QWindowsGeometryHint::positionIncludesFrame(w)
+ << " frame=" << frameWidth << 'x' << frameHeight << '+'
<< frameX << '+' << frameY
- << " min" << geometryHint.minimumSize << " max" << geometryHint.maximumSize
- << " custom margins " << customMargins;
+ << " min=" << geometryHint.minimumSize << " max=" << geometryHint.maximumSize
+ << " custom margins=" << customMargins;
}
/*!
@@ -1422,10 +1430,10 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const
const QMargins margins = frameMarginsDp();
const QRect frameGeometry = rect + margins;
- qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window()
- << " \n from " << geometry_sys() << " frame: "
- << margins << " to " <<rect
- << " new frame: " << frameGeometry;
+ qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << window()
+ << "\n from " << geometry_sys() << " frame: "
+ << margins << " to " <<rect
+ << " new frame: " << frameGeometry;
bool result = false;
#ifndef Q_OS_WINCE
@@ -1446,8 +1454,8 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const
result = MoveWindow(m_data.hwnd, frameGeometry.x(), frameGeometry.y(),
frameGeometry.width(), frameGeometry.height(), true);
}
- qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window()
- << " \n resulting " << result << geometry_sys();
+ qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << window()
+ << "\n resulting " << result << geometry_sys();
}
QRect QWindowsWindow::frameGeometry_sys() const
@@ -2131,8 +2139,8 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
#ifndef QT_NO_CURSOR
if (c.handle() != m_cursor.handle()) {
const bool apply = applyNewCursor(window());
- qCDebug(lcQpaWindows) <<window() << __FUNCTION__
- << "Shape=" << c.cursor().shape() << " doApply=" << apply;
+ qCDebug(lcQpaWindows) << window() << __FUNCTION__
+ << c.cursor().shape() << " doApply=" << apply;
m_cursor = c;
if (apply)
applyCursor();
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index a0d6d88d11..c14ec0bb3f 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -108,10 +108,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
}
const int dpr = int(devicePixelRatio());
- // On VNC, it can be that physical size is unknown while
- // virtual size is known (probably back-calculated from DPI and resolution)
- if (m_sizeMillimeters.isEmpty())
- m_sizeMillimeters = m_virtualSizeMillimeters;
if (m_geometry.isEmpty()) {
m_geometry = QRect(QPoint(), m_virtualSize/dpr);
m_nativeGeometry = QRect(QPoint(), m_virtualSize);
@@ -353,6 +349,12 @@ QImage::Format QXcbScreen::format() const
return QImage::Format_RGB32;
}
+QDpi QXcbScreen::virtualDpi() const
+{
+ return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
+ Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
+}
+
QDpi QXcbScreen::logicalDpi() const
{
static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI");
@@ -363,8 +365,7 @@ QDpi QXcbScreen::logicalDpi() const
int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio());
return QDpi(m_forcedDpi/primaryDpr, m_forcedDpi/primaryDpr);
}
- return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(),
- Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height());
+ return virtualDpi();
}
@@ -415,7 +416,6 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
return;
m_rotation = change_event->rotation;
- updateGeometry(change_event->timestamp);
switch (m_rotation) {
case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal
m_orientation = Qt::LandscapeOrientation;
@@ -451,6 +451,8 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
case XCB_RANDR_ROTATION_REFLECT_Y: break;
}
+ updateGeometry(change_event->timestamp);
+
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry());
QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation);
@@ -504,6 +506,15 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation)
break;
}
+ // It can be that physical size is unknown while virtual size
+ // is known (probably back-calculated from DPI and resolution),
+ // e.g. on VNC or with some hardware.
+ if (m_sizeMillimeters.isEmpty()) {
+ QDpi dpi = virtualDpi();
+ m_sizeMillimeters = QSizeF(Q_MM_PER_INCH * xGeometry.width() / dpi.first,
+ Q_MM_PER_INCH * xGeometry.width() / dpi.second);
+ }
+
xcb_get_property_reply_t * workArea =
xcb_get_property_reply(xcb_connection(),
xcb_get_property_unchecked(xcb_connection(), false, screen()->root,
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index a29efc1e79..ec05e3bb25 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -94,6 +94,7 @@ public:
QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; }
QSize virtualSize() const { return m_virtualSize; }
QSizeF physicalVirtualSize() const { return m_virtualSizeMillimeters; }
+ QDpi virtualDpi() const;
QDpi logicalDpi() const Q_DECL_OVERRIDE;
qreal devicePixelRatio() const Q_DECL_OVERRIDE;
QPlatformCursor *cursor() const Q_DECL_OVERRIDE;