user32-rawinput-*: Updates from Rémi Bernon.

This commit is contained in:
Zebediah Figura 2021-05-22 01:30:39 -05:00
parent 5378adafaa
commit a71e4cdf85
20 changed files with 540 additions and 528 deletions

View File

@ -232,6 +232,9 @@ patch_enable_all ()
enable_user32_ScrollWindowEx="$1"
enable_user32_message_order="$1"
enable_user32_msgbox_Support_WM_COPY_mesg="$1"
enable_user32_rawinput_hid="$1"
enable_user32_rawinput_mouse="$1"
enable_user32_rawinput_mouse_experimental="$1"
enable_user32_recursive_activation="$1"
enable_uxtheme_CloseThemeClass="$1"
enable_version_VerQueryValue="$1"
@ -740,6 +743,15 @@ patch_enable ()
user32-msgbox-Support-WM_COPY-mesg)
enable_user32_msgbox_Support_WM_COPY_mesg="$2"
;;
user32-rawinput-hid)
enable_user32_rawinput_hid="$2"
;;
user32-rawinput-mouse)
enable_user32_rawinput_mouse="$2"
;;
user32-rawinput-mouse-experimental)
enable_user32_rawinput_mouse_experimental="$2"
;;
user32-recursive-activation)
enable_user32_recursive_activation="$2"
;;
@ -1264,6 +1276,27 @@ if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then
enable_wined3d_SWVP_shaders=1
fi
if test "$enable_user32_rawinput_mouse_experimental" -eq 1; then
if test "$enable_user32_rawinput_mouse" -gt 1; then
abort "Patchset user32-rawinput-mouse disabled, but user32-rawinput-mouse-experimental depends on that."
fi
enable_user32_rawinput_mouse=1
fi
if test "$enable_user32_rawinput_mouse" -eq 1; then
if test "$enable_user32_rawinput_hid" -gt 1; then
abort "Patchset user32-rawinput-hid disabled, but user32-rawinput-mouse depends on that."
fi
enable_user32_rawinput_hid=1
fi
if test "$enable_user32_rawinput_hid" -eq 1; then
if test "$enable_loader_KeyboardLayouts" -gt 1; then
abort "Patchset loader-KeyboardLayouts disabled, but user32-rawinput-hid depends on that."
fi
enable_loader_KeyboardLayouts=1
fi
if test "$enable_stdole32_tlb_SLTG_Typelib" -eq 1; then
if test "$enable_widl_SLTG_Typelib_Support" -gt 1; then
abort "Patchset widl-SLTG_Typelib_Support disabled, but stdole32.tlb-SLTG_Typelib depends on that."
@ -3571,6 +3604,70 @@ if test "$enable_user32_msgbox_Support_WM_COPY_mesg" -eq 1; then
patch_apply user32-msgbox-Support-WM_COPY-mesg/0002-user32-msgbox-Use-a-windows-hook-to-trap-Ctrl-C.patch
fi
# Patchset user32-rawinput-hid
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * loader-KeyboardLayouts
# |
# | This patchset fixes the following Wine bugs:
# | * [#50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices
# |
# | Modified files:
# | * dlls/user32/message.c, dlls/user32/rawinput.c, dlls/user32/user_private.h, server/protocol.def, server/queue.c,
# | server/trace.c, tools/make_requests
# |
if test "$enable_user32_rawinput_hid" -eq 1; then
patch_apply user32-rawinput-hid/0001-server-Add-extra-data-bytes-to-be-added-after-hardwa.patch
patch_apply user32-rawinput-hid/0002-server-Add-HID-reports-count-length-to-rawinput-unio.patch
patch_apply user32-rawinput-hid/0003-server-Add-HID-reports-support-in-GetRawInputBuffer.patch
patch_apply user32-rawinput-hid/0004-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch
fi
# Patchset user32-rawinput-mouse
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * loader-KeyboardLayouts, user32-rawinput-hid
# |
# | This patchset fixes the following Wine bugs:
# | * [#42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in
# | Unity games, have walkaround in Fallout4 )
# | * [#42675] Overwatch: Phantom mouse input / view pulled up to ceiling
# |
# | Modified files:
# | * dlls/user32/input.c, dlls/user32/message.c, dlls/wineandroid.drv/keyboard.c, dlls/wineandroid.drv/window.c,
# | dlls/winemac.drv/ime.c, dlls/winemac.drv/keyboard.c, dlls/winemac.drv/mouse.c, dlls/winex11.drv/desktop.c,
# | dlls/winex11.drv/event.c, dlls/winex11.drv/keyboard.c, dlls/winex11.drv/mouse.c, dlls/winex11.drv/window.c,
# | dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, server/protocol.def, server/queue.c
# |
if test "$enable_user32_rawinput_mouse" -eq 1; then
patch_apply user32-rawinput-mouse/0001-winex11.drv-Split-XInput2-thread-initialization.patch
patch_apply user32-rawinput-mouse/0002-winex11.drv-Support-XInput2-events-for-individual-wi.patch
patch_apply user32-rawinput-mouse/0003-winex11.drv-Advertise-XInput2-version-2.1-support.patch
patch_apply user32-rawinput-mouse/0004-winex11.drv-Keep-track-of-pointer-and-device-button-.patch
patch_apply user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch
patch_apply user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch
patch_apply user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch
patch_apply user32-rawinput-mouse/0008-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch
fi
# Patchset user32-rawinput-mouse-experimental
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * loader-KeyboardLayouts, user32-rawinput-hid, user32-rawinput-mouse
# |
# | This patchset fixes the following Wine bugs:
# | * [#45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games).
# |
# | Modified files:
# | * dlls/user32/rawinput.c, dlls/winex11.drv/mouse.c, dlls/winex11.drv/window.c, dlls/winex11.drv/x11drv.h,
# | dlls/winex11.drv/x11drv_main.c, server/queue.c
# |
if test "$enable_user32_rawinput_mouse_experimental" -eq 1; then
patch_apply user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch
patch_apply user32-rawinput-mouse-experimental/0002-winex11.drv-Send-relative-RawMotion-events-unprocess.patch
patch_apply user32-rawinput-mouse-experimental/0003-winex11.drv-Accumulate-mouse-movement-to-avoid-round.patch
fi
# Patchset user32-recursive-activation
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,18 +1,19 @@
From 9b9134b94879a1e501d0337cdf6f607ebe2ff84f Mon Sep 17 00:00:00 2001
From c9e0eb6e9625d7d8dc31a208c5bbff25e5eff4d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 23 Mar 2021 10:11:07 +0100
Subject: [PATCH] server: Add extra data to hardware_msg_data.
Subject: [PATCH] server: Add extra data bytes to be added after
hardware_msg_data.
The RIM_TYPEHID messages will have to carry the variable length HID
report.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
server/queue.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
server/queue.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/server/queue.c b/server/queue.c
index 9fe009b5cfe..248157ca7da 100644
index 5d65e030112..c43386ee317 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -348,13 +348,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
@ -52,7 +53,7 @@ index 9fe009b5cfe..248157ca7da 100644
msg->msg = WM_MOUSEMOVE;
msg->x = x;
@@ -1710,6 +1710,8 @@ struct rawinput_message
@@ -1664,6 +1664,8 @@ struct rawinput_message
unsigned int time;
unsigned int message;
struct hardware_msg_data data;
@ -61,36 +62,24 @@ index 9fe009b5cfe..248157ca7da 100644
};
/* check if process is supposed to receive a WM_INPUT message and eventually queue it */
@@ -1721,6 +1723,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
struct desktop *target_desktop = NULL, *desktop = NULL;
struct thread *target_thread = NULL, *foreground = NULL;
struct message *msg;
+ struct hardware_msg_data *msg_data;
int wparam = RIM_INPUT;
if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE)
@@ -1748,14 +1751,18 @@ static int queue_rawinput_message( struct process* process, void *arg )
@@ -1702,7 +1704,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
wparam = RIM_INPUTSINK;
}
- if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time )))
+ if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time, raw_msg->extra_len )))
goto done;
+ msg_data = msg->data;
msg->win = device->target;
msg->msg = raw_msg->message;
@@ -1710,6 +1712,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
msg->wparam = wparam;
msg->lparam = 0;
- memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
+
+ memcpy( msg_data, &raw_msg->data, sizeof(*msg_data) );
+ if (raw_msg->extra_len && raw_msg->extra)
+ memcpy( msg_data + 1, raw_msg->extra, raw_msg->extra_len );
memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
+ if (raw_msg->extra) memcpy( (struct hardware_msg_data *)msg->data + 1, raw_msg->extra, raw_msg->extra_len );
if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && raw_msg->data.rawinput.type == RIM_TYPEHID)
{
@@ -1837,6 +1844,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
@@ -1791,6 +1794,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
raw_msg.source = source;
raw_msg.time = time;
raw_msg.message = WM_INPUT;
@ -99,7 +88,7 @@ index 9fe009b5cfe..248157ca7da 100644
msg_data = &raw_msg.data;
msg_data->info = input->mouse.info;
@@ -1862,7 +1871,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
@@ -1816,7 +1821,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
if (!(flags & (1 << i))) continue;
flags &= ~(1 << i);
@ -108,7 +97,7 @@ index 9fe009b5cfe..248157ca7da 100644
msg_data = msg->data;
msg->win = get_user_full_handle( win );
@@ -1972,6 +1981,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
@@ -1926,6 +1931,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
raw_msg.source = source;
raw_msg.time = time;
raw_msg.message = WM_INPUT;
@ -117,7 +106,7 @@ index 9fe009b5cfe..248157ca7da 100644
msg_data = &raw_msg.data;
msg_data->info = input->kbd.info;
@@ -1991,7 +2002,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
@@ -1945,7 +1952,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
return 0;
}
@ -126,7 +115,7 @@ index 9fe009b5cfe..248157ca7da 100644
msg_data = msg->data;
msg->win = get_user_full_handle( win );
@@ -2039,6 +2050,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
@@ -1993,6 +2000,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
raw_msg.source = source;
raw_msg.time = get_tick_count();
raw_msg.message = input->hw.msg;
@ -135,10 +124,10 @@ index 9fe009b5cfe..248157ca7da 100644
msg_data = &raw_msg.data;
msg_data->info = 0;
@@ -2060,7 +2073,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
@@ -2005,7 +2014,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
return;
}
if (!desktop) return;
- if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
+ if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return;

