summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-02-17 20:31:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-17 20:31:38 +0100
commite88011357e5dd3b0ae4e6bc715ef29e5f4f3ffab (patch)
treec5b05d45e49194d70ff4defae41e5d5d5cf75e80 /src/widgets/util
parent2df8884bc68343ad96962e7496b98d6e585c0347 (diff)
parente65cd6f3794e12e6bc5c2ee985eae8e70ff5f333 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qscroller.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp32
2 files changed, 21 insertions, 13 deletions
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index baa1ab2e9a..1670d0ab57 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -234,7 +234,7 @@ private:
/*!
\class QScroller
\brief The QScroller class enables kinetic scrolling for any scrolling widget or graphics item.
- \since 4.8
+ \since 5.0
\inmodule QtWidgets
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 8d8d731795..209fb206e1 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -166,21 +166,29 @@ extern "C" LRESULT QT_WIN_CALLBACK qWindowsTrayconWndProc(HWND hwnd, UINT messag
}
// Invoke a service of the native Windows interface to create
-// a non-visible message window.
+// a non-visible toplevel window to receive tray messages.
+// Note: Message windows (HWND_MESSAGE) are not sufficient, they
+// will not receive the "TaskbarCreated" message.
static inline HWND createTrayIconMessageWindow()
{
- if (QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface()) {
- void *hwnd = 0;
- void *wndProc = reinterpret_cast<void *>(qWindowsTrayconWndProc);
- if (QMetaObject::invokeMethod(ni, "createMessageWindow", Qt::DirectConnection,
- Q_RETURN_ARG(void *, hwnd),
- Q_ARG(QString, QStringLiteral("QTrayIconMessageWindowClass")),
- Q_ARG(QString, QStringLiteral("QTrayIconMessageWindow")),
- Q_ARG(void *, wndProc)) && hwnd) {
- return reinterpret_cast<HWND>(hwnd);
- }
+ QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface();
+ if (!ni)
+ return 0;
+ // Register window class in the platform plugin.
+ QString className;
+ void *wndProc = reinterpret_cast<void *>(qWindowsTrayconWndProc);
+ if (!QMetaObject::invokeMethod(ni, "registerWindowClass", Qt::DirectConnection,
+ Q_RETURN_ARG(QString, className),
+ Q_ARG(QString, QStringLiteral("QTrayIconMessageWindowClass")),
+ Q_ARG(void *, wndProc))) {
+ return 0;
}
- return 0;
+ const wchar_t windowName[] = L"QTrayIconMessageWindow";
+ return CreateWindowEx(0, (wchar_t*)className.utf16(),
+ windowName, WS_OVERLAPPED,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ NULL, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
}
QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)