---
name: "ggiGetFlags"
section: "3ggi"
platform: "linux"
package: "libggi2-dev"
version: "1:2.0.1-2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/ggiSetFlags/3ggi"
---

# ggiGetFlags(3ggi)

Set or get flags affecting operation on a visual

Part of [ggiSetFlags(3ggi)](/ggiSetFlags/3ggi.md).

## 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\]
