Two new helpers which are needed to implement copy-support. They create
data-sources and set the current selection-source. This allows widgets to
copy data for others to paste.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
return p[0];
}
+int wlt_display_new_data_source(struct wlt_display *disp,
+ struct wl_data_source **out)
+{
+ struct wl_data_source *src;
+
+ if (!disp)
+ return -EINVAL;
+
+ src = wl_data_device_manager_create_data_source(disp->w_manager);
+ if (!src)
+ return -EFAULT;
+
+ *out = src;
+ return 0;
+}
+
+void wlt_display_set_selection(struct wlt_display *disp,
+ struct wl_data_source *selection)
+{
+ if (!disp)
+ return;
+
+ wl_data_device_set_selection(disp->w_data_dev, selection,
+ disp->last_serial);
+}
+
static const struct wl_data_device_listener data_dev_listener = {
.data_offer = data_dev_data_offer,
.enter = data_dev_enter,
int wlt_display_get_selection_fd(struct wlt_display *disp, const char *mime);
int wlt_display_get_selection_to_fd(struct wlt_display *disp, const char *mime,
int output_fd);
+int wlt_display_new_data_source(struct wlt_display *disp,
+ struct wl_data_source **out);
+void wlt_display_set_selection(struct wlt_display *disp,
+ struct wl_data_source *selection);
void wlt_window_ref(struct wlt_window *wnd);
void wlt_window_unref(struct wlt_window *wnd);