GDK Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# Key Values

## Name

Key Values -- functions for manipulating keyboard codes.

## Synopsis

    #include <gdk/gdk.h>

    gchar*      gdk_keyval_name                 (guint keyval);
    guint       gdk_keyval_from_name            (const gchar *keyval_name);

    gboolean    gdk_keyval_is_upper             (guint keyval);
    gboolean    gdk_keyval_is_lower             (guint keyval);

    guint       gdk_keyval_to_upper             (guint keyval);
    guint       gdk_keyval_to_lower             (guint keyval);

## Description

Key values are the codes which are sent whenever a key is pressed or released. They appear in the `keyval` field of the GdkEventKey structure, which is passed to signal handlers for the "key-press-event" and "key-release-event" signals. The complete list of key values can be found in the <gdk/gdkkeysyms.h> header file.

Key values can be converted into a string representation using gdk_keyval_name(). The reverse function, converting a string to a key value, is provided by gdk_keyval_from_name().

The case of key values can be determined using gdk_keyval_is_upper() and gdk_keyval_is_lower(). Key values can be converted to upper or lower case using gdk_keyval_to_upper() and gdk_keyval_to_lower().

## Details

### gdk_keyval_name ()

    gchar*      gdk_keyval_name                 (guint keyval);

Converts a key value into a symbolic name. The names are the same as those in the <gdk/gdkkeysyms.h> header file but without the leading "GDK_".

`keyval` : | a key value.
Returns : | a string containing the name of the key, or NULL if `keyval` is not a valid key. The string should not be modified.

### gdk_keyval_from_name ()

    guint       gdk_keyval_from_name            (const gchar *keyval_name);

Converts a key name to a key value.

`keyval_name` : | a key name.
Returns : | the corresponding key value, or `GDK_VoidSymbol` if the key name is not a valid key.

### gdk_keyval_is_upper ()

    gboolean    gdk_keyval_is_upper             (guint keyval);

Returns TRUE if the given key value is in upper case.

`keyval` : | a key value.
Returns : | TRUE if `keyval` is in upper case, or if `keyval` is not subject to case conversion.

### gdk_keyval_is_lower ()

    gboolean    gdk_keyval_is_lower             (guint keyval);

Returns TRUE if the given key value is in lower case.

`keyval` : | a key value.
Returns : | TRUE if `keyval` is in lower case, or if `keyval` is not subject to case conversion.

### gdk_keyval_to_upper ()

    guint       gdk_keyval_to_upper             (guint keyval);

Converts a key value to upper case, if applicable.

`keyval` : | a key value.
Returns : | the upper case form of `keyval`, or `keyval` itself if it is already in upper case or it is not subject to case conversion.

### gdk_keyval_to_lower ()

    guint       gdk_keyval_to_lower             (guint keyval);

Converts a key value to lower case, if applicable.

`keyval` : | a key value.
Returns : | the lower case form of `keyval`, or `keyval` itself if it is already in lower case or it is not subject to case conversion.

<<< Previous Page | Home | Up | Next Page >>>
Input Devices | Input Methods