mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
Add request_set_cursor event
This commit is contained in:
parent
3f4ccd0558
commit
78d3582b70
2 changed files with 30 additions and 6 deletions
|
@ -125,11 +125,20 @@ struct wlr_seat {
|
|||
|
||||
struct wl_signal keyboard_grab_begin;
|
||||
struct wl_signal keyboard_grab_end;
|
||||
|
||||
struct wl_signal request_set_cursor;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_seat_pointer_request_set_cursor_event {
|
||||
struct wl_client *client;
|
||||
struct wlr_seat_handle *seat_handle;
|
||||
struct wlr_surface *surface;
|
||||
int32_t hotspot_x, hotspot_y;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocates a new wlr_seat and adds a wl_seat global to the display.
|
||||
*/
|
||||
|
|
|
@ -20,12 +20,26 @@ static void pointer_send_frame(struct wl_resource *resource) {
|
|||
}
|
||||
|
||||
static void wl_pointer_set_cursor(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t serial,
|
||||
struct wl_resource *surface,
|
||||
int32_t hotspot_x,
|
||||
int32_t hotspot_y) {
|
||||
wlr_log(L_DEBUG, "TODO: wl_pointer_set_cursor");
|
||||
struct wl_resource *resource, uint32_t serial,
|
||||
struct wl_resource *surface_resource,
|
||||
int32_t hotspot_x, int32_t hotspot_y) {
|
||||
struct wlr_seat_handle *handle = wl_resource_get_user_data(resource);
|
||||
struct wlr_surface *surface = wl_resource_get_user_data(surface_resource);
|
||||
|
||||
struct wlr_seat_pointer_request_set_cursor_event *event =
|
||||
calloc(1, sizeof(struct wlr_seat_pointer_request_set_cursor_event));
|
||||
if (event == NULL) {
|
||||
return;
|
||||
}
|
||||
event->client = client;
|
||||
event->seat_handle = handle;
|
||||
event->surface = surface;
|
||||
event->hotspot_x = hotspot_x;
|
||||
event->hotspot_y = hotspot_y;
|
||||
|
||||
wl_signal_emit(&handle->wlr_seat->events.request_set_cursor, event);
|
||||
|
||||
free(event);
|
||||
}
|
||||
|
||||
static const struct wl_pointer_interface wl_pointer_impl = {
|
||||
|
@ -285,6 +299,7 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
|
||||
wl_signal_init(&wlr_seat->events.client_bound);
|
||||
wl_signal_init(&wlr_seat->events.client_unbound);
|
||||
wl_signal_init(&wlr_seat->events.request_set_cursor);
|
||||
|
||||
wl_signal_init(&wlr_seat->events.pointer_grab_begin);
|
||||
wl_signal_init(&wlr_seat->events.pointer_grab_end);
|
||||
|
|
Loading…
Reference in a new issue