MAV_keyboardEvent(3)

NAME
MAV_keyboardEvent - Keyboard event.

LEVEL
Maverik Level 1

SYNTAX

 typedef struct {
  MAV_window *win;
  int x;
  int y;
  int root_x;
  int root_y;
  MAV_line line;
  int intersects;
  MAV_object *obj;
  MAV_objectIntersection objint;
  int key;
  int modifiers[MAV_MODIFIER_MAX];
  int movement;
} MAV_keyboardEvent;

DESCRIPTION
The keyboard event data structure, MAV_keyboardEvent, is passed to the application supplied callback function, set with the @mav_callbackKeyboardSet function, upon keyboard events and details that event.

win window in which event occurred.

x, y
    position of mouse relative to window origin when event occured.

root_x, root_y
    as (x, y) but relative to root window

line
    the line from the eye point through the world position of the mouse when the keyboard event occured.

intersects
    MAV_TRUE if line intersects an object, MAV_FALSE otherwise.

obj the object intersected by the line (if any).

objint
    the details of any object intersection.

key The key pressed. Either this is the ASCII value of the key if printable or a hash defined value for keys such as the function and cursor keys. Note that non-ASCII symbols, such as the pound and euro signs, may not correctly interpreted.

modifiers
    an array containing the status (MAV_PRESSED or MAV_RELEASED) of the various keyboard modifiers (e.g. MAV_MODIFIER_SHIFT, MAV_MODIFIER_CTRL, MAV_MODIFIER_ALT).

movement
    MAV_PRESSED if key down event, MAV_RELEASED otherwise

The MAV_object which is passed as the first parameter to the event callback function may well be different than obj stored in this data structure since the former is always an object of the same type as the callback was registered for. Therefore, event callbacks registered for non-object classes such as mav_class_any will receive a dummy object (in this case mav_object_any) as their first parameters. No interpretation should be made of these objects by the application. However, the obj field always contains the object which the mouse was pointing at when the event occurred regardless of how the callback function was registered.