dotfiles/pkgs/osu-wine/patches/9989-misc-ps0171-server-Don-t-wait-for-low-level-hook-result-when-q.patch
2024-05-15 08:35:49 +07:00

61 lines
2.4 KiB
Diff

From: Piotr Caban <piotr@codeweavers.com>
Subject: [PATCH v2] server: Don't wait for low level hook result when queuing hardware message.
Message-Id: <daf382d3-924e-7c33-c876-5b8d6298c137@codeweavers.com>
Date: Tue, 21 Sep 2021 15:51:35 +0200
Without the change graphic drivers are blocking until low level hooks
are processed when injecting keyboard and mouse events. Causes 2-seconds
(timeout) freeze in GtaV.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
v2:
- don't specify sender in send_hook_ll_message to avoid queuing result
server/queue.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/server/queue.c b/server/queue.c
index e4903bcb79f..5c19348eeba 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1839,7 +1839,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
/* specify a sender only when sending the last message */
if (!(flags & ((1 << ARRAY_SIZE( messages )) - 1)))
{
- if (!(wait = send_hook_ll_message( desktop, msg, input, sender )))
+ if (origin == IMO_HARDWARE)
+ {
+ if (!send_hook_ll_message( desktop, msg, input, NULL ))
+ queue_hardware_message( desktop, msg, 0 );
+ }
+ else if (!(wait = send_hook_ll_message( desktop, msg, input, sender )))
queue_hardware_message( desktop, msg, 0 );
}
else if (!send_hook_ll_message( desktop, msg, input, NULL ))
@@ -1860,7 +1865,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
struct thread *foreground;
unsigned char vkey = input->kbd.vkey;
unsigned int message_code, time;
- int wait;
+ int wait = 0;
if (!(time = input->kbd.time)) time = get_tick_count();
@@ -1981,7 +1986,12 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
msg_data->flags |= (flags & (KF_EXTENDED | KF_ALTDOWN | KF_UP)) >> 8;
}
- if (!(wait = send_hook_ll_message( desktop, msg, input, sender )))
+ if (origin == IMO_HARDWARE)
+ {
+ if (!send_hook_ll_message( desktop, msg, input, NULL ))
+ queue_hardware_message( desktop, msg, 1 );
+ }
+ else if (!(wait = send_hook_ll_message( desktop, msg, input, sender )))
queue_hardware_message( desktop, msg, 1 );
return wait;