diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-31 23:29:08 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-31 23:29:08 -0400 |
commit | 0760297633d813c415c068a41558be4ee171d235 (patch) | |
tree | 0a879641a25de5c15b4d54548ff1a443f778667a | |
parent | 0527ad8f001b9286ff3a5cb40c51345c3b56fd38 (diff) |
data-device: Handle setting a NULL selection source
-rw-r--r-- | src/data-device.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/data-device.c b/src/data-device.c index 452dc5c..5edbc17 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -388,19 +388,23 @@ wl_seat_set_selection(struct wl_seat *seat, struct wl_data_source *source, if (focus) { data_device = find_resource(&seat->drag_resource_list, focus->client); - if (data_device) { + if (data_device && source) { offer = wl_data_source_send_offer(seat->selection_data_source, data_device); wl_data_device_send_selection(data_device, offer); + } else if (data_device) { + wl_data_device_send_selection(data_device, NULL); } } wl_signal_emit(&seat->selection_signal, seat); - seat->selection_data_source_listener.notify = - destroy_selection_data_source; - wl_signal_add(&source->resource.destroy_signal, - &seat->selection_data_source_listener); + if (source) { + seat->selection_data_source_listener.notify = + destroy_selection_data_source; + wl_signal_add(&source->resource.destroy_signal, + &seat->selection_data_source_listener); + } } static void |