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 /src/data-device.c | |
| parent | data-device: Emit selection_signal also when we lose the selection (diff) | |
| download | wayland-0760297633d813c415c068a41558be4ee171d235.tar wayland-0760297633d813c415c068a41558be4ee171d235.tar.gz wayland-0760297633d813c415c068a41558be4ee171d235.tar.bz2 wayland-0760297633d813c415c068a41558be4ee171d235.tar.lz wayland-0760297633d813c415c068a41558be4ee171d235.tar.xz wayland-0760297633d813c415c068a41558be4ee171d235.tar.zst wayland-0760297633d813c415c068a41558be4ee171d235.zip | |
data-device: Handle setting a NULL selection source
Diffstat (limited to 'src/data-device.c')
| -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 |
