summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp64
1 files changed, 37 insertions, 27 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index b6118431d3..1dbac78fca 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -1,32 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -175,7 +181,7 @@ void QWindowsUser32DLL::init()
// MinGW (g++ 3.4.5) accepts only C casts.
setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes"));
updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow"));
- if (!setLayeredWindowAttributes || !updateLayeredWindow)
+ if (Q_UNLIKELY(!setLayeredWindowAttributes || !updateLayeredWindow))
qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow').");
updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
@@ -504,28 +510,29 @@ QString QWindowsContext::registerWindowClass(const QWindow *w)
break;
}
// Create a unique name for the flag combination
- QString cname = QStringLiteral("Qt5QWindow");
+ QString cname;
+ cname += QLatin1String("Qt5QWindow");
switch (type) {
case Qt::Tool:
- cname += QStringLiteral("Tool");
+ cname += QLatin1String("Tool");
break;
case Qt::ToolTip:
- cname += QStringLiteral("ToolTip");
+ cname += QLatin1String("ToolTip");
break;
case Qt::Popup:
- cname += QStringLiteral("Popup");
+ cname += QLatin1String("Popup");
break;
default:
break;
}
if (style & CS_DROPSHADOW)
- cname += QStringLiteral("DropShadow");
+ cname += QLatin1String("DropShadow");
if (style & CS_SAVEBITS)
- cname += QStringLiteral("SaveBits");
+ cname += QLatin1String("SaveBits");
if (style & CS_OWNDC)
- cname += QStringLiteral("OwnDC");
+ cname += QLatin1String("OwnDC");
if (icon)
- cname += QStringLiteral("Icon");
+ cname += QLatin1String("Icon");
return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);
}
@@ -823,8 +830,8 @@ static inline QString errorMessageFromComError(const _com_error &comError)
return result;
}
if (const WORD wCode = comError.WCode())
- return QStringLiteral("IDispatch error #") + QString::number(wCode);
- return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16);
+ return QString::asprintf("IDispatch error #%u", uint(wCode));
+ return QString::asprintf("Unknown error 0x0%x", uint(comError.Error()));
}
#endif // !Q_OS_WINCE
@@ -1165,8 +1172,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
d->m_tabletSupport->notifyActivate();
#endif // !QT_NO_TABLETEVENT
if (platformWindow->testFlag(QWindowsWindow::BlockedByModal))
- if (const QWindow *modalWindow = QGuiApplication::modalWindow())
- QWindowsWindow::baseWindowOf(modalWindow)->alertWindow();
+ if (const QWindow *modalWindow = QGuiApplication::modalWindow()) {
+ QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(modalWindow);
+ Q_ASSERT(platformWindow);
+ platformWindow->alertWindow();
+ }
break;
case QtWindows::MouseActivateWindowEvent:
if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) {