Basic implementation of request_set_cursor
Requires moving wlr_seat initialization above cursor creation, so we can add listeners to it. Currently does no verification that the client actually has focus.
This commit is contained in:
parent
06debf11db
commit
0bdfdde29b
3 changed files with 19 additions and 2 deletions
|
@ -18,6 +18,7 @@ struct kiwmi_cursor {
|
||||||
struct wl_listener cursor_motion;
|
struct wl_listener cursor_motion;
|
||||||
struct wl_listener cursor_motion_absolute;
|
struct wl_listener cursor_motion_absolute;
|
||||||
struct wl_listener cursor_button;
|
struct wl_listener cursor_button;
|
||||||
|
struct wl_listener request_set_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kiwmi_cursor *cursor_create(
|
struct kiwmi_cursor *cursor_create(
|
||||||
|
|
|
@ -110,6 +110,17 @@ cursor_button_notify(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
request_set_cursor_notify(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct kiwmi_cursor *cursor =
|
||||||
|
wl_container_of(listener, cursor, request_set_cursor);
|
||||||
|
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
||||||
|
// FIXME: this should verify if the window has focus
|
||||||
|
wlr_cursor_set_surface(
|
||||||
|
cursor->cursor, event->surface, event->hotspot_x, event->hotspot_y);
|
||||||
|
}
|
||||||
|
|
||||||
struct kiwmi_cursor *
|
struct kiwmi_cursor *
|
||||||
cursor_create(
|
cursor_create(
|
||||||
struct kiwmi_server *server,
|
struct kiwmi_server *server,
|
||||||
|
@ -147,5 +158,10 @@ cursor_create(
|
||||||
cursor->cursor_button.notify = cursor_button_notify;
|
cursor->cursor_button.notify = cursor_button_notify;
|
||||||
wl_signal_add(&cursor->cursor->events.button, &cursor->cursor_button);
|
wl_signal_add(&cursor->cursor->events.button, &cursor->cursor_button);
|
||||||
|
|
||||||
|
cursor->request_set_cursor.notify = request_set_cursor_notify;
|
||||||
|
wl_signal_add(
|
||||||
|
&server->input.seat->events.request_set_cursor,
|
||||||
|
&cursor->request_set_cursor);
|
||||||
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,14 +71,14 @@ input_init(struct kiwmi_input *input)
|
||||||
{
|
{
|
||||||
struct kiwmi_server *server = wl_container_of(input, server, input);
|
struct kiwmi_server *server = wl_container_of(input, server, input);
|
||||||
|
|
||||||
|
input->seat = wlr_seat_create(server->wl_display, "seat-0");
|
||||||
|
|
||||||
input->cursor = cursor_create(server, server->desktop.output_layout);
|
input->cursor = cursor_create(server, server->desktop.output_layout);
|
||||||
if (!input->cursor) {
|
if (!input->cursor) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create cursor");
|
wlr_log(WLR_ERROR, "Failed to create cursor");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->seat = wlr_seat_create(server->wl_display, "seat-0");
|
|
||||||
|
|
||||||
wl_list_init(&input->keyboards);
|
wl_list_init(&input->keyboards);
|
||||||
|
|
||||||
input->new_input.notify = new_input_notify;
|
input->new_input.notify = new_input_notify;
|
||||||
|
|
Loading…
Reference in a new issue