wlr-seat: selection signal

This commit is contained in:
Tony Crisci 2017-10-16 05:07:09 -04:00
parent fb25adae36
commit 34f27ff691
3 changed files with 12 additions and 3 deletions

View File

@ -132,6 +132,8 @@ struct wlr_seat {
struct wl_signal keyboard_grab_end; struct wl_signal keyboard_grab_end;
struct wl_signal request_set_cursor; struct wl_signal request_set_cursor;
struct wl_signal selection;
} events; } events;
void *data; void *data;

View File

@ -283,11 +283,16 @@ static void seat_handle_selection_data_source_destroy(
struct wlr_seat *seat = struct wlr_seat *seat =
wl_container_of(listener, seat, selection_data_source_destroy); wl_container_of(listener, seat, selection_data_source_destroy);
// TODO send null selection to focused keyboard if (seat->keyboard_state.focused_handle &&
seat->keyboard_state.focused_surface &&
seat->keyboard_state.focused_handle->data_device) {
wl_data_device_send_selection(
seat->keyboard_state.focused_handle->data_device, NULL);
}
seat->selection_source = NULL; seat->selection_source = NULL;
// TODO emit selection signal wl_signal_emit(&seat->events.selection, seat);
} }
void wlr_seat_set_selection(struct wlr_seat *seat, void wlr_seat_set_selection(struct wlr_seat *seat,
@ -313,7 +318,7 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
wlr_seat_handle_send_selection(focused_handle); wlr_seat_handle_send_selection(focused_handle);
} }
// TODO emit selection signal wl_signal_emit(&seat->events.selection, seat);
if (source) { if (source) {
seat->selection_data_source_destroy.notify = seat->selection_data_source_destroy.notify =

View File

@ -309,7 +309,9 @@ 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_bound);
wl_signal_init(&wlr_seat->events.client_unbound); wl_signal_init(&wlr_seat->events.client_unbound);
wl_signal_init(&wlr_seat->events.request_set_cursor); wl_signal_init(&wlr_seat->events.request_set_cursor);
wl_signal_init(&wlr_seat->events.selection);
wl_signal_init(&wlr_seat->events.pointer_grab_begin); wl_signal_init(&wlr_seat->events.pointer_grab_begin);
wl_signal_init(&wlr_seat->events.pointer_grab_end); wl_signal_init(&wlr_seat->events.pointer_grab_end);