CtkEventControllerKey: CTK+ 3 Reference Manual

## CtkEventControllerKey CtkEventControllerKey — Event controller for key events |

## Functions

CtkEventController * | ctk_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

| CtkEventControllerKey

## Object Hierarchy

        GObject
        ╰── CtkEventController
            ╰── CtkEventControllerKey

## Includes

    #include <ctk/ctk.h>

## Description

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

This object was added in 3.24.

## Functions

### ctk_event_controller_key_new ()

    CtkEventController *
    ctk_event_controller_key_new (CtkWidget *widget);

## Types and Values

### CtkEventControllerKey

    typedef struct _CtkEventControllerKey CtkEventControllerKey;

## Signal Details

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

    void
    user_function (CtkEventControllerKey *ctkeventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

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

    void
    user_function (CtkEventControllerKey *ctkeventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

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

    void
    user_function (CtkEventControllerKey *ctkeventcontrollerkey,
                   gpointer               user_data)

Flags: Run Last

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

    gboolean
    user_function (CtkEventControllerKey *controller,
                   guint                  keyval,
                   guint                  keycode,
                   CdkModifierType        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 CdkModifierType. |
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 (CtkEventControllerKey *controller,
                   guint                  keyval,
                   guint                  keycode,
                   CdkModifierType        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 CdkModifierType. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.24

### The `“modifiers”` signal

    gboolean
    user_function (CtkEventControllerKey *ctkeventcontrollerkey,
                   CdkModifierType        arg1,
                   gpointer               user_data)

Flags: Run Last

## See Also

CtkEventController