Documentation for <wlr/types/wlr_primary_selection.h>

Back to index

Table of contents

struct wlr_primary_selection_source

struct wlr_primary_selection_source {
	const struct wlr_primary_selection_source_impl *impl;
	
	// source metadata
	struct wl_array mime_types;
	
	struct {
		struct wl_signal destroy;
	} events;
	
	void *data;
};

A source is the sending side of a selection.

wlr_primary_selection_source_destroy()

void wlr_primary_selection_source_destroy(​struct wlr_primary_selection_source *source);

struct wlr_primary_selection_source_impl

struct wlr_primary_selection_source_impl {
	void (*send)(​struct wlr_primary_selection_source *source, const char *mime_type, int fd);
	void (*destroy)(​struct wlr_primary_selection_source *source);
};

A data source implementation. Only the `send` function is mandatory.

wlr_primary_selection_source_init()

void wlr_primary_selection_source_init(​struct wlr_primary_selection_source *source, const struct wlr_primary_selection_source_impl *impl);

wlr_primary_selection_source_send()

void wlr_primary_selection_source_send(​struct wlr_primary_selection_source *source, const char *mime_type, int fd);

wlr_seat_request_set_primary_selection()

void wlr_seat_request_set_primary_selection(​struct wlr_seat *seat, struct wlr_seat_client *client, struct wlr_primary_selection_source *source, uint32_t serial);

Request setting the primary selection. If `client` is not null, then the serial will be checked against the set of serials sent to the client on that seat.

wlr_seat_set_primary_selection()

void wlr_seat_set_primary_selection(​struct wlr_seat *seat, struct wlr_primary_selection_source *source, uint32_t serial);

Sets the current primary selection for the seat. NULL can be provided to clear it. This removes the previous one if there was any. In case the selection doesn't come from a client, wl_display_next_serial() can be used to generate a serial.