Open and close a visual
Name
ggiOpen, ggiClose : Open and close a visual
Synopsis
#include <ggi/ggi.h> int ggiOpen(ggi_visual_t vis, const char *display, ...); int ggiClose(ggi_visual_t vis);
Description
ggiOpen opens a visual. vis is a stem created by ggNewStem(3). The visual is specified as a display string, followed by NULL. If only NULL is specified, the default display target is opened, which means first examining GGI_DISPLAY, then invoking display-auto. The other arguments are for internal purposes only, such as argptr, used to pass driver-specific, non-textual information to the driver.
ggiClose releases and destroys an open visual. This will close X windows, return consoles to text-mode, etc.
Return value
ggiOpen returns 0 for OK, otherwise a gg-error(3) code.
ggiClose returns 0 for OK, otherwise a gg-error(3) code.
Examples
Open and closing default visual:
int err; ggi_visual_t vis; vis = ggNewStem(libggi, NULL); if (vis == NULL) { ggPanic("Couldn't create stem!\n"); } err = ggiOpen(vis, NULL); if (err != GGI_OK) { ggPanic("Couldn't open default visual!\n"); } /* do stuff */ err = ggiClose(vis); if (err != GGI_OK) { ggPanic("Couldn't close default visual!\n"); } ggDelStem(vis); ggExit();
Open and closing a memory visual:
int err; ggi_visual_t memvis; memvis = ggNewStem(libggi, NULL); if (memvis == NULL) { ggPanic("Could not create stem!\n"); } err = ggiOpen(memvis, "display-memory", NULL); if (err != GGI_OK) { return -1; } /* do stuff */ err = ggiClose(memvis); if (err != GGI_OK) { return -1; } ggDelStem(memvis); ggExit();