aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/data_device/wlr_data_device.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/types/data_device/wlr_data_device.c b/types/data_device/wlr_data_device.c
index 208d2f3e..385ad9a6 100644
--- a/types/data_device/wlr_data_device.c
+++ b/types/data_device/wlr_data_device.c
@@ -145,16 +145,14 @@ static void seat_handle_selection_source_destroy(
struct wl_listener *listener, void *data) {
struct wlr_seat *seat =
wl_container_of(listener, seat, selection_source_destroy);
- struct wlr_seat_client *seat_client = seat->keyboard_state.focused_client;
wl_list_remove(&seat->selection_source_destroy.link);
seat->selection_source = NULL;
- if (seat_client && seat->keyboard_state.focused_surface) {
- struct wl_resource *resource;
- wl_resource_for_each(resource, &seat_client->data_devices) {
- wl_data_device_send_selection(resource, NULL);
- }
+ struct wlr_seat_client *focused_client =
+ seat->keyboard_state.focused_client;
+ if (focused_client != NULL) {
+ seat_client_send_selection(focused_client);
}
wlr_signal_emit_safe(&seat->events.set_selection, seat);
@@ -171,12 +169,6 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
seat->selection_source = source;
seat->selection_serial = serial;
- struct wlr_seat_client *focused_client =
- seat->keyboard_state.focused_client;
- if (focused_client) {
- seat_client_send_selection(focused_client);
- }
-
if (source) {
seat->selection_source_destroy.notify =
seat_handle_selection_source_destroy;
@@ -184,6 +176,12 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
&seat->selection_source_destroy);
}
+ struct wlr_seat_client *focused_client =
+ seat->keyboard_state.focused_client;
+ if (focused_client) {
+ seat_client_send_selection(focused_client);
+ }
+
wlr_signal_emit_safe(&seat->events.set_selection, seat);
}