[PATCH 3/6] user32: Update mouse tracking information based on the timer ID in DispatchMessage().
Zebediah Figura
zfigura at codeweavers.com
Thu Apr 14 20:14:12 CDT 2022
Avoid passing a callback to NtUserSetSystemTimer(); it does not support one.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/user32/input.c | 27 +++++++++------------------
dlls/user32/message.c | 4 ++++
dlls/user32/user_private.h | 2 ++
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 5a1d82eb7a7..fd389d77543 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -527,7 +527,6 @@ typedef struct __TRACKINGLIST {
/* FIXME: move tracking stuff into a per thread data */
static _TRACKINGLIST tracking_info;
-static UINT_PTR timer;
static void check_mouse_leave(HWND hwnd, int hittest)
{
@@ -564,13 +563,12 @@ static void check_mouse_leave(HWND hwnd, int hittest)
}
}
-static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
- DWORD dwTime)
+void update_mouse_tracking_info( HWND hwnd )
{
POINT pos;
INT hoverwidth = 0, hoverheight = 0, hittest;
- TRACE("hwnd %p, msg %04x, id %04lx, time %u\n", hwnd, uMsg, idEvent, dwTime);
+ TRACE( "hwnd %p\n", hwnd );
GetCursorPos(&pos);
hwnd = WINPOS_WindowFromPoint(hwnd, pos, &hittest);
@@ -632,8 +630,7 @@ static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
/* stop the timer if the tracking list is empty */
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
{
- KillSystemTimer(tracking_info.tme.hwndTrack, timer);
- timer = 0;
+ KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
tracking_info.tme.hwndTrack = 0;
tracking_info.tme.dwFlags = 0;
tracking_info.tme.dwHoverTime = 0;
@@ -718,8 +715,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
/* if we aren't tracking on hover or leave remove this entry */
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
{
- KillSystemTimer(tracking_info.tme.hwndTrack, timer);
- timer = 0;
+ KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
tracking_info.tme.hwndTrack = 0;
tracking_info.tme.dwFlags = 0;
tracking_info.tme.dwHoverTime = 0;
@@ -732,14 +728,10 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
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);
- timer = 0;
- tracking_info.tme.hwndTrack = 0;
- tracking_info.tme.dwFlags = 0;
- tracking_info.tme.dwHoverTime = 0;
- }
+ KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
+ tracking_info.tme.hwndTrack = 0;
+ tracking_info.tme.dwFlags = 0;
+ tracking_info.tme.dwHoverTime = 0;
if (ptme->hwndTrack == hwnd)
{
@@ -750,8 +742,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
/* Initialize HoverInfo variables even if not hover tracking */
tracking_info.pos = pos;
- timer = NtUserSetSystemTimer( tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme,
- hover_time, TrackMouseEventProc );
+ NtUserSetSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE, hover_time, NULL );
}
}
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 68f00b325c9..c9be190fbcc 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -905,6 +905,10 @@ static BOOL dispatch_systimer_message( const MSG *msg )
case SYSTEM_TIMER_CARET:
toggle_caret( msg->hwnd );
return TRUE;
+
+ case SYSTEM_TIMER_TRACK_MOUSE:
+ update_mouse_tracking_info( msg->hwnd );
+ return TRUE;
}
return FALSE;
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index bb86ed6ffca..274732bafbd 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -40,6 +40,7 @@
enum system_timer_id
{
+ SYSTEM_TIMER_TRACK_MOUSE = 0xfffa,
SYSTEM_TIMER_CARET = 0xffff,
};
@@ -105,6 +106,7 @@ extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
extern void toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN;
+extern void update_mouse_tracking_info( HWND hwnd ) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
LRESULT *result, void *arg );
--
2.35.1
More information about the wine-devel
mailing list