Events 3 NIMF Library
Events

## Functions

NimfEvent * | nimf_event_new ()
void | nimf_event_free ()
gboolean | nimf_event_matches ()
guint | nimf_event_keycode_to_qwerty_keyval ()

## Types and Values

enum | NimfEventType
struct | NimfEventKey
union | NimfEvent

## Description

## Functions

### nimf_event_new ()

    NimfEvent *
    nimf_event_new (NimfEventType type);

Creates a new event of the given type. All fields are set to 0.

#### Parameters

type | a NimfEventType |

#### Returns

a new NimfEvent, which should be freed with `nimf_event_free()`.

nimf_event_new

### nimf_event_free ()

    void
    nimf_event_free (NimfEvent *event);

Frees event .

#### Parameters

event | a NimfEvent |

nimf_event_free

### nimf_event_matches ()

    gboolean
    nimf_event_matches (NimfEvent *event,
                        const NimfKey **keys);

Checks if event matches one of the keys .

#### Parameters

event | a NimfEvent |
keys | a `NULL`-terminated array of NimfKey |

#### Returns

TRUE if a match was found.

nimf_event_matches

### nimf_event_keycode_to_qwerty_keyval ()

    guint
    nimf_event_keycode_to_qwerty_keyval (const NimfEvent *event);

Converts event to qwerty keyval. Use only for PC keyboards.

#### Parameters

event | a NimfEvent |

#### Returns

the guint value

nimf_event_keycode_to_qwerty_keyval

## Types and Values

### enum NimfEventType

#### Members

NIMF_EVENT_NOTHING | a special code to indicate a null event. |
NIMF_EVENT_KEY_PRESS | a key has been pressed. |
NIMF_EVENT_KEY_RELEASE | a key has been released. |

NimfEventType

### struct NimfEventKey

    struct NimfEventKey {
      NimfEventType type;
      guint32       state;
      guint32       keyval;
      guint32       hardware_keycode;
    };

Describes a key press or key release event.

#### Members

NimfEventType type; | the type of the event (`NIMF_EVENT_KEY_PRESS` or `NIMF_EVENT_KEY_RELEASE`). |
guint32 state; | a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See NimfModifierType. | [type NimfModifierType]
guint32 keyval; | the key that was pressed or released. See the `nimf-key-syms.h` header file for a complete list of Nimf key codes. |
guint32 hardware_keycode; | the raw code of the key that was pressed or released. |

NimfEventKey

### union NimfEvent

A NimfEvent contains a union.

#### Members

NimfEventType type; | a NimfEventType |
NimfEventKey key; | a NimfEventKey |

NimfEvent