win32u: Move __wine_send_input implementation from user32.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7ba3c31d84
commit
21d60952cb
|
@ -1,6 +1,6 @@
|
|||
MODULE = hidclass.sys
|
||||
IMPORTLIB = hidclass
|
||||
IMPORTS = hal ntoskrnl user32 hidparse
|
||||
IMPORTS = hal ntoskrnl user32 hidparse win32u
|
||||
|
||||
C_SRCS = \
|
||||
device.c \
|
||||
|
|
|
@ -122,19 +122,6 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_send_input (USER32.@)
|
||||
*
|
||||
* Internal SendInput function to allow the graphics driver to inject real events.
|
||||
*/
|
||||
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput )
|
||||
{
|
||||
NTSTATUS status = send_hardware_message( hwnd, input, rawinput, 0 );
|
||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* update_mouse_coords
|
||||
*
|
||||
|
|
|
@ -838,6 +838,5 @@
|
|||
# All functions must be prefixed with '__wine_' (for internal functions)
|
||||
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
|
||||
#
|
||||
@ cdecl __wine_send_input(long ptr ptr)
|
||||
@ cdecl __wine_set_pixel_format(long long)
|
||||
@ cdecl __wine_set_user_driver(ptr long)
|
||||
|
|
|
@ -178,6 +178,7 @@ static const struct user_callbacks user_funcs =
|
|||
notify_ime,
|
||||
post_dde_message,
|
||||
process_hardware_message,
|
||||
rawinput_device_get_usages,
|
||||
register_builtin_classes,
|
||||
MENU_SetMenu,
|
||||
SCROLL_SetStandardScrollPainted,
|
||||
|
|
|
@ -1235,6 +1235,7 @@ static struct unix_funcs unix_funcs =
|
|||
__wine_get_icm_profile,
|
||||
__wine_get_vulkan_driver,
|
||||
__wine_get_wgl_driver,
|
||||
__wine_send_input,
|
||||
__wine_set_display_driver,
|
||||
};
|
||||
|
||||
|
|
|
@ -65,6 +65,16 @@ BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_send_input (win32u.@)
|
||||
*
|
||||
* Internal SendInput function to allow the graphics driver to inject real events.
|
||||
*/
|
||||
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput )
|
||||
{
|
||||
return set_ntstatus( send_hardware_message( hwnd, input, rawinput, 0 ));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserSendInput (win32u.@)
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include "win32u_private.h"
|
||||
#include "ntuser_private.h"
|
||||
#include "hidusage.h"
|
||||
#include "dbt.h"
|
||||
#include "dde.h"
|
||||
#include "wine/server.h"
|
||||
|
@ -1862,6 +1863,121 @@ LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* send_hardware_message
|
||||
*/
|
||||
NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, UINT flags )
|
||||
{
|
||||
struct user_key_state_info *key_state_info = get_user_thread_info()->key_state;
|
||||
struct send_message_info info;
|
||||
int prev_x, prev_y, new_x, new_y;
|
||||
INT counter = global_key_state_counter;
|
||||
USAGE hid_usage_page, hid_usage;
|
||||
NTSTATUS ret;
|
||||
BOOL wait;
|
||||
|
||||
info.type = MSG_HARDWARE;
|
||||
info.dest_tid = 0;
|
||||
info.hwnd = hwnd;
|
||||
info.flags = 0;
|
||||
info.timeout = 0;
|
||||
|
||||
if (input->type == INPUT_HARDWARE && rawinput->header.dwType == RIM_TYPEHID)
|
||||
{
|
||||
if (input->hi.uMsg == WM_INPUT_DEVICE_CHANGE)
|
||||
{
|
||||
hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0];
|
||||
hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1];
|
||||
}
|
||||
if (input->hi.uMsg == WM_INPUT && user_callbacks &&
|
||||
!user_callbacks->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 )
|
||||
{
|
||||
req->win = wine_server_user_handle( hwnd );
|
||||
req->flags = flags;
|
||||
req->input.type = input->type;
|
||||
switch (input->type)
|
||||
{
|
||||
case INPUT_MOUSE:
|
||||
req->input.mouse.x = input->mi.dx;
|
||||
req->input.mouse.y = input->mi.dy;
|
||||
req->input.mouse.data = input->mi.mouseData;
|
||||
req->input.mouse.flags = input->mi.dwFlags;
|
||||
req->input.mouse.time = input->mi.time;
|
||||
req->input.mouse.info = input->mi.dwExtraInfo;
|
||||
break;
|
||||
case INPUT_KEYBOARD:
|
||||
req->input.kbd.vkey = input->ki.wVk;
|
||||
req->input.kbd.scan = input->ki.wScan;
|
||||
req->input.kbd.flags = input->ki.dwFlags;
|
||||
req->input.kbd.time = input->ki.time;
|
||||
req->input.kbd.info = input->ki.dwExtraInfo;
|
||||
break;
|
||||
case INPUT_HARDWARE:
|
||||
req->input.hw.msg = input->hi.uMsg;
|
||||
req->input.hw.lparam = MAKELONG( input->hi.wParamL, input->hi.wParamH );
|
||||
switch (input->hi.uMsg)
|
||||
{
|
||||
case WM_INPUT:
|
||||
case WM_INPUT_DEVICE_CHANGE:
|
||||
req->input.hw.rawinput.type = rawinput->header.dwType;
|
||||
switch (rawinput->header.dwType)
|
||||
{
|
||||
case RIM_TYPEHID:
|
||||
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 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (key_state_info) wine_server_set_reply( req, key_state_info->state,
|
||||
sizeof(key_state_info->state) );
|
||||
ret = wine_server_call( req );
|
||||
wait = reply->wait;
|
||||
prev_x = reply->prev_x;
|
||||
prev_y = reply->prev_y;
|
||||
new_x = reply->new_x;
|
||||
new_y = reply->new_y;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
if (key_state_info)
|
||||
{
|
||||
key_state_info->time = NtGetTickCount();
|
||||
key_state_info->counter = counter;
|
||||
}
|
||||
if ((flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y))
|
||||
user_driver->pSetCursorPos( new_x, new_y );
|
||||
}
|
||||
|
||||
if (wait)
|
||||
{
|
||||
LRESULT ignored;
|
||||
wait_message_reply( 0 );
|
||||
retrieve_reply( &info, 0, &ignored );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* dispatch_message
|
||||
*/
|
||||
|
|
|
@ -53,6 +53,7 @@ struct user_callbacks
|
|||
DWORD type );
|
||||
BOOL (CDECL *process_hardware_message)( MSG *msg, UINT hw_id, const struct hardware_msg_data *msg_data,
|
||||
HWND hwnd_filter, UINT first, UINT last, BOOL remove );
|
||||
BOOL (CDECL *rawinput_device_get_usages)(HANDLE handle, USHORT *usage_page, USHORT *usage);
|
||||
void (CDECL *register_builtin_classes)(void);
|
||||
BOOL (CDECL *set_menu)( HWND hwnd, HMENU menu );
|
||||
void (WINAPI *set_standard_scroll_painted)( HWND hwnd, INT bar, BOOL visible );
|
||||
|
|
|
@ -1321,6 +1321,7 @@
|
|||
# Wine internal extensions
|
||||
|
||||
# Graphics drivers
|
||||
@ cdecl __wine_send_input(long ptr ptr)
|
||||
@ cdecl __wine_set_display_driver(ptr long)
|
||||
|
||||
# OpenGL
|
||||
|
|
|
@ -298,6 +298,7 @@ struct unix_funcs
|
|||
BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename );
|
||||
const struct vulkan_funcs * (CDECL *get_vulkan_driver)( UINT version );
|
||||
struct opengl_funcs * (CDECL *get_wgl_driver)( HDC hdc, UINT version );
|
||||
BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput );
|
||||
void (CDECL *set_display_driver)( struct user_driver_funcs *funcs, UINT version );
|
||||
};
|
||||
|
||||
|
@ -351,6 +352,8 @@ extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN;
|
|||
extern LRESULT post_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
|
||||
extern void process_sent_messages(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput,
|
||||
UINT flags ) DECLSPEC_HIDDEN;
|
||||
extern LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, UINT msg, WPARAM wparam,
|
||||
LPARAM lparam, UINT flags, UINT timeout,
|
||||
PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1234,6 +1234,12 @@ struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
|
|||
return unix_funcs->get_wgl_driver( hdc, version );
|
||||
}
|
||||
|
||||
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput )
|
||||
{
|
||||
if (!unix_funcs) return FALSE;
|
||||
return unix_funcs->wine_send_input( hwnd, input, rawinput );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_set_display_driver (win32u.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue