### Function

# Atspi register_keystroke_listener

#### Declaration [src]

    gboolean
    atspi_register_keystroke_listener (
      AtspiDeviceListener* listener,
      GArray* key_set,
      AtspiKeyMaskType modmask,
      AtspiKeyEventMask event_types,
      AtspiKeyListenerSyncType sync_type,
      GError** error
    )

#### Description [src]

Registers a listener for keystroke events, either pre-emptively for all windows (`ATSPI_KEYLISTENER_ALL_WINDOWS`), non-preemptively (`ATSPI_KEYLISTENER_NOSYNC`), or pre-emptively at the toolkit level (`ATSPI_KEYLISTENER_CANCONSUME`). If ALL_WINDOWS or CANCONSUME are used, the event is consumed upon receipt if one of `listener`‘s callbacks returns `TRUE` (other sync_type values may be available in the future).

#### Parameters

`listener`

  Type: `AtspiDeviceListener`

  A pointer to the `AtspiDeviceListener` for which keystroke events are requested.

  The data is owned by the caller of the function.

`key_set`

  Type: An array of `AtspiKeyDefinition*`

  A pointer to the `AtspiKeyDefinition` array indicating which keystroke events are requested, or NULL to indicate that all keycodes and keyvals for the specified modifier set are to be included.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`modmask`

  Type: `AtspiKeyMaskType`

  An `AtspiKeyMaskType` mask indicating which key event modifiers must be set in combination with `keys`, events will only be reported for key events for which all modifiers in `modmask` are set. If you wish to listen for events with multiple modifier combinations, you must call #atspi_register_keystroke_listener once for each combination.

`event_types`

  Type: `AtspiKeyEventMask`

  An `AtspiKeyMaskType` mask indicating which types of key events are requested (`ATSPI_KEY_PRESSED` etc.).

`sync_type`

  Type: `AtspiKeyListenerSyncType`

  An `AtspiKeyListenerSyncType` parameter indicating the behavior of the notification/listener transaction.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if successful, otherwise `FALSE`.