fix key repeat
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-09-16 15:30:37 -07:00
commit e81156708c
3 changed files with 7 additions and 10 deletions

View file

@ -433,8 +433,6 @@ struct _MwLLWayland {
MwBool dispatching_resize;
MwBool is_toplevel_menu;
struct _MwLLWaylandShmBuffer framebuffer;
struct _MwLLWaylandShmBuffer backbuffer;
struct _MwLLWaylandShmBuffer cursor;
@ -491,6 +489,9 @@ void MwLLWaylandClipboardRead(wl_clipboard_device_context_t* ctx, int clipboard_
/* Flush Wayland events */
void MwLLWaylandFlush(MwLL handle);
/* recursively dispatch the key event to focused widgets. */
void MwLLRecursiveKeyDispatch(MwLL self, int* k, MwBool down);
/* Standard procedure before event callbacks in Wayland */
#define WAYLAND_EVENT_OP_START(self)

View file

@ -1000,7 +1000,7 @@ static void keyboard_leave(void* data,
WAYLAND_EVENT_OP_END(self);
};
static void key_dispatch(MwLL self, int* k, MwBool down) {
void MwLLRecursiveKeyDispatch(MwLL self, int* k, MwBool down) {
if(self->common.user) {
MwWidget w = self->common.user;
int i, n;
@ -1019,7 +1019,7 @@ static void key_dispatch(MwLL self, int* k, MwBool down) {
MwLLDispatch(child, key_released, k);
}
key_dispatch(child, k, down);
MwLLRecursiveKeyDispatch(child, k, down);
}
}
}
@ -1141,7 +1141,7 @@ static void keyboard_key(void* data,
} else {
self->wayland.holding_key = MwFALSE;
}
key_dispatch(self, &key, state == WL_KEYBOARD_KEY_STATE_PRESSED);
MwLLRecursiveKeyDispatch(self, &key, state == WL_KEYBOARD_KEY_STATE_PRESSED);
self->wayland.start_time = MwTimeGetTick();
self->wayland.next_elapsed = self->wayland.keyboard_delay;
}

View file

@ -1376,11 +1376,7 @@ static int MwLLPendingImpl(MwLL handle) {
if(handle->wayland.holding_key) {
float elapsed = ((float)(handle->wayland.end_time - (float)handle->wayland.start_time));
if(elapsed >= handle->wayland.next_elapsed) {
MwLL topmost_parent = handle;
while(topmost_parent->wayland.parent) {
MwLLDispatch(topmost_parent, key, &handle->wayland.last_pressed_key);
topmost_parent = topmost_parent->wayland.parent;
}
MwLLRecursiveKeyDispatch(handle, &handle->wayland.last_pressed_key, MwTRUE);
handle->wayland.next_elapsed = elapsed + handle->wayland.keyboard_rate;
}
}