From: "Anna (navi) Figueiredo Gomes" <navi@vlhl.dev> --- dlls/win32u/pointer.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/pointer.c b/dlls/win32u/pointer.c index c6e4e71c23a..8ca620d449d 100644 --- a/dlls/win32u/pointer.c +++ b/dlls/win32u/pointer.c @@ -36,6 +36,7 @@ static LONG last_frame = 0; struct pointer { UINT32 id; struct list entry; + POINTER_INPUT_TYPE type; POINTER_INFO info; }; @@ -43,7 +44,7 @@ struct pointer_thread_data { struct list known_pointers; }; -static struct pointer *allocate_pointerid(UINT32 id); +static struct pointer *allocate_pointerid(UINT32 id, POINTER_INPUT_TYPE type); static struct pointer_thread_data *get_pointer_thread_data(void) { @@ -51,12 +52,12 @@ static struct pointer_thread_data *get_pointer_thread_data(void) if (!thread_info->pointer_data && (thread_info->pointer_data = calloc( 1, sizeof(*thread_info->pointer_data) ))) { list_init( &thread_info->pointer_data->known_pointers ); - allocate_pointerid( 1 ); + allocate_pointerid( 1, PT_MOUSE ); } return thread_info->pointer_data; }; -static struct pointer *allocate_pointerid(UINT32 id) +static struct pointer *allocate_pointerid(UINT32 id, POINTER_INPUT_TYPE type) { struct pointer_thread_data *thread_data = get_pointer_thread_data(); struct pointer *pointer; @@ -66,12 +67,13 @@ static struct pointer *allocate_pointerid(UINT32 id) if (!thread_data || !(pointer = calloc( 1, sizeof(*pointer) ))) return NULL; pointer->id = id; + pointer->type = type; list_add_tail(&thread_data->known_pointers, &pointer->entry); return pointer; } -static struct pointer *find_pointerid(UINT32 id) { +static struct pointer *find_pointerid(UINT32 id, POINTER_INPUT_TYPE type) { struct pointer_thread_data *thread_data = get_pointer_thread_data(); struct pointer *pointer; @@ -81,7 +83,7 @@ static struct pointer *find_pointerid(UINT32 id) { if (pointer->id == id) return pointer; - return allocate_pointerid(id); + return allocate_pointerid(id, type); } static POINT pixel_to_himetric(POINT px) { @@ -122,6 +124,16 @@ static POINTER_INFO pointer_info_from_msg( const MSG *msg ) return info; } +static POINTER_INPUT_TYPE pointer_type_from_hw( const struct hw_msg_source *source ) +{ + switch (source->origin) { + case IMDT_PEN: return PT_PEN; + case IMDT_MOUSE: return PT_MOUSE; + case IMDT_TOUCH: + case IMDT_TOUCHPAD: return PT_TOUCH; + default: return PT_POINTER; + } +} static POINTER_BUTTON_CHANGE_TYPE compare_button(const POINTER_INFO *old, const POINTER_INFO *new) { @@ -156,7 +168,7 @@ BOOL process_pointer_message( MSG *msg, UINT hw_id, const struct hardware_msg_da POINTER_INFO info; msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt ); - if (!(pointer = find_pointerid( GET_POINTERID_WPARAM( msg->wParam ) ))) + if (!(pointer = find_pointerid( GET_POINTERID_WPARAM( msg->wParam ), pointer_type_from_hw( &msg_data->source ) ))) return TRUE; info = pointer_info_from_msg( msg ); info.ButtonChangeType = compare_button(&pointer->info, &info); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10649