d20f4d5481
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.
36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
#ifndef TPOINTER_H_
|
|
#define TPOINTER_H_
|
|
|
|
#include <wayland-client.h>
|
|
#include <wayland-cursor.h>
|
|
|
|
|
|
typedef void (*pointer_button_handler_t)(uint32_t button, uint32_t state, double x, double y, void *user_data);
|
|
typedef void (*pointer_motion_handler_t)(double x, double y, void *user_data);
|
|
|
|
struct pointer_data {
|
|
struct wl_cursor_theme *cursor_theme;
|
|
struct wl_pointer *pointer;
|
|
struct wl_surface *cursor_surface;
|
|
struct wl_cursor *cursor;
|
|
struct wl_cursor_image *cursor_image;
|
|
struct wl_buffer *cursor_buffer;
|
|
|
|
double x;
|
|
double y;
|
|
|
|
pointer_button_handler_t button_handler;
|
|
pointer_motion_handler_t motion_handler;
|
|
void *user_data;
|
|
};
|
|
|
|
extern const struct wl_pointer_listener pointer_listener;
|
|
|
|
void pointer_init_cursor(struct pointer_data *pointer_data, struct wl_compositor *compositor, struct wl_shm *shm);
|
|
|
|
void pointer_set_button_handler(struct pointer_data *pointer_data, pointer_button_handler_t handler, void *user_data);
|
|
|
|
void pointer_set_motion_handler(struct pointer_data *pointer_data, pointer_motion_handler_t handler, void *user_data);
|
|
|
|
#endif
|