wayland: Synthesize repeated keys after processing events
Otherwise, long delays between pumping events can result in repeating keys that were already lifted some time ago.
This commit is contained in:
@@ -599,16 +599,6 @@ void Wayland_PumpEvents(SDL_VideoDevice *_this)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Synthesize key repeat events.
|
|
||||||
wl_list_for_each (seat, &d->seat_list, link) {
|
|
||||||
if (keyboard_repeat_is_set(&seat->keyboard.repeat)) {
|
|
||||||
Wayland_SeatSetKeymap(seat);
|
|
||||||
|
|
||||||
const Uint64 elapsed = SDL_GetTicksNS() - seat->keyboard.repeat.sdl_press_time_ns;
|
|
||||||
keyboard_repeat_handle(&seat->keyboard.repeat, elapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBDECOR_H
|
#ifdef HAVE_LIBDECOR_H
|
||||||
if (d->shell.libdecor) {
|
if (d->shell.libdecor) {
|
||||||
libdecor_dispatch(d->shell.libdecor, 0);
|
libdecor_dispatch(d->shell.libdecor, 0);
|
||||||
@@ -661,6 +651,18 @@ void Wayland_PumpEvents(SDL_VideoDevice *_this)
|
|||||||
ret = WAYLAND_wl_display_dispatch_pending(d->display);
|
ret = WAYLAND_wl_display_dispatch_pending(d->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret >= 0) {
|
||||||
|
// Synthesize key repeat events.
|
||||||
|
wl_list_for_each (seat, &d->seat_list, link) {
|
||||||
|
if (keyboard_repeat_is_set(&seat->keyboard.repeat)) {
|
||||||
|
Wayland_SeatSetKeymap(seat);
|
||||||
|
|
||||||
|
const Uint64 elapsed = SDL_GetTicksNS() - seat->keyboard.repeat.sdl_press_time_ns;
|
||||||
|
keyboard_repeat_handle(&seat->keyboard.repeat, elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
connection_error:
|
connection_error:
|
||||||
if (ret < 0 && !d->display_disconnected) {
|
if (ret < 0 && !d->display_disconnected) {
|
||||||
/* Something has failed with the Wayland connection -- for example,
|
/* Something has failed with the Wayland connection -- for example,
|
||||||
|
|||||||
Reference in New Issue
Block a user