View File

@ -0,0 +1,111 @@
From c88f4c3f0b2ae90b8357419fe8f90a59c8982a3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 14 May 2021 22:05:06 +0200
Subject: [PATCH] server: Add HID reports count / length to rawinput union.
And send HID reports data in send_hardware_message request, then append
the reports after hardware_msg_data.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/user32/message.c | 4 +++-
server/protocol.def | 3 +++
server/queue.c | 11 +++++++++--
server/trace.c | 4 ++--
tools/make_requests | 2 +-
5 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 9af33c3291e..71d0be8913e 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3288,11 +3288,13 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
switch (rawinput->header.dwType)
{
case RIM_TYPEHID:
- assert( rawinput->data.hid.dwCount <= 1 );
req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice );
req->input.hw.rawinput.hid.param = rawinput->header.wParam;
req->input.hw.rawinput.hid.usage_page = hid_usage_page;
req->input.hw.rawinput.hid.usage = hid_usage;
+ req->input.hw.rawinput.hid.count = rawinput->data.hid.dwCount;
+ req->input.hw.rawinput.hid.length = rawinput->data.hid.dwSizeHid;
+ wine_server_add_data( req, rawinput->data.hid.bRawData, rawinput->data.hid.dwCount * rawinput->data.hid.dwSizeHid );
break;
default:
assert( 0 );
diff --git a/server/protocol.def b/server/protocol.def
index 4239be834d1..eb15cef6fdb 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -302,6 +302,8 @@ union rawinput
unsigned int param; /* rawinput message param */
unsigned short usage_page;/* HID usage page */
unsigned short usage; /* HID usage */
+ unsigned int count; /* HID report count */
+ unsigned int length; /* HID report length */
} hid;
};
@@ -2032,6 +2034,7 @@ enum message_type
user_handle_t win; /* window handle */
hw_input_t input; /* input data */
unsigned int flags; /* flags (see below) */
+ VARARG(report,bytes); /* HID report data */
@REPLY
int wait; /* do we need to wait for a reply? */
int prev_x; /* previous cursor position */
diff --git a/server/queue.c b/server/queue.c
index c43386ee317..4f1695c92cc 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2000,8 +2000,15 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
raw_msg.source = source;
raw_msg.time = get_tick_count();
raw_msg.message = input->hw.msg;
- raw_msg.extra = NULL;
- raw_msg.extra_len = 0;
+ raw_msg.extra = get_req_data();
+ raw_msg.extra_len = get_req_data_size();
+
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
+ raw_msg.extra_len != input->hw.rawinput.hid.length * input->hw.rawinput.hid.count)
+ {
+ set_error( STATUS_INVALID_PARAMETER );
+ return;
+ }
msg_data = &raw_msg.data;
msg_data->info = 0;
diff --git a/server/trace.c b/server/trace.c
index 6b5946c2bcf..3b6c8387149 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -408,9 +408,9 @@ static void dump_rawinput( const char *prefix, const union rawinput *rawinput )
rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan );
break;
case RIM_TYPEHID:
- fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx}",
+ fprintf( stderr, "%s{type=HID,device=%04x,param=%04x,page=%04hx,usage=%04hx,count=%u,length=%u}",
prefix, rawinput->hid.device, rawinput->hid.param, rawinput->hid.usage_page,
- rawinput->hid.usage );
+ rawinput->hid.usage, rawinput->hid.count, rawinput->hid.length );
break;
default:
fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type );
diff --git a/tools/make_requests b/tools/make_requests
index a70b29df3d2..1c4e5977c8b 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -52,7 +52,7 @@ my %formats =
"luid_t" => [ 8, 4, "&dump_luid" ],
"generic_map_t" => [ 16, 4, "&dump_generic_map" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
- "hw_input_t" => [ 32, 8, "&dump_hw_input" ],
+ "hw_input_t" => [ 40, 8, "&dump_hw_input" ],
);
my @requests = ();
--
2.30.2

