mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 06:23:50 +00:00
Wayland: Handle repeats which missed a timer
This commit is contained in:
parent
608f055c72
commit
f67b610dd4
@ -445,7 +445,8 @@ handleEvents(int timeout)
|
|||||||
{ wl_display_get_fd(display), POLLIN },
|
{ wl_display_get_fd(display), POLLIN },
|
||||||
{ _glfw.wl.timerfd, POLLIN },
|
{ _glfw.wl.timerfd, POLLIN },
|
||||||
};
|
};
|
||||||
char buf[8];
|
ssize_t read_ret;
|
||||||
|
uint64_t repeats, i;
|
||||||
|
|
||||||
while (wl_display_prepare_read(display) != 0)
|
while (wl_display_prepare_read(display) != 0)
|
||||||
wl_display_dispatch_pending(display);
|
wl_display_dispatch_pending(display);
|
||||||
@ -479,12 +480,14 @@ handleEvents(int timeout)
|
|||||||
|
|
||||||
if (fds[1].revents & POLLIN)
|
if (fds[1].revents & POLLIN)
|
||||||
{
|
{
|
||||||
|
read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats));
|
||||||
|
if (read_ret != 8)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < repeats; ++i)
|
||||||
_glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey,
|
_glfwInputKey(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastKey,
|
||||||
_glfw.wl.keyboardLastScancode, GLFW_REPEAT,
|
_glfw.wl.keyboardLastScancode, GLFW_REPEAT,
|
||||||
_glfw.wl.xkb.modifiers);
|
_glfw.wl.xkb.modifiers);
|
||||||
|
|
||||||
// Required to mark the fd as clean.
|
|
||||||
read(_glfw.wl.timerfd, &buf, 8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user