From 5f9cbd0ebcc9ca8bfddbf99e78a54fb02dd030d7 Mon Sep 17 00:00:00 2001
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date: Wed, 20 Feb 2019 15:56:04 +0100
Subject: [PATCH] Wayland: keyboard repeat rate is given in Hz

It was currently interpreted as ms, which is obviously wrong.

Thanks to https://github.com/Smithay/client-toolkit/pull/62 for making
me notice this issue.
---
 src/wl_init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/wl_init.c b/src/wl_init.c
index c6b209bc..40993a04 100644
--- a/src/wl_init.c
+++ b/src/wl_init.c
@@ -589,8 +589,10 @@ static void keyboardHandleKey(void* data,
         {
             _glfw.wl.keyboardLastKey = keyCode;
             _glfw.wl.keyboardLastScancode = key;
-            timer.it_interval.tv_sec = _glfw.wl.keyboardRepeatRate / 1000;
-            timer.it_interval.tv_nsec = (_glfw.wl.keyboardRepeatRate % 1000) * 1000000;
+            if (_glfw.wl.keyboardRepeatRate > 1)
+                timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate;
+            else
+                timer.it_interval.tv_sec = 1;
             timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000;
             timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000;
         }