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
This commit is contained in:
Ali Chraghi 2021-12-28 14:27:08 +03:30 committed by GitHub
parent dc2f2b2a12
commit 1f748d1be8
Failed to generate hash of commit

View file

@ -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);