Open, join, split and close inputs

Name

giiOpen, giiClose : Open, join, split and close inputs

Synopsis

#include <ggi/gii.h>

int giiOpen(gii_input inp, const char *input, void *argptr);

int giiClose(gii_input inp, uint32_t source);

Description

giiOpen opens and adds one or more sources to an input inp. This function is given the name of an input driver to load. Passing NULL here results in an auto-select mechanism, which currently means examining the contents of GII_INPUT.

The optional arguments are a NULL-terminated list of pointers, which are used to give additional information to the targets. Currently only the first pointer is specified: void * argptr, a pointer to a library-specific struct. It is used to pass parameters that are not easily transferable in textual form.

Parameters which can be represented in text format are usually transfered in the input parameter, in the format: 'library_name:arguments'

giiClose closes the given source from the input inp. If source is GII_EV_TARGET_ALL, all sources are closed.

Return value

giiOpen returns the number of added sources, 0 for none or an error code.

giiClose returns GGI_OK (== 0) on success, otherwise an gg-error(3) code.

Examples

GII input management:

gii_input inp;
int rc;

inp = ggNewStem(libgii, NULL);
if (inp == NULL) {
  exit(EXIT_FAILURE);
}

/* Open the nulldevice for testing ... */
rc = giiOpen(inp, "input-null", NULL);
if (rc < 0) {
    ggDelStem(inp);
    exit(EXIT_FAILURE);
}

/* Open stdin for testing ... */
rc = giiOpen(inp, "input-stdin", NULL);
if (rc < 0) {
    ggDelStem(inp);
    exit(EXIT_FAILURE);
}

/* Open evdev for testing ... */
rc = giiOpen(inp, "input-linux-evdev", NULL);
if (rc < 0) {
    ggDelStem(inp);
    exit(EXIT_FAILURE);
}

/* ... do the real work here ... */

giiClose(inp);

/* Now close down LibGII. */
ggDelStem(inp);
ggExit();

See Also