feat: implement keyboard and mouse input, pattern placement, and HiDPI scaling
Add configurable key bindings (TOML), modifier-aware dispatch, mouse-driven pattern placement with preview and rotation, cell grid storage/rendering, and fractional/integer HiDPI scaling. Archive the input-and-placement change and sync its specs to main specs. Tests: Hashtable, Config, Grid, Pattern (4/4 pass).
This commit is contained in:
+17
-2
@@ -21,12 +21,17 @@ static void pointer_leave_handler(void *data, struct wl_pointer *pointer, uint32
|
||||
|
||||
static void pointer_motion_handler(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
|
||||
{
|
||||
// not implemented
|
||||
struct pointer_data *pd = data;
|
||||
pd->x = wl_fixed_to_double(sx);
|
||||
pd->y = wl_fixed_to_double(sy);
|
||||
}
|
||||
|
||||
static void pointer_button_handler(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
|
||||
{
|
||||
// not implemented
|
||||
struct pointer_data *pd = data;
|
||||
if (pd->button_handler) {
|
||||
pd->button_handler(button, state, pd->x, pd->y, pd->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void pointer_axis_handler(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
|
||||
@@ -66,8 +71,18 @@ const struct wl_pointer_listener pointer_listener = {
|
||||
.axis_stop = pointer_axis_stop_handler,
|
||||
};
|
||||
|
||||
void pointer_set_button_handler(struct pointer_data *pointer_data, pointer_button_handler_t handler, void *user_data)
|
||||
{
|
||||
pointer_data->button_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;
|
||||
pointer_data->y = 0;
|
||||
pointer_data->button_handler = NULL;
|
||||
pointer_data->user_data = NULL;
|
||||
pointer_data->cursor_theme =
|
||||
wl_cursor_theme_load(NULL, 24, shm);
|
||||
pointer_data->cursor = wl_cursor_theme_get_cursor(pointer_data->cursor_theme, "left_ptr");
|
||||
|
||||
Reference in New Issue
Block a user