libcaca event handling


Functions

int caca_get_event (caca_display_t *, unsigned int, caca_event_t *, int)
 Get the next mouse or keyboard input event.
unsigned int caca_get_mouse_x (caca_display_t *)
 Return the X mouse coordinate.
unsigned int caca_get_mouse_y (caca_display_t *)
 Return the Y mouse coordinate.
void caca_set_mouse (caca_display_t *, int)
 Show or hide the mouse pointer.

Detailed Description

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

Function Documentation

int caca_get_event caca_display_t dp,
unsigned int  event_mask,
caca_event_t ev,
int  timeout
 

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.

The timeout value tells how long this function needs to wait for an event. A value of zero returns immediately and the function returns zero if no more events are pending in the queue. A negative value causes the function to wait indefinitely until a matching event is received.

Parameters:
dp The libcaca graphical context.
event_mask Bitmask of requested events.
timeout A timeout value in microseconds
ev A pointer to a caca_event structure.
Returns:
The next matching event in the queue, or 0 if no event is pending.

unsigned int caca_get_mouse_x caca_display_t dp  ) 
 

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.

Parameters:
dp The libcaca graphical context.
Returns:
The X mouse coordinate.

unsigned int caca_get_mouse_y caca_display_t dp  ) 
 

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.

Parameters:
dp The libcaca graphical context.
Returns:
The Y mouse coordinate.

void caca_set_mouse caca_display_t dp,
int  flag
 

This function shows or hides the mouse pointer, for devices that support it.

Parameters:
dp The libcaca graphical context.
flag 0 hides the pointer, 1 shows the system's default pointer (usually an arrow). Other values are reserved for future use.