ggiSetFlags(3ggi)

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); .SH "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.

•   In synchronous mode when the drawing command returns, it is already or will be executed very shortly. So the visible effect is that everything is drawn immediately. (It is not guaranteed in the strict sense in that it is already drawn when the function call returns, but almost.) This is the default mode for all visuals.

•   The asynchronous mode does not guarantee that drawing commands are executed immediately, but is faster on many targets. If the visual does not support asynchronous mode, setting it has no effect. To make sure that all pending graphics operations are actually done and the screen is updated, you need to call ggiFlush. This call is not needed in synchronous mode.)

    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.

  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
[XRef to GGIFLUSH]