|
@@ -1265,16 +1265,20 @@ static void processEvent(XEvent *event)
|
|
|
|
|
|
if (window->x11.ic)
|
|
|
{
|
|
|
- // HACK: Ignore duplicate key press events generated by ibus
|
|
|
- // These have the same timestamp as the original event
|
|
|
- // Corresponding release events are filtered out
|
|
|
- // implicitly by the GLFW key repeat logic
|
|
|
- if (window->x11.lastKeyTime < event->xkey.time)
|
|
|
+ // HACK: Do not report the key press events duplicated by XIM
|
|
|
+ // Duplicate key releases are filtered out implicitly by
|
|
|
+ // the GLFW key repeat logic in _glfwInputKey
|
|
|
+ // A timestamp per key is used to handle simultaneous keys
|
|
|
+ // NOTE: Always allow the first event for each key through
|
|
|
+ // (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 (keycode)
|
|
|
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
|
|
|
|
|
|
- window->x11.lastKeyTime = event->xkey.time;
|
|
|
+ window->x11.keyPressTimes[keycode] = event->xkey.time;
|
|
|
}
|
|
|
|
|
|
if (!filtered)
|