From 1f748d1be87348f5a70ce45ccdabd5d9d013f33b Mon Sep 17 00:00:00 2001 From: Ali Chraghi <63465728+AliChraghi@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:27:08 +0330 Subject: [PATCH] glfw: repatch undefined behavior in X11 keypress handling (#150) repatch undefined behavior in GLFW which did not land yet and was accidentally removed when updating GLFW in #136 See glfw/glfw#1989 Fixes hexops/mach#149 --- glfw/upstream/glfw/src/x11_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glfw/upstream/glfw/src/x11_window.c b/glfw/upstream/glfw/src/x11_window.c index 5ac94ce8..111b2b12 100644 --- a/glfw/upstream/glfw/src/x11_window.c +++ b/glfw/upstream/glfw/src/x11_window.c @@ -1283,7 +1283,7 @@ static void processEvent(XEvent *event) // (the server never sends a timestamp of zero) // NOTE: Timestamp difference is compared to handle wrap-around Time diff = event->xkey.time - window->x11.keyPressTimes[keycode]; - if (diff == event->xkey.time || (diff > 0 && diff < (1 << 31))) + if (diff == event->xkey.time || (diff > 0 && diff < ((Time)1 << 31))) { if (keycode) _glfwInputKey(window, key, keycode, GLFW_PRESS, mods);