Enable the LibGGIBuf API on a LibGGI visual

Name

ggiBufAttach, ggiBufDetach : Enable the LibGGIBuf API on a LibGGI visual

Synopsis

#include <ggi/buf.h>

int ggiBufAttach(ggi_visual_t vis, ggiGA_resource_list *reqlist);

int ggiBufDetach(ggi_visual_t vis);

Description

ggiBufAttach extends the visual vis such that the LibGGIBuf API may be used on the visual handle. This function must be called before using other LibGGIBuf functions on the visual handle. The parameter reslist is a pointer to a LibGAlloc resource list kept by the application, and such an object must exist and be passed to ggiBltAttach(3) in order to use the simple-form ggiBufCreate* functions.

ggiBufDetach cleans up all state associated with using the LibGGIBuf API on the visual vis. The visual is stripped of any active buffers. Note, however, that the buffers are not themselves currently guaranteed to be destroyed and may still exist as objects, consuming resources. Behavior of these objects is at this point undefined. They should be destroyed before calling ggiBufDetach.

Return Value

Both functions return 0 for OK, otherwise an error code.

Examples

Activate LibBuf such that the ggiBufCreate* functions work:

ggiGA_resource_list reslist;
reslist = NULL;
ggiBufInit();
ggiBufAttach(vis, &reslist);

/* Do some libbuf stuff */

ggiBufDetach(vis);
ggiBufExit();