Wayland: Continue poll() if timerfd can’t be read

In the case the key repeat timerfd was interrupted before read(), the
cursor timerfd wasn’t read at all even when it could.

Related to #1711
This commit is contained in:
Emmanuel Gil Peyrot 2021-12-14 09:29:01 +01:00
parent 963e728881
commit 68879081cb
2 changed files with 4 additions and 8 deletions

View File

@ -278,6 +278,7 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908) - [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908)
- [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899) - [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899)
- [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
- [Wayland] Bugfix: Key repeat could lead to a race condition (#1710)
- [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Removed use of deprecated function `gettimeofday`
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)

View File

@ -751,10 +751,7 @@ static void handleEvents(int timeout)
if (fds[1].revents & POLLIN) if (fds[1].revents & POLLIN)
{ {
read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats)); read_ret = read(_glfw.wl.timerfd, &repeats, sizeof(repeats));
if (read_ret != 8) if (read_ret == 8 && _glfw.wl.keyboardFocus)
return;
if (_glfw.wl.keyboardFocus)
{ {
for (uint64_t i = 0; i < repeats; ++i) for (uint64_t i = 0; i < repeats; ++i)
{ {
@ -770,10 +767,8 @@ static void handleEvents(int timeout)
if (fds[2].revents & POLLIN) if (fds[2].revents & POLLIN)
{ {
read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)); read_ret = read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats));
if (read_ret != 8) if (read_ret == 8)
return; incrementCursorImage(_glfw.wl.pointerFocus);
incrementCursorImage(_glfw.wl.pointerFocus);
} }
} }
else else