Mikołaj Zalewski : user32: Send a WM_MOUSELEAVE even if another window calls TrackMouseEvent before the timer proc is called .
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Oct 16 13:59:19 CDT 2006
Module: wine
Branch: master
Commit: a82b96f1b557c92b32a6b82bbe5ccaab70792236
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a82b96f1b557c92b32a6b82bbe5ccaab70792236
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Mon Oct 16 17:37:40 2006 +0200
user32: Send a WM_MOUSELEAVE even if another window calls TrackMouseEvent before the timer proc is called.
---
dlls/user/input.c | 73 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/dlls/user/input.c b/dlls/user/input.c
index 28930ee..2c3d38c 100644
--- a/dlls/user/input.c
+++ b/dlls/user/input.c
@@ -758,6 +758,41 @@ typedef struct __TRACKINGLIST {
static _TRACKINGLIST tracking_info;
static UINT_PTR timer;
+static void check_mouse_leave(HWND hwnd, int hittest)
+{
+ if (tracking_info.tme.hwndTrack != hwnd)
+ {
+ if (tracking_info.tme.dwFlags & TME_NONCLIENT)
+ PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
+ else
+ PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
+
+ /* remove the TME_LEAVE flag */
+ tracking_info.tme.dwFlags &= ~TME_LEAVE;
+ }
+ else
+ {
+ if (hittest == HTCLIENT)
+ {
+ if (tracking_info.tme.dwFlags & TME_NONCLIENT)
+ {
+ PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
+ /* remove the TME_LEAVE flag */
+ tracking_info.tme.dwFlags &= ~TME_LEAVE;
+ }
+ }
+ else
+ {
+ if (!(tracking_info.tme.dwFlags & TME_NONCLIENT))
+ {
+ PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
+ /* remove the TME_LEAVE flag */
+ tracking_info.tme.dwFlags &= ~TME_LEAVE;
+ }
+ }
+ }
+}
+
static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
DWORD dwTime)
{
@@ -782,37 +817,7 @@ static void CALLBACK TrackMouseEventProc
/* mouse has left the window */
if (tracking_info.tme.dwFlags & TME_LEAVE)
{
- if (tracking_info.tme.hwndTrack != hwnd)
- {
- if (tracking_info.tme.dwFlags & TME_NONCLIENT)
- PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
- else
- PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
-
- /* remove the TME_LEAVE flag */
- tracking_info.tme.dwFlags &= ~TME_LEAVE;
- }
- else
- {
- if (hittest == HTCLIENT)
- {
- if (tracking_info.tme.dwFlags & TME_NONCLIENT)
- {
- PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
- /* remove the TME_LEAVE flag */
- tracking_info.tme.dwFlags &= ~TME_LEAVE;
- }
- }
- else
- {
- if (!(tracking_info.tme.dwFlags & TME_NONCLIENT))
- {
- PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
- /* remove the TME_LEAVE flag */
- tracking_info.tme.dwFlags &= ~TME_LEAVE;
- }
- }
- }
+ check_mouse_leave(hwnd, hittest);
}
if (tracking_info.tme.hwndTrack != hwnd)
@@ -950,6 +955,12 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
}
}
} else {
+ /* In our implementation it's possible that another window will receive a
+ * WM_MOUSEMOVE and call TrackMouseEvent before TrackMouseEventProc is
+ * called. In such a situation post the WM_MOUSELEAVE now */
+ if (tracking_info.tme.dwFlags & TME_LEAVE && tracking_info.tme.hwndTrack != NULL)
+ check_mouse_leave(hwnd, hittest);
+
if (timer)
{
KillSystemTimer(tracking_info.tme.hwndTrack, timer);
More information about the wine-cvs
mailing list