## IBusKeymap

IBusKeymap — Keyboard mapping handling.

## Stability Level

Stable, unless otherwise indicated

## Functions

IBusKeymap * | ibus_keymap_new ()
IBusKeymap * | ibus_keymap_get ()
guint | ibus_keymap_lookup_keysym ()

## Types and Values

struct | IBusKeymap

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── IBusObject
                ╰── IBusKeymap

## Description

An IBusKeymap defines the mapping between keyboard scancodes and keyboard symbols such as numbers, alphabets, and punctuation marks.

Some input methods assume certain keyboard layout (such as Chewing and Wubi requires an US-QWERTY layout), and expect key symbols to be arranged in that order. These input methods should new an IBusKeymap instance and define the keyboard layout. Then `ibus_keymap_lookup_keysym()` can convert scancodes back to the key symbols.

see_also: IBusComponent, IBusEngineDesc

## Functions

### ibus_keymap_new ()

    IBusKeymap *
    ibus_keymap_new (const gchar *name);

`ibus_keymap_new` is deprecated and should not be used in newly-written code.

This function has been deprecated and should not be used in newly written code. Please use `ibus_keymap_get()`.

Get an IBusKeymap associated with the giving name.

This function loads the keymap file specified in `name` in the IBUS_DATA_DIR/keymaps directory.

#### Parameters

name | The keymap file to be loaded, such as 'us', 'jp'. |

#### Returns

An IBusKeymap associated with the giving name; or `NULL` if failed.

### ibus_keymap_get ()

    IBusKeymap *
    ibus_keymap_get (const gchar *name);

Get an IBusKeymap associated with the giving name.

This function loads the keymap file specified in `name` in the IBUS_DATA_DIR/keymaps directory.

#### Parameters

name | The keymap file to be loaded, such as 'us', 'jp'. |

#### Returns

An IBusKeymap associated with the giving name; or `NULL` if failed.

[transfer full]

### ibus_keymap_lookup_keysym ()

    guint
    ibus_keymap_lookup_keysym (IBusKeymap *keymap,
                               guint16 keycode,
                               guint32 state);

Converts the scancode to keysym, given the keymap.

#### Parameters

keymap | An IBusKeymap. |
keycode | A scancode to be converted. |
state | Modifier flags(such as Ctrl, Shift). |

#### Returns

Corresponding keysym.

## Types and Values

### struct IBusKeymap

    struct IBusKeymap {
        gchar *name;
        guint keymap[256][7];
    };

A keymap object in IBus.

#### Members

gchar *`name`; | The name of the keymap, such as 'us', 'jp'. |
guint `keymap`[256][7]; | Keymap table. IME developers normally don have to touch this. |