Windows QPA: Do not call enableNonClientDpiScaling() for embedded windows

Do not call if the property indicating embedded windows is set.

Task-number: QTBUG-61972
Change-Id: I8f34dd8a59f1e5c9c8064646bcb15acea115cd68
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Friedemann Kleint 2017-07-17 14:58:45 +02:00
parent 1b190e7ea6
commit ea4fae0df6
3 changed files with 8 additions and 2 deletions

View File

@ -970,8 +970,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return true;
case QtWindows::NonClientCreate:
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel())
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && d->m_creationContext->window->isTopLevel()
&& !d->m_creationContext->window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()) {
enableNonClientDpiScaling(msg.hwnd);
}
return false;
case QtWindows::CalculateSize:
return QWindowsGeometryHint::handleCalculateSize(d->m_creationContext->customMargins, msg, result);

View File

@ -489,7 +489,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
// Sometimes QWindow doesn't have a QWindow parent but does have a native parent window,
// e.g. in case of embedded ActiveQt servers. They should not be considered a top-level
// windows in such cases.
QVariant prop = w->property("_q_embedded_native_parent_handle");
QVariant prop = w->property(QWindowsWindow::embeddedNativeParentHandleProperty);
if (prop.isValid()) {
embedded = true;
parentHandle = reinterpret_cast<HWND>(prop.value<WId>());
@ -1035,6 +1035,8 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
\ingroup qt-lighthouse-win
*/
const char *QWindowsWindow::embeddedNativeParentHandleProperty = "_q_embedded_native_parent_handle";
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow),
m_data(data),

View File

@ -319,6 +319,8 @@ public:
void setHasBorderInFullScreen(bool border);
static QString formatWindowTitle(const QString &title);
static const char *embeddedNativeParentHandleProperty;
private:
inline void show_sys() const;
inline QWindowsWindowData setWindowFlags_sys(Qt::WindowFlags wt, unsigned flags = 0) const;