user32: Update mouse tracking information based on the timer ID in DispatchMessage().

Avoid passing a callback to NtUserSetSystemTimer(); it does not support one.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-04-20 19:15:30 -05:00 committed by Alexandre Julliard
parent 95378c56b8
commit 079b0423b5
5 changed files with 18 additions and 18 deletions

View File

@ -527,7 +527,6 @@ typedef struct __TRACKINGLIST {
/* FIXME: move tracking stuff into a per thread data */ /* FIXME: move tracking stuff into a per thread data */
static _TRACKINGLIST tracking_info; static _TRACKINGLIST tracking_info;
static UINT_PTR timer;
static void check_mouse_leave(HWND hwnd, int hittest) 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, void CDECL update_mouse_tracking_info( HWND hwnd )
DWORD dwTime)
{ {
POINT pos; POINT pos;
INT hoverwidth = 0, hoverheight = 0, hittest; 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); GetCursorPos(&pos);
hwnd = WINPOS_WindowFromPoint(hwnd, pos, &hittest); 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 */ /* stop the timer if the tracking list is empty */
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE))) if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
{ {
KillSystemTimer(tracking_info.tme.hwndTrack, timer); KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
timer = 0;
tracking_info.tme.hwndTrack = 0; tracking_info.tme.hwndTrack = 0;
tracking_info.tme.dwFlags = 0; tracking_info.tme.dwFlags = 0;
tracking_info.tme.dwHoverTime = 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 we aren't tracking on hover or leave remove this entry */
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE))) if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
{ {
KillSystemTimer(tracking_info.tme.hwndTrack, timer); KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
timer = 0;
tracking_info.tme.hwndTrack = 0; tracking_info.tme.hwndTrack = 0;
tracking_info.tme.dwFlags = 0; tracking_info.tme.dwFlags = 0;
tracking_info.tme.dwHoverTime = 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) if (tracking_info.tme.dwFlags & TME_LEAVE && tracking_info.tme.hwndTrack != NULL)
check_mouse_leave(hwnd, hittest); check_mouse_leave(hwnd, hittest);
if (timer) KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE );
{ tracking_info.tme.hwndTrack = 0;
KillSystemTimer(tracking_info.tme.hwndTrack, timer); tracking_info.tme.dwFlags = 0;
timer = 0; tracking_info.tme.dwHoverTime = 0;
tracking_info.tme.hwndTrack = 0;
tracking_info.tme.dwFlags = 0;
tracking_info.tme.dwHoverTime = 0;
}
if (ptme->hwndTrack == hwnd) if (ptme->hwndTrack == hwnd)
{ {
@ -750,8 +742,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme)
/* Initialize HoverInfo variables even if not hover tracking */ /* Initialize HoverInfo variables even if not hover tracking */
tracking_info.pos = pos; tracking_info.pos = pos;
timer = NtUserSetSystemTimer( tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, NtUserSetSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE, hover_time, NULL );
hover_time, TrackMouseEventProc );
} }
} }

View File

@ -179,6 +179,7 @@ static const struct user_callbacks user_funcs =
SCROLL_SetStandardScrollPainted, SCROLL_SetStandardScrollPainted,
toggle_caret, toggle_caret,
unpack_dde_message, unpack_dde_message,
update_mouse_tracking_info,
register_imm, register_imm,
unregister_imm, unregister_imm,
}; };

View File

@ -100,6 +100,7 @@ extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN; extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN; extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
extern void CDECL toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN; extern void CDECL toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN;
extern void CDECL update_mouse_tracking_info( HWND hwnd ) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
LRESULT *result, void *arg ); LRESULT *result, void *arg );

View File

@ -2477,6 +2477,11 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi )
if (!user_callbacks) break; if (!user_callbacks) break;
user_callbacks->toggle_caret( msg->hwnd ); user_callbacks->toggle_caret( msg->hwnd );
return 0; return 0;
case SYSTEM_TIMER_TRACK_MOUSE:
if (!user_callbacks) break;
user_callbacks->update_mouse_tracking_info( msg->hwnd );
return 0;
} }
} }

View File

@ -54,6 +54,7 @@ struct user_callbacks
void (CDECL *toggle_caret)( HWND hwnd ); void (CDECL *toggle_caret)( HWND hwnd );
BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
void **buffer, size_t size ); void **buffer, size_t size );
void (CDECL *update_mouse_tracking_info)( HWND hwnd );
BOOL (WINAPI *register_imm)( HWND hwnd ); BOOL (WINAPI *register_imm)( HWND hwnd );
void (WINAPI *unregister_imm)( HWND hwnd ); void (WINAPI *unregister_imm)( HWND hwnd );
}; };
@ -63,6 +64,7 @@ struct user_callbacks
enum system_timer_id enum system_timer_id
{ {
SYSTEM_TIMER_TRACK_MOUSE = 0xfffa,
SYSTEM_TIMER_CARET = 0xffff, SYSTEM_TIMER_CARET = 0xffff,
}; };