Browse Source

Wayland: Add default keyboard repetition values

The `wl_keyboard::repeat_info` event got introduced in version 4. On
versions older than that, we defaulted to 0 delay, which means no
repetition. That's a veeery old version and basically everything offers
it, but it doesn't hurt to add a reasonable default.
Dery Almas 3 weeks ago
parent
commit
a79239e332
1 changed files with 5 additions and 2 deletions
  1. 5 2
      platform/linuxbsd/wayland/wayland_thread.h

+ 5 - 2
platform/linuxbsd/wayland/wayland_thread.h

@@ -480,8 +480,11 @@ public:
 
 		xkb_layout_index_t current_layout_index = 0;
 
-		int32_t repeat_key_delay_msec = 0;
-		int32_t repeat_start_delay_msec = 0;
+		// Clients with `wl_seat`s older than version 4 do not support
+		// `wl_keyboard::repeat_info`, so we'll provide a reasonable default of 25
+		// keys per second, with a start delay of 600 milliseconds.
+		int32_t repeat_key_delay_msec = 1000 / 25;
+		int32_t repeat_start_delay_msec = 600;
 
 		xkb_keycode_t repeating_keycode = XKB_KEYCODE_INVALID;
 		uint64_t last_repeat_start_msec = 0;