# The "event" Package

These routines are meant to provide a general pupose event dispatching mechanism for communicating programmes.

Library: karma
Link With: -lkarma
Note:

- THIS PACKAGE IS WORK IN PROGRESS. THE INTERFACE MAY CHANGE IN THE NEXT RELEASE, POSSIBLY WITHOUT NOTICE.

  #### Functions

  event_initialise | Initialise the package.
  event_dispatch | Dispatch an event.
  event_register_event_func | Register event callback.
  event_set_mask | Set the event mask
  event_wait | Wait for an event.

  #### Prototype Functions

  event_PROTO_event_func | Generic event callback.

  #### Tables

  event_MASKS | List of event bitmasks

  ## Functions

  #### EXPERIMENTAL FUNCTION: subject to change without notice

  void event_initialise ()

  Initialise the package.

  Parameters:

  This function takes no parameters
  Returns: Nothing.
  Multithreading Level: Unsafe

  #### EXPERIMENTAL FUNCTION: subject to change without notice

  void event_dispatch (KEvent event)

  Dispatch an event.

  Parameters:

  - event : The event.
  Returns: Nothing.
  Multithreading Level: Unsafe

  #### EXPERIMENTAL FUNCTION: subject to change without notice

  KCallbackFunc event_register_event_func (flag (*func) (), void *f_info)

  Register event callback.

  Parameters:

  - func : The function that is called when a position event occurs. The prototype function is event_PROTO_event_func.
  - f_info : The initial arbitrary function information pointer.
  Returns: A handle to a KCallbackFunc object.
  Multithreading Level: Unsafe

  #### EXPERIMENTAL FUNCTION: subject to change without notice

  flag event_set_mask (unsigned long mask, long num_events, Connection connection)

  Set the event mask

  Parameters:

  - mask : The event mask. See event_MASKS for a list of event masks.
  - num_events : The number of events to receive per connection. If this is less than 0, an unlimited number of events may be received.
  - connection : The connection to apply the mask to. If this is NULL, all connections will have the mask applied.
  Returns: TRUE on success, else FALSE.
  Multithreading Level: Unsafe

  #### EXPERIMENTAL FUNCTION: subject to change without notice

  flag event_wait (unsigned long mask, Connection connection, KEvent *event)

  Wait for an event.

  Parameters:

  - mask : The event mask. After an event is received the event mask is set to 0. See event_MASKS for a list of event masks.
  - connection : The connection to receive the event from.
  - event : The event data will be written here
  Returns: TRUE on success, else FALSE.
  Multithreading Level: Unsafe

  ## Prototype Functions

  flag event_PROTO_event_func (KEvent event, Connection connection,void **f_info)

  Generic event callback.

  Parameters:

  - event : The event data. This becomes invalid when the callback returns.
  - connection : The connection over which the event came.
  - f_info : The arbitrary function information pointer.
  Returns: TRUE if the event was consumed, else FALSE indicating that the event is still to be processed.
  Multithreading Level: Unsafe

  ## Tables

  event_MASKS List of event bitmasks

  Value | Meaning
  K_EVENT_MASK_MOUSE_CLICK | Mouse button click down
  K_EVENT_MASK_MOUSE_RELEASE | Mouse button release
  K_EVENT_MASK_MOUSE_DRAG | Mouse move while button down
  K_EVENT_MASK_POINTER_MOVE | Mouse move
  K_EVENT_MASK_KEYPRESS | Keyboard press
  K_EVENT_MASK_POINTER_WARP | Mouse warp

  Back to Karma Home Page