summaryrefslogtreecommitdiffstats
path: root/src/gui/util/qsystemtrayicon_win.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@trolltech.com>2009-07-14 14:50:51 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-07-14 14:57:40 (GMT)
commit5a2027850cd476046143f70d19a7fc07b76d46e7 (patch)
tree5f8ff9daf0065936a9e4651a22a9281d1e94f073 /src/gui/util/qsystemtrayicon_win.cpp
parent93db2c44b7b01eb08ef6f447d4a84198b2dcd1e3 (diff)
downloadQt-5a2027850cd476046143f70d19a7fc07b76d46e7.zip
Qt-5a2027850cd476046143f70d19a7fc07b76d46e7.tar.gz
Qt-5a2027850cd476046143f70d19a7fc07b76d46e7.tar.bz2
support context menu for system tray icons on Windows CE
This is Windows CE only. For Windows mobile we don't support context menus for system tray icons. Task-number: 250528 Reviewed-by: thartman
Diffstat (limited to 'src/gui/util/qsystemtrayicon_win.cpp')
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index dea9264..85eae26 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -314,7 +314,6 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
emit q->activated(QSystemTrayIcon::Trigger);
break;
-#if !defined(Q_WS_WINCE)
case WM_LBUTTONDBLCLK:
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
@@ -322,20 +321,30 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case WM_RBUTTONUP:
if (q->contextMenu()) {
q->contextMenu()->popup(gpos);
+#if defined(Q_WS_WINCE)
+ // We must ensure that the popup menu doesn't show up behind the task bar.
+ QRect desktopRect = qApp->desktop()->availableGeometry();
+ int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height();
+ if (gpos.y() > maxY) {
+ gpos.ry() = maxY;
+ q->contextMenu()->move(gpos);
+ }
+#endif
q->contextMenu()->activateWindow();
//Must be activated for proper keyboardfocus and menu closing on windows:
}
emit q->activated(QSystemTrayIcon::Context);
break;
+#if !defined(Q_WS_WINCE)
case NIN_BALLOONUSERCLICK:
emit q->messageClicked();
break;
+#endif
case WM_MBUTTONUP:
emit q->activated(QSystemTrayIcon::MiddleClick);
break;
-#endif
default:
break;
}