aboutsummarylogtreecommitdiffstats
path: root/0002-Continue-poll-if-timerfd-cant-be-read.patch
blob: 5eb7513fa298f73b31fe77da2c7139b86a1fe9ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 68879081cb39f50bd65d12e0f1869f5970dc71b9 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Tue, 14 Dec 2021 09:29:01 +0100
Subject: [PATCH] =?UTF-8?q?Wayland:=20Continue=20poll()=20if=20timerfd=20c?=
 =?UTF-8?q?an=E2=80=99t=20be=20read?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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
---
 src/wl_window.c | 11 +++--------
 2 files changed, 4 insertions(+), 8 deletions(-)

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