---
name: "gii_event_mask"
section: "9gii"
platform: "linux"
package: "libgii0-dev"
version: "1:0.8.1-1"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/gii_event/9gii"
---

# gii\_event\_mask(9gii)

LibGII event structures

Part of [gii\_event(9gii)](/gii_event/9gii.md).

## NAME

gii\_event, gii\_event\_type, gii\_event\_mask - LibGII event structures

## SYNOPSIS

```
#include <ggi/events.h>

```

## DESCRIPTION

Events are of type **gii\_event**. It is a union of all of the structures for each specific type of event.

```
typedef union gii_event {
        uint8                   size;           /* size of this event   */
        gii_any_event           any;            /* access COMMON_DATA   */
        gii_cmd_event           cmd;            /* command/information  */
        gii_expose_event        expose;         /* exposure event       */
        gii_val_event           val;            /* valuator change      */
        gii_key_event           key;            /* key press/release    */
        gii_pmove_event         pmove;          /* pointer move         */
        gii_pbutton_event       pbutton;        /* pointer buttons      */
} gii_event;

```

## STRUCTURE MEMBERS

All of the event structures contains housekeeping information at the beginning, as defined by **COMMON\_DATA**.

```
#define COMMON_DATA  \
        uint8   size;           /* size of event in bytes       */\
        uint8   type;           /* type of this event           */\
        sint16  error;          /* error (for replies)          */\
        uint32  origin;         /* origin device (etc)          */\
        uint32  target;         /* target device (etc)          */\
        struct  timeval time     /* timestamp                    */

```

```
typedef struct {
	COMMON_DATA;
} gii_any_event;

```

Thus, by analyzing the contents of **any.type**, you can determine what the given event is, and select the appropriate member of the **gii\_event** union to access to get at the event data.

- **size**

  Specifies the size of the given event (in bytes).

- **type**

  An enumeration of the possible types of LibGII events (see next section).

- **error**

  Mainly there to round things up to a 32-bit boundary, but could be used to signal an error in a send-reply sequence.

- **origin**

  A device handle: it distinguishes one input device from another. Other than that there's no real meaning to the number.

- **target**

  Also a device handle, but for distinguishes input devices when sending events **to** an input device via **ggiEventSend**.

- **time**

  Indicates when the event in question has been generated.

## EVENT TYPES

The different types of events are defined as an enumeration.

```
typedef enum gii_event_type {
        evNothing = 0,  /* event is not valid. (must be zero)   */
        evCommand,      /* report command/do action             */
        evInformation,  /* notification of new information      */
        evExpose,       /* exposure event                       */
        /* empty slot */
        evKeyPress=5,   /* key has been pressed                 */
        evKeyRelease,   /* key has been released                */
        evKeyRepeat,    /* automatically repeated keypress      */
        evPtrRelative,  /* pointer movements reported relative  */
        evPtrAbsolute,  /* pointer movements reported absolute  */
        evPtrButtonPress,       /* pointer button pressed       */
        evPtrButtonRelease,     /* pointer button released      */
        evValRelative,  /* valuator change (reported relative)  */
        evValAbsolute,  /* valuator change (reported absolute)  */
        evLast          /* must be less than 33                 */
} gii_event_type;

```

## EVENT MASKS

**gii\_event\_mask** is passed to various event handling functions to indicate which types of events the program is interested in. The chart below sums the available event masks: Event maskEvent type**emCommandevCommandemInformationevInformationemExposeevExposeemKeyPressevKeyPressemKeyReleaseevKeyReleaseemKeyRepeatevKeyRepeatemKey**Any of **evKeyPress**, **evKeyRelease**, **evKeyRepeatemPtrRelativeevPtrRelativeemPtrAbsoluteevPtrAbsoluteemPtrButtonPressevPtrButtomPressemPtrButtonReleaseevPtrButtomReleaseemPtrMove**Any of **evPtrRelative**, **evPtrAbsoluteemPtrButton**Any of **evPtrButtonPress**, **evPtrButtonReleaseemPointer**All pointer events**emValRelative**evValRelative**emValAbsolute**evValAbsolute**emValuator**Any of **evValRelative** or **evValAbsoluteemAll**Any event type**emNothing**Matches no event type

## SEE ALSO

\[XRef to GII\_KEY\_EVENT\], \[XRef to GII\_PMOVE\_EVENT\], \[XRef to GII\_PBUTTON\_EVENT\], \[XRef to GII\_CMD\_EVENT\], \[XRef to GII\_VALUATOR\_EVENT\], \[XRef to GII\_EXPOSE\_EVENT\]