View File

@ -0,0 +1,115 @@
From 508f296e7ae9804a34438fd0d03eafcdb1c888f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 14 May 2021 22:05:06 +0200
Subject: [PATCH] server: Add HID reports support in GetRawInputBuffer.
Returned by get_rawinput_buffer request after each hardware_msg_data.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/user32/rawinput.c | 28 +++++++++++++++++++++++++---
server/queue.c | 11 ++++++-----
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index e4e7bad508f..716047b4599 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -280,6 +280,8 @@ struct rawinput_thread_data *rawinput_thread_data(void)
BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data)
{
+ SIZE_T size;
+
rawinput->header.dwType = msg_data->rawinput.type;
if (msg_data->rawinput.type == RIM_TYPEMOUSE)
{
@@ -371,6 +373,23 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
rawinput->data.keyboard.ExtraInformation = msg_data->info;
}
+ else if (msg_data->rawinput.type == RIM_TYPEHID)
+ {
+ size = msg_data->rawinput.hid.count * msg_data->rawinput.hid.length;
+ if (size > RAWINPUT_BUFFER_SIZE - sizeof(*rawinput))
+ {
+ ERR( "Dropping unexpectedly large HID hardware message.\n" );
+ return FALSE;
+ }
+
+ rawinput->header.dwSize = FIELD_OFFSET( RAWINPUT, data.hid.bRawData ) + size;
+ rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device );
+ rawinput->header.wParam = 0;
+
+ rawinput->data.hid.dwCount = msg_data->rawinput.hid.count;
+ rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length;
+ memcpy( rawinput->data.hid.bRawData, msg_data + 1, size );
+ }
else
{
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
@@ -564,7 +583,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
struct hardware_msg_data *msg_data;
struct rawinput_thread_data *thread_data;
RAWINPUT *rawinput;
- UINT count = 0, rawinput_size, next_size, overhead;
+ UINT count = 0, rawinput_size, msg_size, next_size, overhead;
BOOL is_wow64;
int i;
@@ -619,12 +638,15 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
for (i = 0; i < count; ++i)
{
- rawinput_from_hardware_message(data, msg_data);
+ if (!rawinput_from_hardware_message(data, msg_data)) break;
if (overhead) memmove((char *)&data->data + overhead, &data->data,
data->header.dwSize - sizeof(RAWINPUTHEADER));
data->header.dwSize += overhead;
data = NEXTRAWINPUTBLOCK(data);
- msg_data++;
+ msg_size = sizeof(*msg_data);
+ if (msg_data->rawinput.type == RIM_TYPEHID)
+ msg_size += msg_data->rawinput.hid.count * msg_data->rawinput.hid.length;
+ msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_size);
}
if (count == 0 && next_size == 0) *data_size = 0;
diff --git a/server/queue.c b/server/queue.c
index 4f1695c92cc..ebbe4049ae8 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -3311,16 +3311,17 @@ DECL_HANDLER(get_rawinput_buffer)
{
struct message *msg = LIST_ENTRY( ptr, struct message, entry );
struct hardware_msg_data *data = msg->data;
+ data_size_t hid_size = data->rawinput.type != RIM_TYPEHID ? 0 : msg->data_size - sizeof(*data);
ptr = list_next( &input->msg_list, ptr );
if (msg->msg != WM_INPUT) continue;
- next_size = req->rawinput_size;
+ next_size = req->rawinput_size + hid_size;
if (size + next_size > req->buffer_size) break;
- if (cur + sizeof(*data) > buf + get_reply_max_size()) break;
- if (cur + sizeof(*data) > buf + buf_size)
+ if (cur + msg->data_size > buf + get_reply_max_size()) break;
+ if (cur + msg->data_size > buf + buf_size)
{
- buf_size += buf_size / 2;
+ buf_size += buf_size / 2 + hid_size;
if (!(tmp = realloc( buf, buf_size )))
{
set_error( STATUS_NO_MEMORY );
@@ -3330,7 +3331,7 @@ DECL_HANDLER(get_rawinput_buffer)
buf = tmp;
}
- memcpy(cur, data, sizeof(*data));
+ memcpy( cur, data, msg->data_size );
list_remove( &msg->entry );
free_message( msg );
--
2.30.2

View File

@ -0,0 +1,117 @@
From efdc9faae44a7b2a60ab3d383f83c573a65b1c2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 16 Apr 2021 12:54:16 +0200
Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
The messages are of variable size and carry the corresponding HID report
data after each RAWINPUT struct.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/user32/message.c | 9 +++++++++
dlls/user32/rawinput.c | 15 +++++++++++++++
dlls/user32/user_private.h | 2 ++
server/queue.c | 1 +
server/trace.c | 1 +
5 files changed, 28 insertions(+)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 71d0be8913e..a80fb8c57ea 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3254,6 +3254,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0];
hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1];
}
+ if (input->u.hi.uMsg == WM_INPUT)
+ {
+ if (!rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage ))
+ {
+ WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice );
+ return STATUS_INVALID_HANDLE;
+ }
+ }
}
SERVER_START_REQ( send_hardware_message )
@@ -3283,6 +3291,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
switch (input->u.hi.uMsg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
req->input.hw.rawinput.type = rawinput->header.dwType;
switch (rawinput->header.dwType)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 716047b4599..103f2bb8a55 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -267,6 +267,21 @@ static struct device *find_device_from_handle(HANDLE handle)
}
+BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage)
+{
+ struct device *device;
+
+ *usage_page = *usage = 0;
+
+ if (!(device = find_device_from_handle(handle))) return FALSE;
+ if (device->info.dwType != RIM_TYPEHID) return FALSE;
+
+ *usage_page = device->info.u.hid.usUsagePage;
+ *usage = device->info.u.hid.usUsage;
+ return TRUE;
+}
+
+
struct rawinput_thread_data *rawinput_thread_data(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index cb780f0c963..0838ba28b32 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -28,6 +28,7 @@
#include "winuser.h"
#include "winreg.h"
#include "winternl.h"
+#include "hidusage.h"
#include "wine/heap.h"
#define GET_WORD(ptr) (*(const WORD *)(ptr))
@@ -239,6 +240,7 @@ struct tagWND;
struct hardware_msg_data;
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
+extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
extern struct rawinput_thread_data *rawinput_thread_data(void);
extern void keyboard_init(void) DECLSPEC_HIDDEN;
diff --git a/server/queue.c b/server/queue.c
index ebbe4049ae8..3e6050686ae 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1994,6 +1994,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
raw_msg.foreground = NULL;
raw_msg.desktop = NULL;
diff --git a/server/trace.c b/server/trace.c
index 3b6c8387149..d84f4c9543a 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
dump_uint64( ",lparam=", &input->hw.lparam );
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
dump_rawinput( ",rawinput=", &input->hw.rawinput );
}
--
2.30.2

