Add support for cursor axis and frame events (#15)
For scrolling support.
This commit is contained in:
parent
5892347df4
commit
351e5ed6d7
2 changed files with 37 additions and 0 deletions
|
@ -18,6 +18,8 @@ struct kiwmi_cursor {
|
|||
struct wl_listener cursor_motion;
|
||||
struct wl_listener cursor_motion_absolute;
|
||||
struct wl_listener cursor_button;
|
||||
struct wl_listener cursor_axis;
|
||||
struct wl_listener cursor_frame;
|
||||
};
|
||||
|
||||
struct kiwmi_cursor *cursor_create(
|
||||
|
|
|
@ -110,6 +110,35 @@ cursor_button_notify(struct wl_listener *listener, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cursor_axis_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct kiwmi_cursor *cursor =
|
||||
wl_container_of(listener, cursor, cursor_axis);
|
||||
struct kiwmi_server *server = cursor->server;
|
||||
struct kiwmi_input *input = &server->input;
|
||||
struct wlr_event_pointer_axis *event = data;
|
||||
|
||||
wlr_seat_pointer_notify_axis(
|
||||
input->seat,
|
||||
event->time_msec,
|
||||
event->orientation,
|
||||
event->delta,
|
||||
event->delta_discrete,
|
||||
event->source);
|
||||
}
|
||||
|
||||
static void
|
||||
cursor_frame_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_cursor *cursor =
|
||||
wl_container_of(listener, cursor, cursor_frame);
|
||||
struct kiwmi_server *server = cursor->server;
|
||||
struct kiwmi_input *input = &server->input;
|
||||
|
||||
wlr_seat_pointer_notify_frame(input->seat);
|
||||
}
|
||||
|
||||
struct kiwmi_cursor *
|
||||
cursor_create(
|
||||
struct kiwmi_server *server,
|
||||
|
@ -147,5 +176,11 @@ cursor_create(
|
|||
cursor->cursor_button.notify = cursor_button_notify;
|
||||
wl_signal_add(&cursor->cursor->events.button, &cursor->cursor_button);
|
||||
|
||||
cursor->cursor_axis.notify = cursor_axis_notify;
|
||||
wl_signal_add(&cursor->cursor->events.axis, &cursor->cursor_axis);
|
||||
|
||||
cursor->cursor_frame.notify = cursor_frame_notify;
|
||||
wl_signal_add(&cursor->cursor->events.frame, &cursor->cursor_frame);
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue