From 70fff72e2dc3387652efef1e56edc91661e292d3 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:38:48 +0100 Subject: [PATCH] Wayland platform: fix handling of key repeats --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 4a7ace768..47cd8da2e 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -559,6 +559,9 @@ static int process_wld_key(struct xkb_state *xkb_state, uint32_t key, } +static uint32_t last_keydown_serial = 0; // serial of last keydown event + + static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { struct Fl_Wayland_Screen_Driver::seat *seat = @@ -582,6 +585,7 @@ static void wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, //fprintf(stderr, "\n"); seat->keyboard_surface = surface; seat->keyboard_enter_serial = serial; + last_keydown_serial = 0; Fl_Window *win = Fl_Wayland_Window_Driver::surface_to_window(surface); if (win) { Fl::handle(FL_FOCUS, win); @@ -594,7 +598,6 @@ struct key_repeat_data_t { uint32_t serial; Fl_Window *window; }; -static uint32_t last_keydown_serial = 0; // serial of last keydown event #define KEY_REPEAT_DELAY 0.5 // sec #define KEY_REPEAT_INTERVAL 0.05 // sec -- GitLab