summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-07-24 15:41:56 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-07-24 15:46:11 (GMT)
commit960c0a8661e3df311a85075b0ff610c4031c6012 (patch)
tree90744354f8a0606ff3046674e56d423514781c3a /src
parentf74b368c08f9bd1f638f32bccdb4da6dbd89cfea (diff)
downloadQt-960c0a8661e3df311a85075b0ff610c4031c6012.zip
Qt-960c0a8661e3df311a85075b0ff610c4031c6012.tar.gz
Qt-960c0a8661e3df311a85075b0ff610c4031c6012.tar.bz2
Fix QSystemTrayIcon causing three activated signals on doubleclick
The problem was that on Windows, we would activate on WM_LButtonUp, but a double click after activating will also generate a second WM_LButtonUp. Hence we get three activations. The fix was basically to filter out the second WM_LButtonUP, something we also do in qapplication_win.cpp. Task-number: 205499 Reviewed-by: denis
Diffstat (limited to 'src')
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index 85eae26..a0648a1 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -106,6 +106,7 @@ public:
private:
uint notifyIconSize;
int maxTipLength;
+ bool ignoreNextMouseRelease;
};
bool QSystemTrayIconSys::allowsMessages()
@@ -128,7 +129,8 @@ bool QSystemTrayIconSys::supportsMessages()
}
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
- : hIcon(0), q(object)
+ : hIcon(0), q(object), ignoreNextMouseRelease(false)
+
{
#ifndef Q_OS_WINCE
notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE;
@@ -311,10 +313,15 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
switch (m->lParam) {
case WM_LBUTTONUP:
- emit q->activated(QSystemTrayIcon::Trigger);
+ if (ignoreNextMouseRelease)
+ ignoreNextMouseRelease = false;
+ else
+ emit q->activated(QSystemTrayIcon::Trigger);
break;
case WM_LBUTTONDBLCLK:
+ ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
+ // release we must ignore it
emit q->activated(QSystemTrayIcon::DoubleClick);
break;