winewayland.drv: Configure win32u keyboard repeat delay and speed.

This commit is contained in:
Rémi Bernon 2023-10-11 16:17:14 +02:00 committed by Alexandre Julliard
parent 1975398bd1
commit c36b419344
5 changed files with 30 additions and 1 deletions

View file

@ -288,6 +288,7 @@ struct send_message_info
};
static const INPUT_MESSAGE_SOURCE msg_source_unavailable = { IMDT_UNAVAILABLE, IMO_UNAVAILABLE };
static BOOL keyboard_auto_repeat_enabled;
/* flag for messages that contain pointers */
/* 32 messages per entry, messages 0..31 map to bits 0..31 */
@ -508,6 +509,13 @@ static inline BOOL check_hwnd_filter( const MSG *msg, HWND hwnd_filter )
return (msg->hwnd == hwnd_filter || is_child( hwnd_filter, msg->hwnd ));
}
BOOL set_keyboard_auto_repeat( BOOL enable )
{
BOOL enabled = keyboard_auto_repeat_enabled;
keyboard_auto_repeat_enabled = enable;
return enabled;
}
/***********************************************************************
* unpack_message
*

View file

@ -242,6 +242,9 @@ HICON alloc_cursoricon_handle( BOOL is_icon );
extern void free_dce( struct dce *dce, HWND hwnd );
extern void invalidate_dce( WND *win, const RECT *extra_rect );
/* message.c */
extern BOOL set_keyboard_auto_repeat( BOOL enable ) DECLSPEC_HIDDEN;
/* window.c */
HANDLE alloc_user_handle( struct user_object *ptr, unsigned int type );
void *free_user_handle( HANDLE handle, unsigned int type );

View file

@ -6324,6 +6324,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
process_layout = arg;
return TRUE;
case NtUserCallOneParam_SetKeyboardAutoRepeat:
return set_keyboard_auto_repeat( arg );
/* temporary exports */
case NtUserGetDeskPattern:
return get_entry( &entry_DESKPATTERN, 256, (WCHAR *)arg );

View file

@ -219,7 +219,20 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *wl_keyboar
static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *wl_keyboard,
int rate, int delay)
{
FIXME("rate=%d delay=%d stub!\n", rate, delay);
UINT speed;
TRACE("rate=%d delay=%d\n", rate, delay);
/* Handle non-negative rate values, ignore invalid (negative) values. A
* rate of 0 disables repeat. */
if (rate >= 80) speed = 31;
else if (rate >= 5) speed = rate * 400 / 1000 - 1;
else speed = 0;
delay = max(0, min(3, round(delay / 250.0) - 1));
NtUserSystemParametersInfo(SPI_SETKEYBOARDSPEED, speed, NULL, 0);
NtUserSystemParametersInfo(SPI_SETKEYBOARDDELAY, delay, NULL, 0);
NtUserCallOneParam(rate > 0, NtUserCallOneParam_SetKeyboardAutoRepeat);
}
static const struct wl_keyboard_listener keyboard_listener = {
@ -245,6 +258,7 @@ void wayland_keyboard_init(struct wl_keyboard *wl_keyboard)
return;
}
NtUserCallOneParam(TRUE, NtUserCallOneParam_SetKeyboardAutoRepeat);
pthread_mutex_lock(&keyboard->mutex);
keyboard->wl_keyboard = wl_keyboard;
keyboard->xkb_context = xkb_context;

View file

@ -878,6 +878,7 @@ enum
NtUserCallOneParam_ReplyMessage,
NtUserCallOneParam_SetCaretBlinkTime,
NtUserCallOneParam_SetProcessDefaultLayout,
NtUserCallOneParam_SetKeyboardAutoRepeat,
/* temporary exports */
NtUserGetDeskPattern,
};