mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 00:03:38 +00:00
win32u: Move NtUserGetRawInputData from user32.
This commit is contained in:
parent
12e3c4949f
commit
db43005cd8
|
@ -351,7 +351,7 @@ BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage)
|
|||
}
|
||||
|
||||
|
||||
struct rawinput_thread_data *rawinput_thread_data(void)
|
||||
struct rawinput_thread_data * WINAPI rawinput_thread_data(void)
|
||||
{
|
||||
struct user_thread_info *thread_info = get_user_thread_info();
|
||||
struct rawinput_thread_data *data = thread_info->rawinput;
|
||||
|
@ -593,58 +593,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(const RAWINPUTDEVICE *devi
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetRawInputData (USER32.@)
|
||||
*/
|
||||
UINT WINAPI GetRawInputData(HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size)
|
||||
{
|
||||
struct rawinput_thread_data *thread_data = rawinput_thread_data();
|
||||
UINT size;
|
||||
|
||||
TRACE("rawinput %p, command %#x, data %p, data_size %p, header_size %u.\n",
|
||||
rawinput, command, data, data_size, header_size);
|
||||
|
||||
if (!rawinput || thread_data->hw_id != (UINT_PTR)rawinput)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
if (header_size != sizeof(RAWINPUTHEADER))
|
||||
{
|
||||
WARN("Invalid structure size %u.\n", header_size);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case RID_INPUT:
|
||||
size = thread_data->buffer->header.dwSize;
|
||||
break;
|
||||
case RID_HEADER:
|
||||
size = sizeof(RAWINPUTHEADER);
|
||||
break;
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
if (!data)
|
||||
{
|
||||
*data_size = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*data_size < size)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return ~0U;
|
||||
}
|
||||
memcpy(data, thread_data->buffer, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef RAWINPUTHEADER RAWINPUTHEADER64;
|
||||
typedef RAWINPUT RAWINPUT64;
|
||||
|
|
|
@ -367,7 +367,7 @@
|
|||
@ stdcall GetPropW(long wstr)
|
||||
@ stdcall GetQueueStatus(long) NtUserGetQueueStatus
|
||||
@ stdcall GetRawInputBuffer(ptr ptr long)
|
||||
@ stdcall GetRawInputData(ptr long ptr ptr long)
|
||||
@ stdcall GetRawInputData(ptr long ptr ptr long) NtUserGetRawInputData
|
||||
@ stdcall GetRawInputDeviceInfoA(ptr long ptr ptr)
|
||||
@ stdcall GetRawInputDeviceInfoW(ptr long ptr ptr)
|
||||
@ stdcall GetRawInputDeviceList(ptr ptr long)
|
||||
|
|
|
@ -169,6 +169,7 @@ static const struct user_callbacks user_funcs =
|
|||
register_imm,
|
||||
unregister_imm,
|
||||
try_finally,
|
||||
rawinput_thread_data,
|
||||
};
|
||||
|
||||
static NTSTATUS WINAPI User32CopyImage( const struct copy_image_params *params, ULONG size )
|
||||
|
|
|
@ -51,12 +51,6 @@ struct wm_char_mapping_data
|
|||
/* hold up to 10s of 1kHz mouse rawinput events */
|
||||
#define RAWINPUT_BUFFER_SIZE (512*1024)
|
||||
|
||||
struct rawinput_thread_data
|
||||
{
|
||||
UINT hw_id; /* current rawinput message id */
|
||||
RAWINPUT buffer[1]; /* rawinput message data buffer */
|
||||
};
|
||||
|
||||
extern BOOL (WINAPI *imm_register_window)(HWND) DECLSPEC_HIDDEN;
|
||||
extern void (WINAPI *imm_unregister_window)(HWND) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -73,7 +67,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 struct rawinput_thread_data * WINAPI rawinput_thread_data(void);
|
||||
extern void rawinput_update_device_list(void);
|
||||
|
||||
extern BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid,
|
||||
|
|
|
@ -43,6 +43,7 @@ C_SRCS = \
|
|||
path.c \
|
||||
pen.c \
|
||||
printdrv.c \
|
||||
rawinput.c \
|
||||
region.c \
|
||||
spy.c \
|
||||
syscall.c \
|
||||
|
|
|
@ -1184,6 +1184,7 @@ static struct unix_funcs unix_funcs =
|
|||
NtUserGetMessage,
|
||||
NtUserGetPriorityClipboardFormat,
|
||||
NtUserGetQueueStatus,
|
||||
NtUserGetRawInputData,
|
||||
NtUserGetSystemMenu,
|
||||
NtUserGetUpdateRect,
|
||||
NtUserGetUpdateRgn,
|
||||
|
|
|
@ -50,6 +50,7 @@ struct user_callbacks
|
|||
void (WINAPI *unregister_imm)( HWND hwnd );
|
||||
NTSTATUS (CDECL *try_finally)( NTSTATUS (CDECL *func)( void *), void *arg,
|
||||
void (CALLBACK *finally_func)( BOOL ));
|
||||
struct rawinput_thread_data *(WINAPI *get_rawinput_thread_data)(void);
|
||||
};
|
||||
|
||||
#define WM_SYSTIMER 0x0118
|
||||
|
@ -61,6 +62,12 @@ enum system_timer_id
|
|||
SYSTEM_TIMER_CARET = 0xffff,
|
||||
};
|
||||
|
||||
struct rawinput_thread_data
|
||||
{
|
||||
UINT hw_id; /* current rawinput message id */
|
||||
RAWINPUT buffer[1]; /* rawinput message data buffer */
|
||||
};
|
||||
|
||||
struct user_object
|
||||
{
|
||||
HANDLE handle;
|
||||
|
|
91
dlls/win32u/rawinput.c
Normal file
91
dlls/win32u/rawinput.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Raw Input
|
||||
*
|
||||
* Copyright 2012 Henri Verbeet
|
||||
* Copyright 2018 Zebediah Figura for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#include "win32u_private.h"
|
||||
#include "ntuser_private.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserGetRawInputData (win32u.@)
|
||||
*/
|
||||
UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size )
|
||||
{
|
||||
struct rawinput_thread_data *thread_data;
|
||||
UINT size;
|
||||
|
||||
TRACE( "rawinput %p, command %#x, data %p, data_size %p, header_size %u.\n",
|
||||
rawinput, command, data, data_size, header_size );
|
||||
|
||||
if (!user_callbacks || !(thread_data = user_callbacks->get_rawinput_thread_data()))
|
||||
{
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
if (!rawinput || thread_data->hw_id != (UINT_PTR)rawinput)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
if (header_size != sizeof(RAWINPUTHEADER))
|
||||
{
|
||||
WARN( "Invalid structure size %u.\n", header_size );
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case RID_INPUT:
|
||||
size = thread_data->buffer->header.dwSize;
|
||||
break;
|
||||
|
||||
case RID_HEADER:
|
||||
size = sizeof(RAWINPUTHEADER);
|
||||
break;
|
||||
|
||||
default:
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
if (!data)
|
||||
{
|
||||
*data_size = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*data_size < size)
|
||||
{
|
||||
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||
return ~0u;
|
||||
}
|
||||
memcpy( data, thread_data->buffer, size );
|
||||
return size;
|
||||
}
|
|
@ -984,7 +984,7 @@
|
|||
@ stdcall NtUserGetQueueStatus(long)
|
||||
@ stub NtUserGetQueueStatusReadonly
|
||||
@ stub NtUserGetRawInputBuffer
|
||||
@ stub NtUserGetRawInputData
|
||||
@ stdcall NtUserGetRawInputData(ptr long ptr ptr long)
|
||||
@ stub NtUserGetRawInputDeviceInfo
|
||||
@ stub NtUserGetRawInputDeviceList
|
||||
@ stub NtUserGetRawPointerDeviceData
|
||||
|
|
|
@ -247,6 +247,8 @@ struct unix_funcs
|
|||
BOOL (WINAPI *pNtUserGetMessage)( MSG *msg, HWND hwnd, UINT first, UINT last );
|
||||
INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );
|
||||
DWORD (WINAPI *pNtUserGetQueueStatus)( UINT flags );
|
||||
UINT (WINAPI *pNtUserGetRawInputData)( HRAWINPUT rawinput, UINT command,
|
||||
void *data, UINT *data_size, UINT header_size );
|
||||
HMENU (WINAPI *pNtUserGetSystemMenu)( HWND hwnd, BOOL revert );
|
||||
BOOL (WINAPI *pNtUserGetUpdateRect)( HWND hwnd, RECT *rect, BOOL erase );
|
||||
INT (WINAPI *pNtUserGetUpdateRgn)( HWND hwnd, HRGN hrgn, BOOL erase );
|
||||
|
|
|
@ -1048,6 +1048,12 @@ DWORD WINAPI NtUserGetQueueStatus( UINT flags )
|
|||
return unix_funcs->pNtUserGetQueueStatus( flags );
|
||||
}
|
||||
|
||||
UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size )
|
||||
{
|
||||
if (!unix_funcs) return ~0u;
|
||||
return unix_funcs->pNtUserGetRawInputData( rawinput, command, data, data_size, header_size );
|
||||
}
|
||||
|
||||
BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size )
|
||||
{
|
||||
if (!unix_funcs) return FALSE;
|
||||
|
|
|
@ -606,6 +606,7 @@ HWINSTA WINAPI NtUserGetProcessWindowStation(void);
|
|||
HANDLE WINAPI NtUserGetProp( HWND hwnd, const WCHAR *str );
|
||||
ULONG WINAPI NtUserGetProcessDpiAwarenessContext( HANDLE process );
|
||||
DWORD WINAPI NtUserGetQueueStatus( UINT flags );
|
||||
UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, UINT *data_size, UINT header_size );
|
||||
ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process );
|
||||
HMENU WINAPI NtUserGetSystemMenu( HWND hwnd, BOOL revert );
|
||||
HDESK WINAPI NtUserGetThreadDesktop( DWORD thread );
|
||||
|
|
Loading…
Reference in a new issue