### Function

# Atspi generate_keyboard_event

#### Declaration [src]

    gboolean
    atspi_generate_keyboard_event (
      glong keyval,
      const gchar* keystring,
      AtspiKeySynthType synth_type,
      GError** error
    )

#### Description [src]

Synthesizes a keyboard event (as if a hardware keyboard event occurred in the current UI context).

#### Parameters

`keyval`

  Type: `glong`

  A #gint indicating the keycode or keysym or modifier mask of the key event being synthesized.

`keystring`

  Type: `const gchar*`

  An (optional) UTF-8 string which, if `synth_type` is `ATSPI_KEY_STRING`, indicates a ‘composed’ keyboard input string being synthesized; this type of keyboard event synthesis does not emulate hardware keypresses but injects the string as though a composing input method (such as XIM) were used.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`synth_type`

  Type: `AtspiKeySynthType`

  An `AtspiKeySynthType` flag indicating whether `keyval` is to be interpreted as a keysym rather than a keycode (`ATSPI_KEY_SYM`) or a string (`ATSPI_KEY_STRING`) or a modifier mask (`ATSPI_KEY_LOCKMODIFIERS` and `ATSPI_KEY_UNLOCKMODIFIERS`), or whether to synthesize `ATSPI_KEY_PRESS`, `ATSPI_KEY_RELEASE`, or both (`ATSPI_KEY_PRESSRELEASE`).

`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`.