libcaca documentation

Main Page | Modules | Directories | File List | Globals

# Event handling

## Functions
unsigned int | caca_get_event (unsigned int)
| Get the next mouse or keyboard input event.
unsigned int | caca_wait_event (unsigned int)
| Wait for the next mouse or keyboard input event.
unsigned int | caca_get_mouse_x (void)
| Return the X mouse coordinate.
unsigned int | caca_get_mouse_y (void)
| Return the Y mouse coordinate.

## Detailed Description

These functions handle user events such as keyboard input and mouse clicks.

## Function Documentation

unsigned int caca_get_event | ( | unsigned int | event_mask | ) |

  | This function polls the event queue for mouse or keyboard events matching the event mask and returns the first matching event. Non-matching events are discarded. `event_mask` must have a non-zero value. This function is non-blocking and returns zero if no more events are pending in the queue. See also caca_wait_event() for a blocking version of this function. Parameters:
  | event_mask | Bitmask of requested events.
Returns: The next matching event in the queue, or 0 if no event is pending.

unsigned int caca_get_mouse_x | ( | void |  | ) |

| This function returns the X coordinate of the mouse position last time it was detected. This function is not reliable if the ncurses or S-Lang drivers are being used, because mouse position is only detected when the mouse is clicked. Other drivers such as X11 work well. Returns: The X mouse coordinate.

unsigned int caca_get_mouse_y | ( | void |  | ) |

| This function returns the Y coordinate of the mouse position last time it was detected. This function is not reliable if the ncurses or S-Lang drivers are being used, because mouse position is only detected when the mouse is clicked. Other drivers such as X11 work well. Returns: The Y mouse coordinate.

unsigned int caca_wait_event | ( | unsigned int | event_mask | ) |

  | This function returns the first mouse or keyboard event in the queue that matches the event mask. If no event is pending, it blocks until a matching event is received. `event_mask` must have a non-zero value. See also caca_get_event() for a non-blocking version of this function. Parameters:
  | event_mask | Bitmask of requested events.
Returns: The next event in the queue.