fix(input): honor pointer entry position and make clear work

Pointer enter ignored the surface position, so the pattern preview
rendered at a stale cell until the first motion event. The clear
action only printed a message and toggle_grid had no default key
binding, leaving both unreachable without a hand-written config.

Set the cursor position from the enter event, implement clear via
grid_clear plus a dirty flag, and add g/c default bindings in both
the built-in table and the generated config template. Also defer
wl_buffer destruction on resize until the compositor releases it,
route pointer motion through a handler hook instead of reading
pointer_data directly, and clean up dead code (show_lines, unused
ternary, unchecked ftruncate, unfreed grid buffers). Fixes a
wl_callback proxy leak from frame-callback overwrite. Syncs the
keyboard-bindings and display-scaling specs and archives the
fix-review-findings change.
This commit is contained in:
2026-11-11 18:04:50 +01:00
parent 2bd0b29bf1
commit d20f4d5481
15 changed files with 102 additions and 29 deletions
+11
View File
@@ -7,6 +7,8 @@ static void pointer_enter_handler(void *data, struct wl_pointer *pointer, uint32
// not implemented
printf("pointer_enter\n");
struct pointer_data *pointer_data = data;
pointer_data->x = wl_fixed_to_double(sx);
pointer_data->y = wl_fixed_to_double(sy);
wl_pointer_set_cursor(pointer, serial, pointer_data->cursor_surface,
pointer_data->cursor_image->hotspot_x, pointer_data->cursor_image->hotspot_y);
@@ -24,6 +26,9 @@ static void pointer_motion_handler(void *data, struct wl_pointer *pointer, uint3
struct pointer_data *pd = data;
pd->x = wl_fixed_to_double(sx);
pd->y = wl_fixed_to_double(sy);
if (pd->motion_handler) {
pd->motion_handler(pd->x, pd->y, pd->user_data);
}
}
static void pointer_button_handler(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
@@ -77,6 +82,12 @@ void pointer_set_button_handler(struct pointer_data *pointer_data, pointer_butto
pointer_data->user_data = user_data;
}
void pointer_set_motion_handler(struct pointer_data *pointer_data, pointer_motion_handler_t handler, void *user_data)
{
pointer_data->motion_handler = handler;
pointer_data->user_data = user_data;
}
void pointer_init_cursor(struct pointer_data *pointer_data, struct wl_compositor *compositor, struct wl_shm *shm)
{
pointer_data->x = 0;