summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_win.cpp
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-06-24 13:02:02 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-06-24 13:13:59 (GMT)
commitd806b996beab76cbc43ffa11bc38721fa19c9c81 (patch)
treea201e5c9553a172f26e340cd12eda25fd6623143 /src/gui/kernel/qapplication_win.cpp
parent598ba59b9d2e4b28469088d4ef12407b0c27514a (diff)
downloadQt-d806b996beab76cbc43ffa11bc38721fa19c9c81.zip
Qt-d806b996beab76cbc43ffa11bc38721fa19c9c81.tar.gz
Qt-d806b996beab76cbc43ffa11bc38721fa19c9c81.tar.bz2
No more enter & leave events after a popup menu is closed on Windows
We use the TrackMouseEvent() to keep track of enter and leave messages. Upon receiving a WM_MOUSELEAVE, the effect of that function call is over, we need to call it again if we need more messages. This was not done when we close a popup because of mouse click outside. Task-number: QTBUG-11582 Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui/kernel/qapplication_win.cpp')
-rw-r--r--src/gui/kernel/qapplication_win.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2a85fdc..ef719ca 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -3065,6 +3065,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
break;
}
}
+#ifndef Q_OS_WINCE
+ static bool trackMouseEventLookup = false;
+ typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
+ static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
+#endif
state = translateButtonState(msg.wParam, type, button); // button state
const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y));
QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
@@ -3129,9 +3134,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
#ifndef Q_OS_WINCE
if (curWin != 0) {
- static bool trackMouseEventLookup = false;
- typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
- static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
if (!trackMouseEventLookup) {
trackMouseEventLookup = true;
ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
@@ -3245,6 +3247,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
qt_button_down = 0;
}
+#ifndef Q_OS_WINCE
+ if (type == QEvent::MouseButtonPress
+ && QApplication::activePopupWidget() != activePopupWidget
+ && ptrTrackMouseEvent
+ && curWin) {
+ // Since curWin is already the window we clicked on,
+ // we have to setup the mouse tracking here.
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = 0x00000002; // TME_LEAVE
+ tme.hwndTrack = curWin; // Track on window receiving msgs
+ tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
+ ptrTrackMouseEvent(&tme);
+ }
+#endif
if (type == QEvent::MouseButtonPress
&& QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {