ggiSetFlags

Name

ggiSetFlags, ggiGetFlags, ggiAddFlags, ggiRemoveFlags -- Set or get flags affecting operation on a visual

Synopsis

#include <ggi/ggi.h>

int ggiSetFlags(ggi_visual_t vis, ggi_flags flags);

ggi_flags ggiGetFlags(ggi_visual_t vis);

int ggiAddFlags(ggi_visual_t vis, ggi_flags flags);

int ggiRemoveFlags(ggi_visual_t vis, ggi_flags flags);

Description

ggiSetFlags sets the specified flags (bitwise OR'd together) on a visual. This function is usually used to set async mode on a visual (see below).

ggiGetFlags obtains the flags currently in effect.

ggiAddFlags and ggiRemoveFlags are macros that set or unsets the specified flags.

Return Value

ggiSetFlags, ggiAddFlags, and ggiRemoveFlags return 0 on success, <0 on failure.

ggiGetFlags returns the current flags.

Synchronous and Asynchronous drawing modes

Some visuals allow different modes with regard to when the screen is updated and the actual drawing takes place.

Warning

On some targets such as the X target there is no real synchronous mode, so LibGGI fakes one by periodically calling ggiFlush in the background. This process can take about half the execution time of a program. So using synchronous mode can really slow things down.

The synchronous mode is default because it is what most programmers expect.

All operations are guaranteed to be performed in the order given in both modes. Reordering is not done.

So the recommendation for all graphics applications is to set the asynchronous mode. It will be far more efficient on some platforms and will never be worse.

Example 1. Setting up asynchronous mode

ggiAddFlags(vis, GGIFLAG_ASYNC);	/* switches to asynchronous mode */

ggiFlush(vis);				/* updates the screen */

ggiRemoveFlags(vis, GGIFLAG_ASYNC);	/* switches to synchronous mode */

See Also

ggiFlush(3ggi)