---
name: "ggiSetMode"
section: "3"
platform: "linux"
package: "libggi2-dev"
version: "1:2.2.2-5"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/ggiSetMode"
---

# ggiSetMode(3)

Set or get a mode on a visual

## NAME

**ggiSetMode**, **ggiGetMode** - Set or get a mode on a visual

## SYNOPSIS

```
#include <ggi/ggi.h>
int ggiSetMode(ggi_visual_t visual, ggi_mode *tm);
int ggiGetMode(ggi_visual_t visual, ggi_mode *tm);
```

## DESCRIPTION

**ggiSetMode** sets any mode (text or graphics).  It also performs mode negotiation like `ggiCheckMode(3)`, but if any non-**GGI\_AUTO**/**GT\_AUTO** parameters are changed from the original mode, the new mode will not be silently set.

**ggiGetMode** fills out the passed **[ggi\_mode(3)](/ggi_mode/3.md)** with the parameters of the current mode of the visual.

## RETURN VALUE

**ggiSetMode** returns **0** if the mode is set successfully, otherwise an `ggi-error(3)` code.

## NOTES

Do not set a mode before checking it. You may be able to set up a certain mode on one target, but not other targets.

See the example in `ggiCheckMode(3)`.

**Important:** Note that the `ggiSetTextMode(3)`, `ggiSetGraphMode(3)` and `ggiSetSimpleMode(3)` functions are **deprecated**. Use `ggiCheckMode(3)` and similar functions, and then use `ggiSetMode(3)` on the resulting adjusted `ggi_mode(3)`, once you have checked it yourself.

## SEE ALSO

`ggiCheckMode(3)`, `ggiOpen(3)`, `ggi_mode(3)`
