X11workbench Toolkit  1.0
Clipboard and Selections

Functions

void * WBGetClipboardData (Display *pDisplay, Atom *paType, int *piFormat, unsigned long *pnData)
 Get clipboard data of requested type. More...
 
int WBSetClipboardData (Display *pDisplay, Atom aType, int iFormat, const void *pData, unsigned long nData)
 Get clipboard data of requested type. More...
 
void * WBGetSelectionData (Display *pDisplay, Atom aSelection, Atom *paType, int *piFormat, unsigned long *pnData)
 Get clipboard data of requested type. More...
 
int WBSetSelectionData (Display *pDisplay, Atom aSelection, Atom aType, int iFormat, const void *pData, unsigned long nData)
 Get clipboard data of requested type. More...
 

Detailed Description

Clipboard and generic 'Selection' helper functions. Use these to copy data to/from the clipboard or other 'selection'. They will process the requests asynchronously in a thread, returning results in a convenient format. This avoids the unnecessary complexity of processing inner message loops and allows for completion callback functions and messages.

Function Documentation

◆ WBGetClipboardData()

void* WBGetClipboardData ( Display *  pDisplay,
Atom *  paType,
int *  piFormat,
unsigned long *  pnData 
)

Get clipboard data of requested type.

Parameters
pDisplaythe Display pointer for the selection (NULL for default)
paTypePointer to an atom indicating the requested data type ('None' for ANY), and returning the actual data type
piFormatpointer to the returned format (0, 8, 16, or 32)
pnDatathe size of the returned data (number of items, based on *piFormat)
Returns
a pointer to the actual data (must use 'WBFree()' to de-allocate the resource)

This function will obtain the clipboard data associated with the specified data type, or whichever data it finds first if 'None' is specified as 'paType'. Some substitutions may occur, such as 'XA_TEXT' vs 'UTF8' (for example), if data in the requested format is not available. The returned value is a pointer to the actual data of size '*pnData' 'items' (which have a bit length as specified by '*piFormat'). You must call 'WBFree()' to release the resource once you are done with it.

Header File: window_helper.h

Definition at line 1842 of file clipboard_helper.c.

◆ WBGetSelectionData()

void* WBGetSelectionData ( Display *  pDisplay,
Atom  aSelection,
Atom *  paType,
int *  piFormat,
unsigned long *  pnData 
)

Get clipboard data of requested type.

Parameters
pDisplaythe Display pointer for the selection (NULL for default)
aSelectionan Atom for the 'selection' data to acquire (usually 'CLIPBOARD' or XA_PRIMARY)
paTypePointer to an atom indicating the requested data type ('None' for ANY), and returning the actual data type
piFormatpointer to the returned format (0, 8, 16, or 32)
pnDatathe size of the returned data (number of items, based on *piFormat)
Returns
a pointer to the actual data (must use 'WBFree()' to de-allocate the resource)

This function will obtain the selection data associated with the target and specified data type, or whichever data it finds first if 'None' is specified as 'paType'. Some substitutions may occur, such as 'XA_TEXT' vs 'UTF8' (for example), if data in the requested format is not available. The returned value is a pointer to the actual data of size '*pnData' 'items' (which have a bit length as specified by '*piFormat'). You must call 'WBFree()' to release the resource once you are done with it.

Header File: window_helper.h

Definition at line 1856 of file clipboard_helper.c.

◆ WBSetClipboardData()

int WBSetClipboardData ( Display *  pDisplay,
Atom  aType,
int  iFormat,
const void *  pData,
unsigned long  nData 
)

Get clipboard data of requested type.

Parameters
pDisplaythe Display pointer for the selection (NULL for default)
aTypean atom indicating the data type
iFormatthe data format (0, 8, 16, or 32)
pDataa pointer to the data to be assigned (can be NULL, indicating you want to clear it)
nDatathe size of the data (number of items, based on iFormat)
Returns
a value of zero on success, or non-zero on error

This function assigns the clipboard data for the specified type ('aType') and format ('iFormat') to the data specified by 'pData' and 'nData'.

Header File: window_helper.h

Definition at line 1849 of file clipboard_helper.c.

◆ WBSetSelectionData()

int WBSetSelectionData ( Display *  pDisplay,
Atom  aSelection,
Atom  aType,
int  iFormat,
const void *  pData,
unsigned long  nData 
)

Get clipboard data of requested type.

Parameters
pDisplaythe Display pointer for the selection (NULL for default)
aSelectionan Atom for the 'selection' data to assign (usually 'CLIPBOARD' or XA_PRIMARY)
aTypean atom indicating the data type
iFormatthe data format (0, 8, 16, or 32)
pDataa pointer to the data to be assigned (can be NULL, indicating you want to clear it)
nDatathe size of the data (number of items, based on iFormat)
Returns
a value of zero on success, or non-zero on error

This function assigns the selection data for the specified target 'aSelection' and type ('aType') and format ('iFormat') to the data specified by 'pData' and 'nData'.

Header File: window_helper.h

Definition at line 2061 of file clipboard_helper.c.