diff options
| author | Kristian Høgsberg <krh@bitplanet.net> | 2012-04-13 12:48:38 -0400 |
|---|---|---|
| committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-04-13 12:48:38 -0400 |
| commit | a9f951b003e024d1cfaaf79751749c65388c5937 (patch) | |
| tree | c5d6c977440b89d0b992c9b5fd5b9b7e962628f6 /src/data-device.c | |
| parent | data-device: Clear drag focus when we end the drag-and-drop (diff) | |
| download | wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar.gz wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar.bz2 wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar.lz wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar.xz wayland-a9f951b003e024d1cfaaf79751749c65388c5937.tar.zst wayland-a9f951b003e024d1cfaaf79751749c65388c5937.zip | |
data-device: Record the serial number for the current selection
And reject setting a selection that's older than our current selection.
Diffstat (limited to 'src/data-device.c')
| -rw-r--r-- | src/data-device.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/data-device.c b/src/data-device.c index b760aa6..e850f6e 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -347,10 +347,14 @@ destroy_selection_data_source(struct wl_listener *listener, void *data) WL_EXPORT void wl_input_device_set_selection(struct wl_input_device *device, - struct wl_data_source *source) + struct wl_data_source *source, uint32_t serial) { struct wl_resource *data_device, *focus, *offer; + if (device->selection_data_source && + device->selection_serial - serial < UINT32_MAX / 2) + return; + if (device->selection_data_source) { device->selection_data_source->cancel(device->selection_data_source); wl_list_remove(&device->selection_data_source_listener.link); @@ -358,6 +362,7 @@ wl_input_device_set_selection(struct wl_input_device *device, } device->selection_data_source = source; + device->selection_serial = serial; focus = device->keyboard_focus_resource; if (focus) { @@ -387,7 +392,8 @@ data_device_set_selection(struct wl_client *client, return; /* FIXME: Store serial and check against incoming serial here. */ - wl_input_device_set_selection(resource->data, source_resource->data); + wl_input_device_set_selection(resource->data, source_resource->data, + serial); } static const struct wl_data_device_interface data_device_interface = { |
