caca_event(3caca)

NAME
caca_event - Handling of user events.

SYNOPSIS

  Public Types
CACA_EVENT_NONE = 0x0000
CACA_EVENT_KEY_PRESS = 0x0001
CACA_EVENT_KEY_RELEASE = 0x0002
CACA_EVENT_MOUSE_PRESS = 0x0004
CACA_EVENT_MOUSE_RELEASE = 0x0008
CACA_EVENT_MOUSE_MOTION = 0x0010
CACA_EVENT_RESIZE = 0x0020
CACA_EVENT_QUIT = 0x0040
CACA_EVENT_ANY = 0xffff
enum caca_event_type { CACA_EVENT_NONE = 0x0000, CACA_EVENT_KEY_PRESS = 0x0001, CACA_EVENT_KEY_RELEASE = 0x0002, CACA_EVENT_MOUSE_PRESS = 0x0004, CACA_EVENT_MOUSE_RELEASE = 0x0008, CACA_EVENT_MOUSE_MOTION = 0x0010, CACA_EVENT_RESIZE = 0x0020, CACA_EVENT_QUIT = 0x0040, CACA_EVENT_ANY = 0xffff }
User event type enumeration.

  Data Fields
enum caca_event::caca_event_type type
User event type enumeration.User event type member.
union {
struct {
unsigned int x
unsigned int y
unsigned int button
} mouse
struct {
unsigned int w
unsigned int h
} resize
struct {
unsigned int ch
unsigned long int utf32
char utf8 [8]
} key
} data
User event data member.

Detailed Description

This structure is filled by caca_get_event() when an event is received. The type field is always valid.

Member Enumeration Documentation

  enum caca_event::caca_event_type

This enum serves two purposes:

•   Build listening masks for caca_get_event().

•   Define the type of a caca_event_t.

Enumerator:

CACA_EVENT_NONE
    No event.

CACA_EVENT_KEY_PRESS
    A key was pressed.

CACA_EVENT_KEY_RELEASE
    A key was released.

CACA_EVENT_MOUSE_PRESS
    A mouse button was pressed.

CACA_EVENT_MOUSE_RELEASE
    A mouse button was released.

CACA_EVENT_MOUSE_MOTION
    The mouse was moved.

CACA_EVENT_RESIZE
    The window was resized.

CACA_EVENT_QUIT
    The user requested to quit.

CACA_EVENT_ANY
    Bitmask for any event.

Field Documentation

  enum caca_event::caca_event_type
     caca_event::type"

This field is always valid when caca_get_event() returns.

  union { ... } caca_event::data

The validity of the data union depends on the value of the type field:

•   CACA_EVENT_NONE: no field is valid.

•   CACA_EVENT_KEY_PRESS, CACA_EVENT_KEY_RELEASE: the data.key.ch field is valid and contains either the ASCII value for the key, or an enum caca_key value. If the value is a printable ASCII character, the data.key.utf32 and data.key.utf8 fields are also filled and contain respectively the UTF-32/UCS-4 and the UTF-8 representations of the character. Otherwise, their content is undefined.

•   CACA_EVENT_MOUSE_PRESS, CACA_EVENT_MOUSE_RELEASE: the data.mouse.button field is valid and contains the index of the mouse button that was pressed.

•   CACA_EVENT_MOUSE_MOTION: the data.mouse.x and data.mouse.y fields are valid and contain the mouse coordinates in character cells.

•   CACA_EVENT_RESIZE: the data.resize.w and data.resize.h fields are valid and contain the new width and height values of the libcucul canvas attached to libcaca.

•   CACA_EVENT_QUIT: no other field is valid.

The result of accessing data members outside the above conditions is undefined.

Author

Generated automatically by Doxygen for libcaca from the source code.