View File

@ -1,83 +0,0 @@
From df872d2e07d188439a3fbe938a2d9c53c6e3d3a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 7 Apr 2021 12:17:09 +0200
Subject: [PATCH] server: Track known HID rawinput devices on addition and
removal.
To track their usage page and usage bytes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
server/queue.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/server/queue.c b/server/queue.c
index ca2f898492b..becfb8b94c6 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1656,6 +1656,42 @@ static struct thread *get_foreground_thread( struct desktop *desktop, user_handl
return NULL;
}
+static struct rawinput_device *hid_rawinput_devices;
+static unsigned int hid_rawinput_device_count;
+
+static void insert_hid_rawinput_device( unsigned int index, const char *data, unsigned int data_len )
+{
+ unsigned int new_count;
+
+ if (data_len < 2) return;
+
+ if (!hid_rawinput_device_count)
+ {
+ hid_rawinput_device_count = 64;
+ while (hid_rawinput_device_count < index) hid_rawinput_device_count *= 2;
+ hid_rawinput_devices = mem_alloc( hid_rawinput_device_count * sizeof(*hid_rawinput_devices) );
+ memset( hid_rawinput_devices, 0, hid_rawinput_device_count * sizeof(*hid_rawinput_devices) );
+ }
+ else if (hid_rawinput_device_count < index)
+ {
+ new_count = hid_rawinput_device_count;
+ while (new_count < index) new_count *= 2;
+ hid_rawinput_devices = realloc( hid_rawinput_devices, new_count * sizeof(*hid_rawinput_devices) );
+ memset( hid_rawinput_devices + hid_rawinput_device_count, 0, (new_count - hid_rawinput_device_count) * sizeof(*hid_rawinput_devices) );
+ hid_rawinput_device_count = new_count;
+ }
+
+ hid_rawinput_devices[index].usage_page = data[0];
+ hid_rawinput_devices[index].usage = data[1];
+}
+
+static void remove_hid_rawinput_device( unsigned int index )
+{
+ if (hid_rawinput_device_count < index) return;
+ hid_rawinput_devices[index].usage_page = 0;
+ hid_rawinput_devices[index].usage = 0;
+}
+
struct rawinput_message
{
struct thread *foreground;
@@ -1969,6 +2005,19 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
struct hw_msg_source source = { IMDT_UNAVAILABLE, origin };
struct message *msg;
+ switch (input->hw.msg)
+ {
+ case WM_INPUT_DEVICE_CHANGE:
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
+ input->hw.rawinput.hid.param == GIDC_ARRIVAL)
+ insert_hid_rawinput_device( input->hw.rawinput.hid.device, get_req_data(), get_req_data_size() );
+
+ if (input->hw.rawinput.type == RIM_TYPEHID &&
+ input->hw.rawinput.hid.param == GIDC_REMOVAL)
+ remove_hid_rawinput_device( input->hw.rawinput.hid.device );
+ return;
+ }
+
if (!desktop) return;
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
--
2.30.2

View File

@ -1,73 +0,0 @@
From 478c213d97d8894d734d8f711f6d4c75d9ea84fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 5 Mar 2021 10:41:20 +0100
Subject: [PATCH] hidclass.sys: Send rawinput messages with HID report.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/hidclass.sys/device.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index ec34b6b8068..887d7212c89 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -171,6 +171,39 @@ static NTSTATUS copy_packet_into_buffer(HID_XFER_PACKET *packet, BYTE* buffer, U
return STATUS_BUFFER_OVERFLOW;
}
+static void HID_Device_sendRawInput(DEVICE_OBJECT *device, HID_XFER_PACKET *packet)
+{
+ BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
+ RAWINPUT *rawinput;
+ UCHAR *report, id;
+ ULONG data_size;
+ INPUT input;
+
+ data_size = offsetof(RAWINPUT, data.hid.bRawData) + packet->reportBufferLen;
+ if (!(id = ext->u.pdo.preparsed_data->reports[0].reportID)) data_size += 1;
+
+ rawinput = HeapAlloc(GetProcessHeap(), 0, data_size);
+
+ rawinput->header.dwType = RIM_TYPEHID;
+ rawinput->header.dwSize = data_size;
+ rawinput->header.hDevice = ULongToHandle(ext->u.pdo.rawinput_handle);
+ rawinput->header.wParam = RIM_INPUT;
+ rawinput->data.hid.dwCount = 1;
+ rawinput->data.hid.dwSizeHid = data_size - offsetof(RAWINPUT, data.hid.bRawData);
+
+ report = rawinput->data.hid.bRawData;
+ if (!id) *report++ = 0;
+ memcpy(report, packet->reportBuffer, packet->reportBufferLen);
+
+ input.type = INPUT_HARDWARE;
+ input.u.hi.uMsg = WM_INPUT;
+ input.u.hi.wParamH = (WORD)(rawinput->header.dwSize >> 16);
+ input.u.hi.wParamL = (WORD)(rawinput->header.dwSize >> 0);
+ __wine_send_input(0, &input, rawinput);
+
+ HeapFree(GetProcessHeap(), 0, rawinput);
+}
+
static void HID_Device_processQueue(DEVICE_OBJECT *device)
{
IRP *irp;
@@ -242,6 +275,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
if (irp_status.u.Status == STATUS_SUCCESS)
{
RingBuffer_Write(ext->u.pdo.ring_buffer, packet);
+ HID_Device_sendRawInput(device, packet);
HID_Device_processQueue(device);
}
@@ -282,6 +316,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
else
packet->reportId = 0;
RingBuffer_Write(ext->u.pdo.ring_buffer, packet);
+ HID_Device_sendRawInput(device, packet);
HID_Device_processQueue(device);
}
--
2.30.2

View File

