client

client — Client connection to FEP server

Synopsis

                    FepClient;
                    FepEvent;
int                 (*FepEventFilter)                   (FepEvent *event,
                                                         void *data);
                    FepEventKey;
                    FepEventResize;
enum                FepEventType;
void                fep_client_close                    (FepClient *client);
int                 fep_client_dispatch                 (FepClient *client);
int                 fep_client_get_poll_fd              (FepClient *client);
FepClient *         fep_client_open                     (const char *address);
void                fep_client_send_data                (FepClient *client,
                                                         const char *data,
                                                         size_t length);
void                fep_client_send_text                (FepClient *client,
                                                         const char *text);
void                fep_client_set_cursor_text          (FepClient *client,
                                                         const char *text,
                                                         FepAttribute *attr);
void                fep_client_set_event_filter         (FepClient *client,
                                                         FepEventFilter filter,
                                                         void *data);
void                fep_client_set_status_text          (FepClient *client,
                                                         const char *text,
                                                         FepAttribute *attr);

Description

Details

FepClient

typedef struct _FepClient FepClient;

FepEvent

typedef struct {
  FepEventType type;
} FepEvent;

FepEventType type;

type of the event

FepEventFilter ()

int                 (*FepEventFilter)                   (FepEvent *event,
                                                         void *data);

FepEventKey

typedef struct {
  FepEvent event;
  unsigned int keyval;
  FepModifierType modifiers;
} FepEventKey;

FepEvent event;

base event struct

unsigned int keyval;

keysym value

FepModifierType modifiers;

modifier mask

FepEventResize

typedef struct {
  FepEvent event;
  unsigned int cols;
  unsigned int rows;
} FepEventResize;

FepEvent event;

base event struct

unsigned int cols;

number of columns

unsigned int rows;

number of rows

enum FepEventType

typedef enum {
    FEP_NOTHING = -1,
    FEP_KEY_PRESS = 0,
    FEP_RESIZED = 1
} FepEventType;

FEP_NOTHING

Nothing happend; used to indicate error

FEP_KEY_PRESS

Key is pressed

FEP_RESIZED

Window is resized

fep_client_close ()

void                fep_client_close                    (FepClient *client);

Close the control socket and release the memory allocated for client.

client :

a FepClient

fep_client_dispatch ()

int                 fep_client_dispatch                 (FepClient *client);

Dispatch a request from server.

client :

a FepClient

Returns :

0 on success, -1 on failure.

fep_client_get_poll_fd ()

int                 fep_client_get_poll_fd              (FepClient *client);

Get the file descriptor of the control socket which can be used by poll().

client :

a FepClient

Returns :

a file descriptor

fep_client_open ()

FepClient *         fep_client_open                     (const char *address);

Connect to the FEP server running at address. If address is NULL, it gets the address from the environment variable `LIBFEP_CONTROL_SOCK`.

address :

socket address of the FEP server. [allow-none]

Returns :

a new FepClient.

fep_client_send_data ()

void                fep_client_send_data                (FepClient *client,
                                                         const char *data,
                                                         size_t length);

Request to send data to the child process of the FEP server.

client :

a FepClient

data :

data to be sent

length :

length of data

fep_client_send_text ()

void                fep_client_send_text                (FepClient *client,
                                                         const char *text);

Request to send text to the child process of the FEP server. text will be converted from UTF-8 to the local encoding in the server.

client :

a FepClient

text :

text to be sent

fep_client_set_cursor_text ()

void                fep_client_set_cursor_text          (FepClient *client,
                                                         const char *text,
                                                         FepAttribute *attr);

Request to display text at the cursor position on the terminal.

client :

a FepClient

text :

a cursor text

attr :

a FepAttribute

fep_client_set_event_filter ()

void                fep_client_set_event_filter         (FepClient *client,
                                                         FepEventFilter filter,
                                                         void *data);

Set a key event filter which will be called when client receives key events.

client :

a FepClient

filter :

a filter function

data :

user supplied data

fep_client_set_status_text ()

void                fep_client_set_status_text          (FepClient *client,
                                                         const char *text,
                                                         FepAttribute *attr);

Request to display text at the bottom of the terminal.

client :

a FepClient

text :

a status text

attr :

a FepAttribute