2024-06-02 19:29:26 +02:00
|
|
|
#ifndef TPOINTER_H_
|
|
|
|
|
#define TPOINTER_H_
|
|
|
|
|
|
|
|
|
|
#include <wayland-client.h>
|
|
|
|
|
#include <wayland-cursor.h>
|
|
|
|
|
|
|
|
|
|
|
2026-11-08 14:46:04 +01:00
|
|
|
typedef void (*pointer_button_handler_t)(uint32_t button, uint32_t state, double x, double y, void *user_data);
|
|
|
|
|
|
2024-06-02 19:29:26 +02:00
|
|
|
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;
|
2026-11-08 14:46:04 +01:00
|
|
|
|
|
|
|
|
double x;
|
|
|
|
|
double y;
|
|
|
|
|
|
|
|
|
|
pointer_button_handler_t button_handler;
|
|
|
|
|
void *user_data;
|
2024-06-02 19:29:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2026-11-08 14:46:04 +01:00
|
|
|
void pointer_set_button_handler(struct pointer_data *pointer_data, pointer_button_handler_t handler, void *user_data);
|
|
|
|
|
|
2024-06-02 19:29:26 +02:00
|
|
|
#endif
|