From 34f27ff691d046355d68c7d6a2e0dfb438bd7755 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Mon, 16 Oct 2017 05:07:09 -0400 Subject: [PATCH] wlr-seat: selection signal --- include/wlr/types/wlr_seat.h | 2 ++ types/wlr_data_device.c | 11 ++++++++--- types/wlr_seat.c | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 88d42112..cc7a5927 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -132,6 +132,8 @@ struct wlr_seat { struct wl_signal keyboard_grab_end; struct wl_signal request_set_cursor; + + struct wl_signal selection; } events; void *data; diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index d5782830..d992424a 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -283,11 +283,16 @@ static void seat_handle_selection_data_source_destroy( struct wlr_seat *seat = 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; - // TODO emit selection signal + wl_signal_emit(&seat->events.selection, 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); } - // TODO emit selection signal + wl_signal_emit(&seat->events.selection, seat); if (source) { seat->selection_data_source_destroy.notify = diff --git a/types/wlr_seat.c b/types/wlr_seat.c index 162f97b9..1285f2ee 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -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_unbound); + 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_end);