@ -1,163 +0,0 @@
From 018a5cdacc44e5ff883a1d4f62705bf466d8d62c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 23 Mar 2021 10:42:07 +0100
Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
The messages are of variable size and carry the corresponding HID report
data after each RAWINPUT struct.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/user32/message.c | 1 +
dlls/user32/rawinput.c | 22 ++++++++++++++++++++--
server/queue.c | 25 ++++++++++++++++++-------
server/trace.c | 1 +
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 9af33c3291e..e21ebf9d4d8 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3283,6 +3283,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
switch (input->u.hi.uMsg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
req->input.hw.rawinput.type = rawinput->header.dwType;
switch (rawinput->header.dwType)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index d95d29d7656..f28bde339eb 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -371,6 +371,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
rawinput->data.keyboard.ExtraInformation = msg_data->info;
}
+ else if (msg_data->rawinput.type == RIM_TYPEHID)
+ {
+ if (sizeof(*rawinput) + msg_data->rawinput.hid.length > RAWINPUT_BUFFER_SIZE)
+ {
+ ERR( "unexpectedly large hardware message dropped\n" );
+ return FALSE;
+ }
+
+ rawinput->header.dwSize = FIELD_OFFSET( RAWINPUT, data.hid.bRawData ) + msg_data->rawinput.hid.length;
+ rawinput->header.hDevice = ULongToHandle( msg_data->rawinput.hid.device );
+ rawinput->header.wParam = 0;
+
+ rawinput->data.hid.dwSizeHid = msg_data->rawinput.hid.length;
+ rawinput->data.hid.dwCount = 1;
+ memcpy( rawinput->data.hid.bRawData, msg_data + 1, msg_data->rawinput.hid.length );
+ }
else
{
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
@@ -564,7 +580,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
struct hardware_msg_data *msg_data;
struct rawinput_thread_data *thread_data;
RAWINPUT *rawinput;
- UINT count = 0, rawinput_size, next_size, overhead;
+ UINT count = 0, rawinput_size, msg_size, next_size, overhead;
BOOL is_wow64;
int i;
@@ -624,7 +640,9 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
data->header.dwSize - sizeof(RAWINPUTHEADER));
data->header.dwSize += overhead;
data = NEXTRAWINPUTBLOCK(data);
- msg_data++;
+ msg_size = sizeof(*msg_data);
+ if (msg_data->rawinput.type == RIM_TYPEHID) msg_size += msg_data->rawinput.hid.length;
+ msg_data = (struct hardware_msg_data *)((char *)msg_data + msg_size);
}
if (count == 0 && next_size == 0) *data_size = 0;
diff --git a/server/queue.c b/server/queue.c
index 55bcded3aff..52627015584 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2044,6 +2044,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
raw_msg.foreground = get_foreground_thread( desktop, win );
raw_msg.desktop = desktop;
@@ -2053,18 +2054,26 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
raw_msg.extra = NULL;
raw_msg.extra_len = 0;
+ if (input->hw.msg == WM_INPUT)
+ {
+ raw_msg.extra = get_req_data();
+ raw_msg.extra_len = get_req_data_size();
+ }
+
msg_data = &raw_msg.data;
msg_data->info = 0;
msg_data->flags = 0;
msg_data->rawinput = input->hw.rawinput;
- if (input->hw.rawinput.type == RIM_TYPEHID &&
+ if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
+ input->hw.rawinput.type == RIM_TYPEHID &&
input->hw.rawinput.hid.param == GIDC_ARRIVAL)
insert_hid_rawinput_device( input->hw.rawinput.hid.device, get_req_data(), get_req_data_size() );
enum_processes( queue_rawinput_message, &raw_msg );
- if (input->hw.rawinput.type == RIM_TYPEHID &&
+ if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
+ input->hw.rawinput.type == RIM_TYPEHID &&
input->hw.rawinput.hid.param == GIDC_REMOVAL)
remove_hid_rawinput_device( input->hw.rawinput.hid.device );
@@ -3371,16 +3380,18 @@ DECL_HANDLER(get_rawinput_buffer)
{
struct message *msg = LIST_ENTRY( ptr, struct message, entry );
struct hardware_msg_data *data = msg->data;
+ data_size_t hid_size = data->rawinput.type != RIM_TYPEHID ? 0 : data->rawinput.hid.length;
+ data_size_t data_size = sizeof(*data) + hid_size;
ptr = list_next( &input->msg_list, ptr );
if (msg->msg != WM_INPUT) continue;
- next_size = req->rawinput_size;
+ next_size = req->rawinput_size + hid_size;
if (size + next_size > req->buffer_size) break;
- if (cur + sizeof(*data) > buf + get_reply_max_size()) break;
- if (cur + sizeof(*data) > buf + buf_size)
+ if (cur + data_size > buf + get_reply_max_size()) break;
+ if (cur + data_size > buf + buf_size)
{
- buf_size += buf_size / 2;
+ buf_size += buf_size / 2 + hid_size;
if (!(tmp = realloc( buf, buf_size )))
{
set_error( STATUS_NO_MEMORY );
@@ -3390,7 +3401,7 @@ DECL_HANDLER(get_rawinput_buffer)
buf = tmp;
}
- memcpy(cur, data, sizeof(*data));
+ memcpy( cur, data, data_size );
list_remove( &msg->entry );
free_message( msg );
diff --git a/server/trace.c b/server/trace.c
index e40f0769a35..1fd32c8ab5f 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
dump_uint64( ",lparam=", &input->hw.lparam );
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
dump_rawinput( ",rawinput=", &input->hw.rawinput );
}
--
2.30.2

View File

@ -1,86 +0,0 @@
From 40f1c71a5b47e21741a5b8f33e98eea0c5e2d9f6 Mon Sep 17 00:00:00 2001
From: Arkadiusz Hiler <ahiler@codeweavers.com>
Date: Mon, 22 Feb 2021 15:41:46 +0200
Subject: [PATCH] user32: Enumerate mouse rawinput device before HID devices.
---
dlls/user32/rawinput.c | 56 ++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 9ca00504e5c..b05761cb326 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -169,33 +169,7 @@ static void find_devices(void)
}
rawinput_devices_count = 0;
- set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-
- for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
- {
- if (!(device = add_device(set, &iface)))
- continue;
-
- attr.Size = sizeof(HIDD_ATTRIBUTES);
- if (!HidD_GetAttributes(device->file, &attr))
- WARN("Failed to get attributes.\n");
-
- device->info.dwType = RIM_TYPEHID;
- device->info.u.hid.dwVendorId = attr.VendorID;
- device->info.u.hid.dwProductId = attr.ProductID;
- device->info.u.hid.dwVersionNumber = attr.VersionNumber;
-
- if (!HidD_GetPreparsedData(device->file, &device->data))
- WARN("Failed to get preparsed data.\n");
-
- if (!HidP_GetCaps(device->data, &caps))
- WARN("Failed to get caps.\n");
-
- device->info.u.hid.usUsagePage = caps.UsagePage;
- device->info.u.hid.usUsage = caps.Usage;
- }
-
- SetupDiDestroyDeviceInfoList(set);
+ /* add mice and keyboards first so we won't add the duplicated HID devices */
set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MOUSE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
@@ -227,6 +201,34 @@ static void find_devices(void)
SetupDiDestroyDeviceInfoList(set);
+ set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
+
+ for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx)
+ {
+ if (!(device = add_device(set, &iface)))
+ continue;
+
+ attr.Size = sizeof(HIDD_ATTRIBUTES);
+ if (!HidD_GetAttributes(device->file, &attr))
+ WARN("Failed to get attributes.\n");
+
+ device->info.dwType = RIM_TYPEHID;
+ device->info.u.hid.dwVendorId = attr.VendorID;
+ device->info.u.hid.dwProductId = attr.ProductID;
+ device->info.u.hid.dwVersionNumber = attr.VersionNumber;
+
+ if (!HidD_GetPreparsedData(device->file, &device->data))
+ WARN("Failed to get preparsed data.\n");
+
+ if (!HidP_GetCaps(device->data, &caps))
+ WARN("Failed to get caps.\n");
+
+ device->info.u.hid.usUsagePage = caps.UsagePage;
+ device->info.u.hid.usUsage = caps.Usage;
+ }
+
+ SetupDiDestroyDeviceInfoList(set);
+
LeaveCriticalSection(&rawinput_devices_cs);
}
--
2.30.2

View File

