On Thu May 30 09:54:10 2024 +0000, Rémi Bernon wrote:
We don't use these struct literals anywhere in Wine, it's not too bad but I'm not sure I want to create a precedent here. As we only receive WM_INPUT when registering for it, what about doing something like:
static void append_rawinput_message( HWND hwnd, WPARAM wparam, HRAWINPUT handle ) { RAWINPUT rawinput; UINT size = sizeof(rawinput), ret; ret = GetRawInputData( handle, RID_INPUT, &rawinput, &size, sizeof(RAWINPUTHEADER) ); ok_ne( ret, (UINT)-1, UINT, "%u" ); if (rawinput.header.dwType == RIM_TYPEKEYBOARD) { struct user_call call = { .func = RAW_INPUT_KEYBOARD, .raw_input = {.hwnd = hwnd, .code = GET_RAWINPUT_CODE_WPARAM(wparam), .kbd = rawinput.data.keyboard} }; ULONG index = InterlockedIncrement( ¤t_sequence_len ) - 1; ok( index < ARRAY_SIZE(current_sequence), "got %lu calls\n", index ); if (!append_message_hwnd) call.message.hwnd = 0; current_sequence[index] = call; } } static void append_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { if (msg == WM_INPUT) append_rawinput_message( hwnd, wparam, (HRAWINPUT)lparam ); else if (!p_accept_message || p_accept_message( msg )) { struct user_call call = {.func = MSG_TEST_WIN, .message = {.hwnd = hwnd, .msg = msg, .wparam = wparam, .lparam = lparam}}; ULONG index = InterlockedIncrement( ¤t_sequence_len ) - 1; ok( index < ARRAY_SIZE(current_sequence), "got %lu calls\n", index ); if (!append_message_hwnd) call.message.hwnd = 0; current_sequence[index] = call; } }
Done in v2.