GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Functions
gp_clipboard.h File Reference

A clipboard support for backends. More...

#include <backends/gp_types.h>

Go to the source code of this file.

Functions

int gp_backend_clipboard (gp_backend *self, gp_clipboard *op)
 An internal handler that implements clipboard operations.
 
static int gp_backend_clipboard_set (gp_backend *self, const char *str, size_t len)
 Sets the clipboard data.
 
static int gp_backend_clipboard_request (gp_backend *self)
 Requests clipboard data to be retrieved.
 
static char * gp_backend_clipboard_get (gp_backend *self)
 Returns clipboard data.
 
static void gp_backend_clipboard_ready (gp_backend *self)
 Pushes clipboard data ready event into a backend input queue.
 

Detailed Description

A clipboard support for backends.

Clipboard is, by definition, asynchronous. Setting or getting a clipboard data in most cases requires roundtrip to a server.

Getting the clipboard data starts by sending a clipboard request. Once clipboard data are ready the application will get an GP_EV_SYS_CLIPBOARD event and the data can be retrieved by calling the clipboard get function.

Definition in file gp_clipboard.h.

Function Documentation

◆ gp_backend_clipboard()

int gp_backend_clipboard ( gp_backend self,
gp_clipboard *  op 
)

An internal handler that implements clipboard operations.

Use the static inline functions instead!

Parameters
selfA backend.
opProperly filled gp_clipboard structure.
Returns
Zero on success non-zero otherwise.

Referenced by gp_backend_clipboard_get(), gp_backend_clipboard_request(), and gp_backend_clipboard_set().

◆ gp_backend_clipboard_get()

static char * gp_backend_clipboard_get ( gp_backend self)
inlinestatic

Returns clipboard data.

The data has to be request by the gp_backend_clipboard_request() first and are ready only after clipboard event arrives to the backend event queue.

Parameters
selfA backend.
Returns
A clipboard data in a buffer allocated by malloc() or a NULL in a case of a failure.

Definition at line 95 of file gp_clipboard.h.

References gp_backend_clipboard().

◆ gp_backend_clipboard_ready()

static void gp_backend_clipboard_ready ( gp_backend self)
inlinestatic

Pushes clipboard data ready event into a backend input queue.

This is used by the backend to inform the application that clipboard data have been retrieved from the server.

Parameters
selfA backend.

Definition at line 112 of file gp_clipboard.h.

References gp_ev_queue_push(), GP_EV_SYS, and GP_EV_SYS_CLIPBOARD.

◆ gp_backend_clipboard_request()

static int gp_backend_clipboard_request ( gp_backend self)
inlinestatic

Requests clipboard data to be retrieved.

Parameters
selfA backend.
Returns
Zero on success non-zero otherwise.

Definition at line 77 of file gp_clipboard.h.

References gp_backend_clipboard().

◆ gp_backend_clipboard_set()

static int gp_backend_clipboard_set ( gp_backend self,
const char *  str,
size_t  len 
)
inlinestatic

Sets the clipboard data.

Parameters
selfA backend.
strAn string buffer to copy the clipboard data from.
lenOptional lenght to limit the string lenght. If set to zero whole string is used.
Returns
Zero on success non-zero otherwise.

Definition at line 59 of file gp_clipboard.h.

References gp_backend_clipboard().