mirror of
https://github.com/glfw/glfw.git
synced 2025-06-15 20:22:15 +00:00
Fix undefined behaviour in X11 keypress handling
`1 << 31` is undefined because 1 is an int, so the shift would set the sign bit
This commit is contained in:
parent
fb0f2f92a3
commit
920afdd1ce
@ -1269,7 +1269,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);
|
||||
|
Loading…
Reference in New Issue
Block a user