@ -1,4 +1,2 @@
Fixes: [50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices
Depends: loader-KeyboardLayouts
# In the process of upstreaming.
Disabled: true

View File

@ -1,4 +1,2 @@
Fixes: [45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games).
Depends: user32-rawinput-mouse
# In the process of upstreaming.
Disabled: true

View File

@ -1,4 +1,4 @@
From 8016a35cf5771858b2b6245ee22e60c23a1bafd6 Mon Sep 17 00:00:00 2001
From be00910ebbb1277a5e34e982450a20821757fa25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 17 Jan 2020 16:33:11 +0100
Subject: [PATCH] winex11.drv: Split XInput2 thread initialization.
@ -93,7 +93,7 @@ index 42bac332664..ce77c7e5985 100644
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
int event, error;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 45855976607..16a8a6be2be 100644
index c23cd512eb9..a46d9ef430c 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -195,7 +195,8 @@ extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 7158d919b04dc9229064370be73e3bc01fb3f782 Mon Sep 17 00:00:00 2001
From 1d33d9f94c680dc433394fc525d6ab238914006e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 23 Jan 2020 11:00:19 +0100
Subject: [PATCH] winex11.drv: Support XInput2 events for individual windows.
@ -26,7 +26,7 @@ index b517e44e150..6f46ef505c9 100644
X11DRV_init_desktop( win, width, height );
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 9de7ffa3f3c..14770d3364a 100644
index 1772a27c48b..bc007bea1d6 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -245,6 +245,13 @@ static Bool filter_event( Display *display, XEvent *event, char *arg )
@ -185,7 +185,7 @@ index ce77c7e5985..2550af3cb9c 100644
}
else if (prev_clip_hwnd)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index cfac86c224d..b2c5f4016fe 100644
index 386f21c85d4..0ab5b5b8952 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -375,6 +375,7 @@ static void sync_window_style( struct x11drv_win_data *data )
@ -213,7 +213,7 @@ index cfac86c224d..b2c5f4016fe 100644
SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window );
X11DRV_InitClipboard();
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 6f254368ab7..b014fd6ae11 100644
index a46d9ef430c..8c4a46c07c2 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -197,6 +197,8 @@ extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
@ -225,7 +225,7 @@ index 6f254368ab7..b014fd6ae11 100644
extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image,
const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits,
@@ -325,6 +327,14 @@ struct x11drv_valuator_data
@@ -324,6 +326,14 @@ struct x11drv_valuator_data
int number;
};
@ -240,7 +240,7 @@ index 6f254368ab7..b014fd6ae11 100644
struct x11drv_thread_data
{
Display *display;
@@ -340,7 +350,7 @@ struct x11drv_thread_data
@@ -338,7 +348,7 @@ struct x11drv_thread_data
Window clip_window; /* window used for cursor clipping */
HWND clip_hwnd; /* message window stored in desktop while clipping is active */
DWORD clip_reset; /* time when clipping was last reset */

View File

@ -1,4 +1,4 @@
From e71967fd27b8fb686311dfc1463fe32956d1d23f Mon Sep 17 00:00:00 2001
From 08b4f1cfa36dafe4b31f1aedc9367a125ad6cf85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 2 Aug 2019 02:24:32 -0400
Subject: [PATCH] winex11.drv: Advertise XInput2 version 2.1 support.
@ -125,10 +125,10 @@ index 2550af3cb9c..0d41438c5c7 100644
x_rel = &thread_data->x_rel_valuator;
y_rel = &thread_data->y_rel_valuator;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index b014fd6ae11..e7e75d4d072 100644
index 8c4a46c07c2..b7c876e35fe 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -351,12 +351,9 @@ struct x11drv_thread_data
@@ -349,12 +349,9 @@ struct x11drv_thread_data
HWND clip_hwnd; /* message window stored in desktop while clipping is active */
DWORD clip_reset; /* time when clipping was last reset */
enum xi2_state xi2_state; /* XInput2 state */

View File

@ -1,4 +1,4 @@
From f75111bb0bcc4478dab7b00ddf66362bf29b0624 Mon Sep 17 00:00:00 2001
From 29097b205bc5d0861d14409988da04880626b879 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 19 Dec 2019 22:34:44 +0100
Subject: [PATCH] winex11.drv: Keep track of pointer and device button
@ -16,10 +16,10 @@ Original patch by Andrew Eikum <aeikum@codeweavers.com>.
4 files changed, 106 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index ce10f6ee1a3..390b36e7695 100644
index d86f418a64e..f905794b23a 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1942,13 +1942,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
@@ -1882,13 +1882,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
{
HWND hwnd;
@ -196,10 +196,10 @@ index 0d41438c5c7..fc5fd29d7b6 100644
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index e7e75d4d072..2e5a045415e 100644
index b7c876e35fe..7a89a010395 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -646,6 +646,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
@@ -643,6 +643,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN;
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
@ -208,10 +208,10 @@ index e7e75d4d072..2e5a045415e 100644
DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index f1e50f56659..11ecf7aeed8 100644
index 43c30ab369c..d8576949aea 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -617,6 +617,7 @@ static BOOL process_attach(void)
@@ -616,6 +616,7 @@ static BOOL process_attach(void)
if (use_xkb) use_xkb = XkbUseExtension( gdi_display, NULL, NULL );
#endif
X11DRV_InitKeyboard( gdi_display );

View File

@ -1,4 +1,4 @@
From ce3b572e3b0ac1b19e9d032039435044e51929de Mon Sep 17 00:00:00 2001
From b0e9308f959238859ddd0e8383c024e3e5020d54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 26 Aug 2019 14:37:20 +0200
Subject: [PATCH] server: Add send_hardware_message flags for rawinput
@ -11,10 +11,10 @@ Subject: [PATCH] server: Add send_hardware_message flags for rawinput
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index f986b71953a..98f6c2730e0 100644
index a80fb8c57ea..f0d4fa9cd14 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3259,6 +3259,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
@@ -3278,6 +3278,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.mouse.flags = input->u.mi.dwFlags;
req->input.mouse.time = input->u.mi.time;
req->input.mouse.info = input->u.mi.dwExtraInfo;
@ -22,7 +22,7 @@ index f986b71953a..98f6c2730e0 100644
break;
case INPUT_KEYBOARD:
req->input.kbd.vkey = input->u.ki.wVk;
@@ -3266,6 +3267,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
@@ -3285,6 +3286,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.kbd.flags = input->u.ki.dwFlags;
req->input.kbd.time = input->u.ki.time;
req->input.kbd.info = input->u.ki.dwExtraInfo;
@ -31,10 +31,10 @@ index f986b71953a..98f6c2730e0 100644
case INPUT_HARDWARE:
req->input.hw.msg = input->u.hi.uMsg;
diff --git a/server/protocol.def b/server/protocol.def
index 829216b58c1..90379955ecd 100644
index eb15cef6fdb..e098c78a125 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2054,6 +2054,7 @@ enum message_type
@@ -2044,6 +2044,7 @@ enum message_type
VARARG(keystate,bytes); /* global state array for all the keys */
@END
#define SEND_HWMSG_INJECTED 0x01
@ -43,10 +43,10 @@ index 829216b58c1..90379955ecd 100644
/* Get a message from the current queue */
diff --git a/server/queue.c b/server/queue.c
index a411d0af8d2..a928f4d7fad 100644
index 3e6050686ae..c87e1ddb0d4 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1782,7 +1782,7 @@ done:
@@ -1732,7 +1732,7 @@ done:
/* queue a hardware message for a mouse event */
static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
@ -55,7 +55,7 @@ index a411d0af8d2..a928f4d7fad 100644
{
const struct rawinput_device *device;
struct hardware_msg_data *msg_data;
@@ -1837,7 +1837,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
@@ -1787,7 +1787,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
y = desktop->cursor.y;
}
@ -64,7 +64,7 @@ index a411d0af8d2..a928f4d7fad 100644
{
raw_msg.foreground = foreground;
raw_msg.desktop = desktop;
@@ -1896,7 +1896,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
@@ -1846,7 +1846,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
/* queue a hardware message for a keyboard event */
static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
@ -73,7 +73,7 @@ index a411d0af8d2..a928f4d7fad 100644
{
struct hw_msg_source source = { IMDT_KEYBOARD, origin };
const struct rawinput_device *device;
@@ -1974,7 +1974,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
@@ -1924,7 +1924,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
break;
}
@ -82,20 +82,19 @@ index a411d0af8d2..a928f4d7fad 100644
{
raw_msg.foreground = foreground;
raw_msg.desktop = desktop;
@@ -2603,11 +2603,11 @@ DECL_HANDLER(send_hardware_message)
@@ -2540,10 +2540,10 @@ DECL_HANDLER(send_hardware_message)
switch (req->input.type)
{
case INPUT_MOUSE:
if (!desktop) return;
- reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender );
+ reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags );
break;
case INPUT_KEYBOARD:
if (!desktop) return;
- reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender );
+ reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, req->flags );
break;
case INPUT_HARDWARE:
if (!desktop) set_error( STATUS_SUCCESS );
queue_custom_hardware_message( desktop, req->win, origin, &req->input );
--
2.30.2

View File

@ -1,4 +1,4 @@
From 5505c3b36acb807fe810dad5094806205f2be804 Mon Sep 17 00:00:00 2001
From 59581c76996e2bee0844dfb51b0340d705ef1c5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Wed, 24 Mar 2021 23:29:28 +0100
Subject: [PATCH] user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT is
@ -20,10 +20,10 @@ __wine_send_input with INPUT_HARDWARE input type and a rawinput.
9 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 805bfe3e9de..e78c6b9ce83 100644
index 64d7829e258..38a070fa87d 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -181,6 +181,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
@@ -235,6 +235,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
{
UINT i;
NTSTATUS status = STATUS_SUCCESS;
@ -31,7 +31,7 @@ index 805bfe3e9de..e78c6b9ce83 100644
if (size != sizeof(INPUT))
{
@@ -210,7 +211,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
@@ -264,7 +265,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
update_mouse_coords( &input );
/* fallthrough */
case INPUT_KEYBOARD:
@ -41,10 +41,10 @@ index 805bfe3e9de..e78c6b9ce83 100644
case INPUT_HARDWARE:
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 98f6c2730e0..43c6adad033 100644
index f0d4fa9cd14..702e5892a4d 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3259,7 +3259,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
@@ -3278,7 +3278,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.mouse.flags = input->u.mi.dwFlags;
req->input.mouse.time = input->u.mi.time;
req->input.mouse.info = input->u.mi.dwExtraInfo;
@ -53,7 +53,7 @@ index 98f6c2730e0..43c6adad033 100644
break;
case INPUT_KEYBOARD:
req->input.kbd.vkey = input->u.ki.wVk;
@@ -3267,7 +3267,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
@@ -3286,7 +3286,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.kbd.flags = input->u.ki.dwFlags;
req->input.kbd.time = input->u.ki.time;
req->input.kbd.info = input->u.ki.dwExtraInfo;
@ -63,7 +63,7 @@ index 98f6c2730e0..43c6adad033 100644
case INPUT_HARDWARE:
req->input.hw.msg = input->u.hi.uMsg;
diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c
index 0a6ede0ec5f..df85188fbbb 100644
index 803f13d8f39..a9563161ece 100644
--- a/dlls/wineandroid.drv/keyboard.c
+++ b/dlls/wineandroid.drv/keyboard.c
@@ -671,6 +671,7 @@ static BOOL get_async_key_state( BYTE state[256] )
@ -84,7 +84,7 @@ index 0a6ede0ec5f..df85188fbbb 100644
/***********************************************************************
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index 1cb1bbbadc9..92a1c5012a0 100644
index 997bce15964..d169fb78d78 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -428,6 +428,7 @@ static int process_events( DWORD mask )
@ -147,10 +147,10 @@ index f2368c10743..89f6d9c617d 100644
}
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 1ea15f59341..b4d50058d4e 100644
index f4b955cd46a..0cdfc96ea0b 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -918,6 +918,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
@@ -916,6 +916,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
*/
static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD flags, DWORD time)
{
@ -158,7 +158,7 @@ index 1ea15f59341..b4d50058d4e 100644
INPUT input;
TRACE_(key)("hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags);
@@ -929,7 +930,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl
@@ -927,7 +928,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl
input.ki.time = time;
input.ki.dwExtraInfo = 0;
@ -189,7 +189,7 @@ index d2278ae0e4c..d6598617456 100644
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 272f728def9..2e87eeede99 100644
index f905794b23a..7f305ff377c 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1137,6 +1137,7 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e)

View File

@ -1,4 +1,4 @@
From 1ab8aaf4c6d73f8414f5c77db096655a5e08f310 Mon Sep 17 00:00:00 2001
From 2e661c0f3384f920f97b3c78e94096233093b4ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 25 Mar 2021 14:26:35 +0100
Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through
@ -6,49 +6,40 @@ Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through
---
dlls/user32/message.c | 6 ++++++
server/queue.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
server/queue.c | 3 +++
2 files changed, 9 insertions(+)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 0f724a0acc3..3fe2fc3ce6a 100644
index 702e5892a4d..98c9648e36b 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3290,6 +3290,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
@@ -3298,6 +3298,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.hw.rawinput.type = rawinput->header.dwType;
switch (rawinput->header.dwType)
{
+ case RIM_TYPEMOUSE:
+ req->input.hw.rawinput.mouse.x = rawinput->data.mouse.lLastX;
+ req->input.hw.rawinput.mouse.y = rawinput->data.mouse.lLastY;
+ req->input.hw.rawinput.mouse.data = rawinput->data.mouse.u.ulButtons;
+ req->input.hw.lparam = rawinput->data.mouse.ulRawButtons;
+ req->input.hw.rawinput.mouse.data = rawinput->data.mouse.ulRawButtons;
+ req->input.hw.lparam = rawinput->data.mouse.usFlags;
+ break;
case RIM_TYPEHID:
assert( rawinput->data.hid.dwCount <= 1 );
req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice );
req->input.hw.rawinput.hid.param = rawinput->header.wParam;
diff --git a/server/queue.c b/server/queue.c
index 52a16825778..9e47a465613 100644
index c87e1ddb0d4..55580fe1122 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -2054,7 +2054,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
raw_msg.extra = NULL;
raw_msg.extra_len = 0;
- if (input->hw.msg == WM_INPUT)
+ if (input->hw.msg == WM_INPUT && input->hw.rawinput.type == RIM_TYPEHID)
{
raw_msg.extra = get_req_data();
raw_msg.extra_len = get_req_data_size();
@@ -2065,6 +2065,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
@@ -2016,6 +2016,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
msg_data->flags = 0;
msg_data->rawinput = input->hw.rawinput;
+ if (input->hw.msg == WM_INPUT && input->hw.rawinput.type == RIM_TYPEMOUSE)
+ msg_data->flags = input->hw.lparam;
+
if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
input->hw.rawinput.type == RIM_TYPEHID &&
input->hw.rawinput.hid.param == GIDC_ARRIVAL)
enum_processes( queue_rawinput_message, &raw_msg );
if (raw_msg.foreground) release_object( raw_msg.foreground );
--
2.30.2

View File

@ -1,4 +1,4 @@
From 22846605056d89063ec4c78b353f48d76b39b41f Mon Sep 17 00:00:00 2001
From a5f930d50c026021b7d7ccac2cb2a58d43abff12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 25 Mar 2021 16:12:58 +0100
Subject: [PATCH] winex11.drv: Listen to RawMotion and RawButton* events in the
@ -9,13 +9,13 @@ to trigger low-level hooks callbacks when clipping cursor. This is for
instance used in our dinput implementation.
---
dlls/winex11.drv/event.c | 10 ++-
dlls/winex11.drv/mouse.c | 107 ++++++++++++++++++++++++++++++---
dlls/winex11.drv/mouse.c | 111 ++++++++++++++++++++++++++++++---
dlls/winex11.drv/x11drv.h | 1 +
dlls/winex11.drv/x11drv_main.c | 4 ++
4 files changed, 111 insertions(+), 11 deletions(-)
4 files changed, 115 insertions(+), 11 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 217c1eca857..8685ce9536b 100644
index bc007bea1d6..bdfc133774a 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -328,6 +328,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE
@ -54,7 +54,7 @@ index 217c1eca857..8685ce9536b 100644
#endif
}
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 6b6512521f4..0558467a805 100644
index 6b6512521f4..7ff360d5127 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -422,7 +422,18 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
@ -128,7 +128,7 @@ index 6b6512521f4..0558467a805 100644
input.u.mi.mouseData = 0;
input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
@@ -1987,10 +1997,85 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
@@ -1987,10 +1997,89 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
return FALSE;
}
@ -148,16 +148,18 @@ index 6b6512521f4..0558467a805 100644
+ rawinput.header.dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE);
+ rawinput.header.hDevice = ULongToHandle(1); /* WINE_MOUSE_HANDLE */
+ rawinput.header.wParam = RIM_INPUT;
+ rawinput.data.mouse.ulRawButtons = input.u.mi.dwFlags;
+ rawinput.data.mouse.u.ulButtons = input.u.mi.mouseData;
+ rawinput.data.mouse.usFlags = input.u.mi.dwFlags;
+ rawinput.data.mouse.ulRawButtons = 0;
+ rawinput.data.mouse.u.usButtonData = 0;
+ rawinput.data.mouse.u.usButtonFlags = 0;
+ rawinput.data.mouse.lLastX = input.u.mi.dx;
+ rawinput.data.mouse.lLastY = input.u.mi.dy;
+ rawinput.data.mouse.ulExtraInformation = 0;
+
+ input.type = INPUT_HARDWARE;
+ input.u.hi.uMsg = WM_INPUT;
+ input.u.hi.wParamH = (WORD)(rawinput.header.dwSize >> 16);
+ input.u.hi.wParamL = (WORD)(rawinput.header.dwSize >> 0);
+ input.u.hi.wParamH = 0;
+ input.u.hi.wParamL = 0;
+ if (rawinput.data.mouse.lLastX || rawinput.data.mouse.lLastY)
+ __wine_send_input( 0, &input, &rawinput );
+ }
@ -196,28 +198,30 @@ index 6b6512521f4..0558467a805 100644
+ rawinput.header.wParam = RIM_INPUT;
+ if (event->evtype == XI_RawButtonRelease)
+ {
+ rawinput.data.mouse.ulRawButtons = button_up_flags[button];
+ rawinput.data.mouse.u.ulButtons = button_up_data[button];
+ rawinput.data.mouse.usFlags = button_up_flags[button];
+ rawinput.data.mouse.ulRawButtons = button_up_data[button];
+ }
+ else
+ {
+ rawinput.data.mouse.ulRawButtons = button_down_flags[button];
+ rawinput.data.mouse.u.ulButtons = button_down_data[button];
+ rawinput.data.mouse.usFlags = button_down_flags[button];
+ rawinput.data.mouse.ulRawButtons = button_down_data[button];
+ }
+ rawinput.data.mouse.u.usButtonData = 0;
+ rawinput.data.mouse.u.usButtonFlags = 0;
+ rawinput.data.mouse.lLastX = 0;
+ rawinput.data.mouse.lLastY = 0;
+ rawinput.data.mouse.ulExtraInformation = 0;
+
+ input.type = INPUT_HARDWARE;
+ input.u.hi.uMsg = WM_INPUT;
+ input.u.hi.wParamH = (WORD)(rawinput.header.dwSize >> 16);
+ input.u.hi.wParamL = (WORD)(rawinput.header.dwSize >> 0);
+ if (rawinput.data.mouse.ulRawButtons || rawinput.data.mouse.u.ulButtons)
+ input.u.hi.wParamH = 0;
+ input.u.hi.wParamL = 0;
+ if (rawinput.data.mouse.usFlags || rawinput.data.mouse.ulRawButtons)
+ __wine_send_input( 0, &input, &rawinput );
return TRUE;
}
@@ -2066,6 +2151,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
@@ -2066,6 +2155,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
case XI_RawMotion:
ret = X11DRV_RawMotion( event );
break;
@ -229,10 +233,10 @@ index 6b6512521f4..0558467a805 100644
default:
TRACE( "Unhandled event %#x\n", event->evtype );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index afa990b7e68..910a6c6cc18 100644
index 7a89a010395..2fd8519971d 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -353,6 +353,7 @@ struct x11drv_thread_data
@@ -352,6 +352,7 @@ struct x11drv_thread_data
struct x11drv_valuator_data x_rel_valuator;
struct x11drv_valuator_data y_rel_valuator;
int xi2_core_pointer; /* XInput2 core pointer id */

View File

@ -1,5 +1,3 @@
Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in Unity games, have walkaround in Fallout4 )
Fixes: [42675] Overwatch: Phantom mouse input / view pulled up to ceiling
Depends: user32-rawinput-hid
# In the process of upstreaming.
Disabled: true