summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-03 14:20:01 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-04 11:12:05 +0100
commitca2f44680cb97e7a7c46ee0ab26654822fe65e2d (patch)
treeb9d85ad8ec1b18a6aa56b7657812cf3791bdf72e /src/plugins/platforms/windows
parent28a21d98ef8d880a6dd86ee19dd803424bb5eae1 (diff)
parent83188c6499ccdc87c0a2c468bb497e287f5db369 (diff)
Merge branch 'stable' into dev
Conflicts: examples/widgets/painting/shared/shared.pri src/corelib/tools/qharfbuzz_p.h src/corelib/tools/qunicodetools.cpp src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp Change-Id: Ibc9860abf570e5ce8b052fb88feb73ec35e64bd3
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.cpp20
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.h3
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp6
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp30
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp167
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp22
-rw-r--r--src/plugins/platforms/windows/windows.pro5
10 files changed, 157 insertions, 111 deletions
diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp
index 5e5a1ebd0f..a67e2c4534 100644
--- a/src/plugins/platforms/windows/accessible/comutils.cpp
+++ b/src/plugins/platforms/windows/accessible/comutils.cpp
@@ -88,7 +88,7 @@ inline uint QColorToOLEColor(const QColor &col)
return qRgba(col.blue(), col.green(), col.red(), 0x00);
}
-bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out)
+bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out)
{
QVariant qvar = var;
// "type" is the expected type, so coerce if necessary
@@ -107,12 +107,12 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
}
if (out && arg.vt == (VT_VARIANT|VT_BYREF) && arg.pvarVal) {
- return QVariantToVARIANT(var, *arg.pvarVal, typeName, false);
+ return QVariant2VARIANT(var, *arg.pvarVal, typeName, false);
}
if (out && proptype == QVariant::UserType && typeName == "QVariant") {
VARIANT *pVariant = new VARIANT;
- QVariantToVARIANT(var, *pVariant, QByteArray(), false);
+ QVariant2VARIANT(var, *pVariant, QByteArray(), false);
arg.vt = VT_VARIANT|VT_BYREF;
arg.pvarVal = pVariant;
return true;
@@ -409,7 +409,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
for (LONG j = 0; j < columnCount; ++j) {
QVariant elem = columns.at(j);
VariantInit(&variant);
- QVariantToVARIANT(elem, variant, elem.typeName());
+ QVariant2VARIANT(elem, variant, elem.typeName());
rgIndices[1] = j;
SafeArrayPutElement(array, rgIndices, pElement);
clearVARIANT(&variant);
@@ -425,7 +425,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
if (listType != QVariant::LastType)
elem.convert(listType);
VariantInit(&variant);
- QVariantToVARIANT(elem, variant, elem.typeName());
+ QVariant2VARIANT(elem, variant, elem.typeName());
SafeArrayPutElement(array, &index, pElement);
clearVARIANT(&variant);
}
@@ -555,7 +555,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
arg.pRecInfo = recordInfo,
arg.pvRecord = record;
if (out) {
- qWarning("QVariantToVARIANT: out-parameter not supported for records");
+ qWarning("QVariant2VARIANT: out-parameter not supported for records");
return false;
}
}
@@ -574,7 +574,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
if (arg.pdispVal)
arg.pdispVal->AddRef();
if (out) {
- qWarning("QVariantToVARIANT: out-parameter not supported for IDispatch");
+ qWarning("QVariant2VARIANT: out-parameter not supported for IDispatch");
return false;
}
} else if (!qstrcmp(qvar.typeName(), "IDispatch**")) {
@@ -588,7 +588,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
if (arg.punkVal)
arg.punkVal->AddRef();
if (out) {
- qWarning("QVariantToVARIANT: out-parameter not supported for IUnknown");
+ qWarning("QVariant2VARIANT: out-parameter not supported for IUnknown");
return false;
}
#ifdef QAX_SERVER
@@ -602,7 +602,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
qAxFactory()->createObjectWrapper(static_cast<QObject*>(user), &arg.pdispVal);
}
if (out) {
- qWarning("QVariantToVARIANT: out-parameter not supported for subtype");
+ qWarning("QVariant2VARIANT: out-parameter not supported for subtype");
return false;
}
#else
@@ -612,7 +612,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type
arg.vt = VT_DISPATCH;
object->queryInterface(IID_IDispatch, (void**)&arg.pdispVal);
if (out) {
- qWarning("QVariantToVARIANT: out-parameter not supported for subtype");
+ qWarning("QVariant2VARIANT: out-parameter not supported for subtype");
return false;
}
#endif
diff --git a/src/plugins/platforms/windows/accessible/comutils.h b/src/plugins/platforms/windows/accessible/comutils.h
index c9ed2b1224..8593f68d76 100644
--- a/src/plugins/platforms/windows/accessible/comutils.h
+++ b/src/plugins/platforms/windows/accessible/comutils.h
@@ -52,7 +52,8 @@ QT_BEGIN_NAMESPACE
class QVariant;
-bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out);
+// Originally QVariantToVARIANT copied from ActiveQt - renamed to avoid conflicts in static builds.
+bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out);
inline QString BSTRToQString(const BSTR &bstr)
{
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 03bb94db8f..838cd055ab 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -1425,7 +1425,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *curre
return E_FAIL;
if (QAccessibleValueInterface *valueIface = valueInterface()) {
const QVariant var = valueIface->currentValue();
- if (QVariantToVARIANT(var, *currentValue, QByteArray(), false))
+ if (QVariant2VARIANT(var, *currentValue, QByteArray(), false))
return S_OK;
}
@@ -1456,7 +1456,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maxim
return E_FAIL;
if (QAccessibleValueInterface *valueIface = valueInterface()) {
const QVariant var = valueIface->maximumValue();
- if (QVariantToVARIANT(var, *maximumValue, QByteArray(), false))
+ if (QVariant2VARIANT(var, *maximumValue, QByteArray(), false))
return S_OK;
}
maximumValue->vt = VT_EMPTY;
@@ -1470,7 +1470,7 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_minimumValue(VARIANT *minim
return E_FAIL;
if (QAccessibleValueInterface *valueIface = valueInterface()) {
const QVariant var = valueIface->minimumValue();
- if (QVariantToVARIANT(var, *minimumValue, QByteArray(), false))
+ if (QVariant2VARIANT(var, *minimumValue, QByteArray(), false))
return S_OK;
}
minimumValue->vt = VT_EMPTY;
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 94a5dd6a68..44a79d86ee 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -48,6 +48,7 @@
#include <QtCore/qlocale.h>
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qsettings.h>
#include <QtGui/qaccessible.h>
#include <QtGui/qaccessible2.h>
@@ -87,10 +88,9 @@
// This stuff is used for widgets/items with no window handle:
-typedef QMap<int, QPair<QObject*,int> > NotifyMap;
+typedef QMap<int, QPair<QPointer<QObject>,int> > NotifyMap;
Q_GLOBAL_STATIC(NotifyMap, qAccessibleRecentSentEvents)
-
QT_BEGIN_NAMESPACE
@@ -182,14 +182,25 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window);
static int eventNum = 0;
- if (event->type() != QAccessible::MenuCommand) { // MenuCommand is faked
- // See comment "SENDING EVENTS TO OBJECTS WITH NO WINDOW HANDLE"
+ if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
+ event->type() != QAccessible::ObjectDestroyed) {
+ /* In some rare occasions, the server (Qt) might get a ::get_accChild call with a
+ childId that references an entry in the cache where there was a dangling
+ QObject-pointer. Previously we crashed on this.
+
+ There is no point in actually notifying the AT client that the object got destroyed,
+ because the AT client won't query for get_accChild if the event is ObjectDestroyed
+ anyway, and we have no other way of mapping the eventId argument to the actual
+ child/descendant object. (Firefox seems to simply completely ignore
+ EVENT_OBJECT_DESTROY).
+
+ We therefore guard each QObject in the cache with a QPointer, and only notify the AT
+ client if the type is not ObjectDestroyed.
+ */
eventNum %= 50; //[0..49]
int eventId = - (eventNum - 1);
-
- qAccessibleRecentSentEvents()->insert(eventId, qMakePair(event->object(), event->child()));
- ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId );
-
+ qAccessibleRecentSentEvents()->insert(eventId, qMakePair(QPointer<QObject>(event->object()), event->child()));
+ ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, eventId);
++eventNum;
}
#endif // Q_OS_WINCE
@@ -233,7 +244,8 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
*/
QPair<QObject*, int> QWindowsAccessibility::getCachedObject(int entryId)
{
- return qAccessibleRecentSentEvents()->value(entryId);
+ QPair<QPointer<QObject>, int> pair = qAccessibleRecentSentEvents()->value(entryId);
+ return qMakePair(pair.first.data(), pair.second);
}
/*
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 328053604e..f1bdc77303 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -757,7 +757,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI
acc = res;
}
} else {
- qWarning("get_accChild got a negative varChildID, but did not find it in cache");
+ qWarning("get_accChild got a negative varChildID (%d), but did not find it in cache", childIndex);
}
} else {
if (childIndex) {
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 5a1b4f1522..d4a8bd12d3 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -1033,17 +1033,17 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
writingSystems.setSupported(ws);
}
- QPlatformFontDatabase::registerFont(familyName, foundryName, weight,
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
// add fonts windows can generate for us:
if (weight <= QFont::DemiBold)
- QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold,
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
if (style != QFont::StyleItalic)
- QPlatformFontDatabase::registerFont(familyName, foundryName, weight,
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
- QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold,
+ QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
if (!englishName.isEmpty())
@@ -1298,43 +1298,6 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
return fontEngine;
}
-QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
-{
- QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script);
- if (!result.isEmpty())
- return result;
-
- switch (styleHint) {
- case QFont::Times:
- result << QString::fromLatin1("Times New Roman");
- break;
- case QFont::Courier:
- result << QString::fromLatin1("Courier New");
- break;
- case QFont::Monospace:
- result << QString::fromLatin1("Courier New");
- break;
- case QFont::Cursive:
- result << QString::fromLatin1("Comic Sans MS");
- break;
- case QFont::Fantasy:
- result << QString::fromLatin1("Impact");
- break;
- case QFont::Decorative:
- result << QString::fromLatin1("Old English");
- break;
- case QFont::Helvetica:
- case QFont::System:
- default:
- result << QString::fromLatin1("Arial");
- }
-
- if (QWindowsContext::verboseFonts)
- qDebug() << __FUNCTION__ << family << style << styleHint
- << script << result << m_families.size();
- return result;
-}
-
static QList<quint32> getTrueTypeFontOffsets(const uchar *fontData)
{
QList<quint32> offsets;
@@ -1686,6 +1649,82 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
return lf;
}
+static QStringList extraTryFontsForFamily(const QString& family)
+{
+ QStringList result;
+ QFontDatabase db;
+ if (!db.writingSystems(family).contains(QFontDatabase::Symbol)) {
+ if (!tryFonts) {
+ LANGID lid = GetUserDefaultLangID();
+ switch (lid&0xff) {
+ case LANG_CHINESE: // Chinese (Taiwan)
+ if ( lid == 0x0804 ) // Taiwan
+ tryFonts = ch_TW_tryFonts;
+ else
+ tryFonts = ch_CN_tryFonts;
+ break;
+ case LANG_JAPANESE:
+ tryFonts = jp_tryFonts;
+ break;
+ case LANG_KOREAN:
+ tryFonts = kr_tryFonts;
+ break;
+ default:
+ tryFonts = other_tryFonts;
+ break;
+ }
+ }
+ QStringList fm = QFontDatabase().families();
+ const char **tf = tryFonts;
+ while (tf && *tf) {
+ if (fm.contains(QLatin1String(*tf)))
+ result << QLatin1String(*tf);
+ ++tf;
+ }
+ }
+ return result;
+}
+
+QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script);
+ if (!result.isEmpty())
+ return result;
+
+ switch (styleHint) {
+ case QFont::Times:
+ result << QString::fromLatin1("Times New Roman");
+ break;
+ case QFont::Courier:
+ result << QString::fromLatin1("Courier New");
+ break;
+ case QFont::Monospace:
+ result << QString::fromLatin1("Courier New");
+ break;
+ case QFont::Cursive:
+ result << QString::fromLatin1("Comic Sans MS");
+ break;
+ case QFont::Fantasy:
+ result << QString::fromLatin1("Impact");
+ break;
+ case QFont::Decorative:
+ result << QString::fromLatin1("Old English");
+ break;
+ case QFont::Helvetica:
+ case QFont::System:
+ default:
+ result << QString::fromLatin1("Arial");
+ }
+
+ result.append(extraTryFontsForFamily(family));
+
+ if (QWindowsContext::verboseFonts)
+ qDebug() << __FUNCTION__ << family << style << styleHint
+ << script << result << m_families.size();
+ return result;
+}
+
+
QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request,
HDC fontHdc, int dpi, bool rawMode,
const QStringList &family_list,
@@ -1849,42 +1888,16 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ
#endif
if (script == QChar::Script_Common
- && !(request.styleStrategy & QFont::NoFontMerging)) {
- QFontDatabase db;
- if (!db.writingSystems(request.family).contains(QFontDatabase::Symbol)) {
- if(!tryFonts) {
- LANGID lid = GetUserDefaultLangID();
- switch( lid&0xff ) {
- case LANG_CHINESE: // Chinese (Taiwan)
- if ( lid == 0x0804 ) // Taiwan
- tryFonts = ch_TW_tryFonts;
- else
- tryFonts = ch_CN_tryFonts;
- break;
- case LANG_JAPANESE:
- tryFonts = jp_tryFonts;
- break;
- case LANG_KOREAN:
- tryFonts = kr_tryFonts;
- break;
- default:
- tryFonts = other_tryFonts;
- break;
- }
- }
- QStringList fm = QFontDatabase().families();
- QStringList list = family_list;
- const char **tf = tryFonts;
- while(tf && *tf) {
- if(fm.contains(QLatin1String(*tf)))
- list << QLatin1String(*tf);
- ++tf;
- }
- QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list);
- mfe->setObjectName(QStringLiteral("QWindowsMultiFontEngine_") + request.family);
- mfe->fontDef = fe->fontDef;
- fe = mfe;
- }
+ && !(request.styleStrategy & QFont::NoFontMerging)) {
+ QStringList extraFonts = extraTryFontsForFamily(request.family);
+ if (extraFonts.size()) {
+ QStringList list = family_list;
+ list.append(extraFonts);
+ QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list);
+ mfe->setObjectName(QStringLiteral("QWindowsMultiFontEngine_") + request.family);
+ mfe->fontDef = fe->fontDef;
+ fe = mfe;
+ }
}
return fe;
}
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index d30c1f984d..0509a55eaa 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -279,20 +279,20 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
if (!QDir::isAbsolutePath(value))
value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\"));
- QPlatformFontDatabase::registerFont(faceName, foundryName, weight, style, stretch,
+ QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
// add fonts windows can generate for us:
if (weight <= QFont::DemiBold)
- QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, style, stretch,
+ QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
if (style != QFont::StyleItalic)
- QPlatformFontDatabase::registerFont(faceName, foundryName, weight, QFont::StyleItalic, stretch,
+ QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
- QPlatformFontDatabase::registerFont(faceName, foundryName, QFont::Bold, QFont::StyleItalic, stretch,
+ QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
if (!englishName.isEmpty())
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index f7ba0d237d..210405d4ba 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -41,6 +41,11 @@
#ifndef QT_NO_DIRECTWRITE
+#if _WIN32_WINNT < 0x0600
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+#endif
+
#include "qwindowsfontenginedirectwrite.h"
#include "qwindowsfontdatabase.h"
#include "qwindowscontext.h"
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 1f6253438f..3831c6b10e 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -55,6 +55,7 @@
#include <QtGui/QWindow>
#include <QtGui/QRegion>
#include <private/qwindow_p.h>
+#include <private/qguiapplication_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/QDebug>
@@ -321,7 +322,6 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel();
if (topLevel && flags == 1) {
- qWarning("Remove me: fixing toplevel window flags");
flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint
|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint;
}
@@ -731,6 +731,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0);
setWindowState(aWindow->windowState());
+ const qreal opacity = qt_window_private(aWindow)->opacity;
+ if (!qFuzzyCompare(opacity, qreal(1.0)))
+ setOpacity(opacity);
}
QWindowsWindow::~QWindowsWindow()
@@ -1185,8 +1188,21 @@ void QWindowsWindow::setWindowTitle(const QString &title)
{
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() <<title;
- if (m_data.hwnd)
- SetWindowText(m_data.hwnd, (const wchar_t*)title.utf16());
+ if (m_data.hwnd) {
+
+ QString fullTitle = title;
+ if (QGuiApplicationPrivate::displayName) {
+ // Append display name, if set.
+ if (!fullTitle.isEmpty())
+ fullTitle += QStringLiteral(" - ");
+ fullTitle += *QGuiApplicationPrivate::displayName;
+ } else if (fullTitle.isEmpty()) {
+ // Don't let the window title be completely empty, use the app name as fallback.
+ fullTitle = QCoreApplication::applicationName();
+ }
+
+ SetWindowText(m_data.hwnd, (const wchar_t*)fullTitle.utf16());
+ }
}
void QWindowsWindow::setWindowFlags(Qt::WindowFlags flags)
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 794bd3aa35..7f73465135 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -1,14 +1,13 @@
-TARGET = windows
+TARGET = qwindows
PLUGIN_TYPE = platforms
+PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin
load(qt_plugin)
QT *= core-private
QT *= gui-private
QT *= platformsupport-private
-INCLUDEPATH += ../../../3rdparty/harfbuzz/src
-
# Note: OpenGL32 must precede Gdi32 as it overwrites some functions.
LIBS *= -lole32
!wince*:LIBS *= -lgdi32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32