## GtkEventControllerKey

GtkEventControllerKey — Event controller for key events

## Functions

GtkEventController * | gtk_event_controller_key_new ()

## Signals

void | focus-in | Run Last
void | focus-out | Run Last
void | im-update | Run Last
gboolean | key-pressed | Run Last
void | key-released | Run Last
gboolean | modifiers | Run Last

## Types and Values

| GtkEventControllerKey

## Object Hierarchy

        GObject
        ╰── GtkEventController
            ╰── GtkEventControllerKey

## Includes

    #include <gtk/gtkunixprint.h>

## Description

GtkEventControllerKey is an event controller meant for situations where you need access to key events.

This object was added in 3.24.

## Functions

### gtk_event_controller_key_new ()

    GtkEventController *
    gtk_event_controller_key_new (GtkWidget *widget);

## Types and Values

### GtkEventControllerKey

    typedef struct _GtkEventControllerKey GtkEventControllerKey;

## Signal Details

### The `“focus-in”` signal

    void
    user_function (GtkEventControllerKey *eventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

### The `“focus-out”` signal

    void
    user_function (GtkEventControllerKey *eventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

### The `“im-update”` signal

    void
    user_function (GtkEventControllerKey *eventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

### The `“key-pressed”` signal

    gboolean
    user_function (GtkEventControllerKey *controller,
                   guint                  keyval,
                   guint                  keycode,
                   GdkModifierType        state,
                   gpointer               user_data)

This signal is emitted whenever a key is pressed.

#### Parameters

controller | the object which received the signal. |
keyval | the pressed key. |
keycode | the raw code of the pressed key. |
state | the bitmask, representing the state of modifier keys and pointer buttons. See GdkModifierType. |
user_data | user data set when the signal handler was connected. |

#### Returns

`TRUE` if the key press was handled, `FALSE` otherwise.

Flags: Run Last

Since: 3.24

### The `“key-released”` signal

    void
    user_function (GtkEventControllerKey *controller,
                   guint                  keyval,
                   guint                  keycode,
                   GdkModifierType        state,
                   gpointer               user_data)

This signal is emitted whenever a key is released.

#### Parameters

controller | the object which received the signal. |
keyval | the released key. |
keycode | the raw code of the released key. |
state | the bitmask, representing the state of modifier keys and pointer buttons. See GdkModifierType. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.24

### The `“modifiers”` signal

    gboolean
    user_function (GtkEventControllerKey *eventcontrollerkey,
                   GdkModifierType        arg1,
                   gpointer               user_data)

Flags: Run Last

## See Also

GtkEventController