-- v2: server: Add support for merging WM_MOUSEWHEEL messages.
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- server/queue.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/server/queue.c b/server/queue.c index 3e19d579eec..7f4bccc8bc2 100644 --- a/server/queue.c +++ b/server/queue.c @@ -799,6 +799,41 @@ static inline unsigned int get_unique_id(void) return id; }
+/* try to merge a WM_MOUSEWHEEL message with the last in the list; return 1 if successful */ +static int merge_mousewheel( struct thread_input *input, const struct message *msg ) +{ + struct message *prev; + struct list *ptr; + + for (ptr = list_tail( &input->msg_list ); ptr; ptr = list_prev( &input->msg_list, ptr )) + { + prev = LIST_ENTRY( ptr, struct message, entry ); + if (prev->msg >> 31) continue; /* ignore internal messages */ + if (prev->msg != WM_INPUT) break; + } + if (!ptr) return 0; + if (prev->result) return 0; + if (prev->win && msg->win && prev->win != msg->win) return 0; + if (prev->msg != msg->msg) return 0; + if (prev->type != msg->type) return 0; + if (prev->x != msg->x || prev->y != msg->y) return 0; + /* now we can merge it */ + prev->wparam += msg->wparam; + prev->lparam = msg->lparam; + prev->x = msg->x; + prev->y = msg->y; + prev->time = msg->time; + if (msg->type == MSG_HARDWARE && prev->data && msg->data) + { + struct hardware_msg_data *prev_data = prev->data; + struct hardware_msg_data *msg_data = msg->data; + prev_data->info = msg_data->info; + } + list_remove( ptr ); + list_add_tail( &input->msg_list, ptr ); + return 1; +} + /* try to merge a WM_MOUSEMOVE message with the last in the list; return 1 if successful */ static int merge_mousemove( struct thread_input *input, const struct message *msg ) { @@ -861,6 +896,7 @@ static int merge_unique_message( struct thread_input *input, unsigned int messag /* try to merge a message with the messages in the list; return 1 if successful */ static int merge_message( struct thread_input *input, const struct message *msg ) { + if (msg->msg == WM_MOUSEWHEEL) return merge_mousewheel( input, msg ); if (msg->msg == WM_MOUSEMOVE) return merge_mousemove( input, msg ); if (msg->msg == WM_WINE_CLIPCURSOR) return merge_unique_message( input, WM_WINE_CLIPCURSOR, msg ); if (msg->msg == WM_WINE_SETCURSOR) return merge_unique_message( input, WM_WINE_SETCURSOR, msg );
On Wed Feb 12 09:21:19 2025 +0000, Dmitry Timoshkov wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/7300/diffs?diff_id=157107&start_sha=3184a9211b3f73508407e68d601028c732b45231#bddee5ea9d993e9a0987591fc4e612261c3a87a3_2532_2531)
Thanks, I've created my own test app
[mouse_wheel.tar.xz](/uploads/efadc5046b2672424dee5512ba89a984/mouse_wheel.tar.xz)
and it shows similar behaviour under Windows 10 while XP and Windows 7 behave like described in MSDN.
Let's drop this patch then.
On Wed Feb 12 09:21:19 2025 +0000, Dmitry Timoshkov wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/7300/diffs?diff_id=157107&start_sha=3184a9211b3f73508407e68d601028c732b45231#14b74bf2d7f44f52a31e4ee1baa51371f14df769_820_821)
I've attached a test application, and with updated version of the patch I observe similar results under Wine and Windows 10. Is that good enough?
Is there anything else that could be improved?
~~The wheel delta should very likely be accumulated.~~
On Thu Feb 20 09:59:00 2025 +0000, Rémi Bernon wrote:
~~The wheel delta should very likely be accumulated.~~
Nvm, I missed that it was actually doing that. A comment to make it stand out would be welcome.
On Thu Feb 20 10:13:14 2025 +0000, Rémi Bernon wrote:
Nvm, I missed that it was actually doing that. A comment to make it stand out would be welcome.
Opened https://gitlab.winehq.org/wine/wine/-/merge_requests/7382 with some factoring and a comment.
On Thu Feb 20 10:51:28 2025 +0000, Rémi Bernon wrote:
Opened https://gitlab.winehq.org/wine/wine/-/merge_requests/7382 with some factoring and a comment.
Looks good to me. Thanks.
This merge request was closed by Dmitry Timoshkov.