Skip to content
modkitv0.2

transfer.h

#include <modkit/transfer.h>8 functions · 4 structs · 1 enums · 9 typedefs · 4 macros

Shared MIME transfer items and asynchronous clipboard access.

Functions

mk_clipboard_read_asyncfunction

mk_result mk_clipboard_read_async(const mk_clipboard_read_desc_t *desc, mk_clipboard_read_fn callback, void *user_data, mk_async_request_t *request)

Request clipboard data in one of the preferred MIME types.

ParameterTypeDescription
descconst mk_clipboard_read_desc_t *Read options.
callbackmk_clipboard_read_fnCompletion callback.
user_datavoid *Caller context.
requestmk_async_request_t *Optional destination for the request handle.

Returns MK_SUCCESS when the request is queued, otherwise an error.

mk_clipboard_read_desc_initfunction

void mk_clipboard_read_desc_init(mk_clipboard_read_desc_t *desc)

Initialize a clipboard-read descriptor.

ParameterTypeDescription
descmk_clipboard_read_desc_t *Descriptor to initialize.

mk_clipboard_write_asyncfunction

mk_result mk_clipboard_write_async(const mk_clipboard_write_desc_t *desc, mk_clipboard_write_fn callback, void *user_data, mk_async_request_t *request)

Publish MIME-typed items to the system clipboard.

ParameterTypeDescription
descconst mk_clipboard_write_desc_t *Items to publish.
callbackmk_clipboard_write_fnCompletion callback.
user_datavoid *Caller context.
requestmk_async_request_t *Optional destination for the request handle.

Returns MK_SUCCESS when the request is queued, otherwise an error.

mk_clipboard_write_desc_initfunction

void mk_clipboard_write_desc_init(mk_clipboard_write_desc_t *desc)

Initialize a clipboard-write descriptor.

ParameterTypeDescription
descmk_clipboard_write_desc_t *Descriptor to initialize.

mk_outbound_drag_desc_initfunction

void mk_outbound_drag_desc_init(mk_outbound_drag_desc_t *desc)

Initialize an outbound-drag descriptor.

ParameterTypeDescription
descmk_outbound_drag_desc_t *Descriptor to initialize.

mk_outbound_drag_startfunction

mk_result mk_outbound_drag_start(const mk_outbound_drag_desc_t *desc)

Start an application-initiated drag operation.

ParameterTypeDescription
descconst mk_outbound_drag_desc_t *Drag description and callbacks.

Returns MK_SUCCESS when the drag starts, otherwise an error.

mk_outbound_drag_supportedfunction

bool mk_outbound_drag_supported(void)

Test whether the current platform supports outbound drag.

Returns True when supported.

mk_transfer_item_initfunction

void mk_transfer_item_init(mk_transfer_item_t *item)

Initialize a transfer item descriptor.

ParameterTypeDescription
itemmk_transfer_item_t *Item to initialize.

Structs

mk_clipboard_read_descstruct

Options for an asynchronous clipboard read.

FieldTypeDescription
struct_sizeuint32_tStructure size in bytes.
struct_versionuint32_tMK_CLIPBOARD_READ_DESC_VERSION.
mime_typesconst char *const *Acceptable MIME types in preference order.
mime_type_countuint32_tNumber of entries in mime_types.

mk_clipboard_write_descstruct

Payloads for an asynchronous clipboard write.

FieldTypeDescription
struct_sizeuint32_tStructure size in bytes.
struct_versionuint32_tMK_CLIPBOARD_WRITE_DESC_VERSION.
itemsconst mk_transfer_item_t *Items to publish.
item_countuint32_tNumber of entries in items.

mk_outbound_drag_descstruct

Description of an application-initiated drag operation.

FieldTypeDescription
struct_sizeuint32_tStructure size in bytes.
struct_versionuint32_tMK_OUTBOUND_DRAG_DESC_VERSION.
mime_typesconst char *const *MIME representations offered to targets.
mime_type_countuint32_tNumber of entries in mime_types.
allowed_actionsuint32_tORed mk_drag_action_t values.
data_providermk_drag_data_provider_fnLazily supplies a requested representation.
completion_callbackmk_outbound_drag_complete_fnReceives the final action.
user_datavoid *Caller context passed to callbacks.

mk_transfer_itemstruct

One MIME-typed clipboard or drag-and-drop payload.

FieldTypeDescription
struct_sizeuint32_tStructure size in bytes.
struct_versionuint32_tMK_TRANSFER_ITEM_VERSION.
mime_typeconst char *MIME type of the represented data.
dataconst void *Optional in-memory payload.
sizesize_tIn-memory payload size in bytes.
filemk_file_ref_t *Optional file reference payload.

Enums

mk_drag_actionenum

Actions negotiated for an outbound drag operation.

ValueDescription
MK_DRAG_ACTION_NONENo drop action.
MK_DRAG_ACTION_COPYCopy the dragged content.
MK_DRAG_ACTION_MOVEMove the dragged content.
MK_DRAG_ACTION_LINKCreate a link to the dragged content.

Typedefs

mk_clipboard_read_desc_ttypedef

typedef struct mk_clipboard_read_desc mk_clipboard_read_desc_t

Options for an asynchronous clipboard read.

mk_clipboard_read_fntypedef

typedef void(*) mk_clipboard_read_fn(mk_async_request_t request, mk_result result, const mk_transfer_item_t *items, uint32_t item_count, void *user_data)

Receive the result of an asynchronous clipboard read.

mk_clipboard_write_desc_ttypedef

typedef struct mk_clipboard_write_desc mk_clipboard_write_desc_t

Payloads for an asynchronous clipboard write.

mk_clipboard_write_fntypedef

typedef void(*) mk_clipboard_write_fn(mk_async_request_t request, mk_result result, void *user_data)

Receive the result of an asynchronous clipboard write.

mk_drag_action_ttypedef

typedef enum mk_drag_action mk_drag_action_t

Actions negotiated for an outbound drag operation.

mk_drag_data_provider_fntypedef

typedef mk_result(*) mk_drag_data_provider_fn(const char *mime_type, const void **data, size_t *size, void *user_data)

Supply one requested MIME representation during a drag.

Returns MK_SUCCESS or an error result.

mk_outbound_drag_complete_fntypedef

typedef void(*) mk_outbound_drag_complete_fn(mk_result result, mk_drag_action_t action, void *user_data)

Receive completion of an outbound drag.

mk_outbound_drag_desc_ttypedef

typedef struct mk_outbound_drag_desc mk_outbound_drag_desc_t

Description of an application-initiated drag operation.

mk_transfer_item_ttypedef

typedef struct mk_transfer_item mk_transfer_item_t

One MIME-typed clipboard or drag-and-drop payload.

Macros

MK_CLIPBOARD_READ_DESC_VERSIONdefine

MK_CLIPBOARD_READ_DESC_VERSION

ABI version for mk_clipboard_read_desc_t.

MK_CLIPBOARD_WRITE_DESC_VERSIONdefine

MK_CLIPBOARD_WRITE_DESC_VERSION

ABI version for mk_clipboard_write_desc_t.

MK_OUTBOUND_DRAG_DESC_VERSIONdefine

MK_OUTBOUND_DRAG_DESC_VERSION

ABI version for mk_outbound_drag_desc_t.

MK_TRANSFER_ITEM_VERSIONdefine

MK_TRANSFER_ITEM_VERSION

ABI version for mk_transfer_item_t.