<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gdk4-Keyboard-Handling">
<refmeta>
<refentrytitle role="top_of_page" id="gdk4-Keyboard-Handling.top_of_page">Key Values</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Key Values</refname>
<refpurpose>Functions for manipulating keyboard codes</refpurpose>
</refnamediv>

<refsect1 id="gdk4-Keyboard-Handling.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_return" colwidth="150px"/>
<colspec colname="functions_name"/>
<tbody>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-lookup-key">gdk_keymap_lookup_key</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-translate-keyboard-state">gdk_keymap_translate_keyboard_state</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-entries-for-keyval">gdk_keymap_get_entries_for_keyval</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-entries-for-keycode">gdk_keymap_get_entries_for_keycode</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="PangoDirection"><returnvalue>PangoDirection</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-direction">gdk_keymap_get_direction</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-have-bidi-layouts">gdk_keymap_have_bidi_layouts</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-caps-lock-state">gdk_keymap_get_caps_lock_state</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-num-lock-state">gdk_keymap_get_num_lock_state</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-scroll-lock-state">gdk_keymap_get_scroll_lock_state</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-modifier-state">gdk_keymap_get_modifier_state</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-add-virtual-modifiers">gdk_keymap_add_virtual_modifiers</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-map-virtual-modifiers">gdk_keymap_map_virtual_modifiers</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GdkModifierType"><returnvalue>GdkModifierType</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keymap-get-modifier-mask">gdk_keymap_get_modifier_mask</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gdk-keyval-name">gdk_keyval_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-from-name">gdk_keyval_from_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-convert-case">gdk_keyval_convert_case</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-to-upper">gdk_keyval_to_upper</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-to-lower">gdk_keyval_to_lower</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-is-upper">gdk_keyval_is_upper</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-is-lower">gdk_keyval_is_lower</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="guint32"><returnvalue>guint32</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-keyval-to-unicode">gdk_keyval_to_unicode</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-unicode-to-keyval">gdk_unicode_to_keyval</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="GdkDisplay"><type>GdkDisplay</type></link>&#160;*</entry><entry role="property_name"><link linkend="GdkKeymap--display">display</link></entry><entry role="property_flags">Read / Write / Construct Only</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signals_return" colwidth="150px"/>
<colspec colname="signals_name" colwidth="300px"/>
<colspec colname="signals_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GdkKeymap-direction-changed">direction-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GdkKeymap-keys-changed">keys-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GdkKeymap-state-changed">state-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<anchor id="GdkKeymap"/><refsect1 id="gdk4-Keyboard-Handling.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="name" colwidth="150px"/>
<colspec colname="description"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GdkKeymap-struct">GdkKeymap</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GdkKeymapKey">GdkKeymapKey</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GdkKeymap
</screen>
</refsect1>

<refsect1 id="gdk4-Keyboard-Handling.includes"><title>Includes</title><synopsis>#include &lt;gdk/gdk.h&gt;
</synopsis></refsect1>

<refsect1 id="gdk4-Keyboard-Handling.description" role="desc">
<title role="desc.title">Description</title>
<para>Key values are the codes which are sent whenever a key is pressed or released.
They appear in the <link linkend="GdkEventKey.keyval"><type>GdkEventKey.keyval</type></link> field of the <link linkend="GdkEventKey"><type>GdkEventKey</type></link> structure.
The complete list of key values can be found in the <literal>gdk/gdkkeysyms.h</literal> header file.</para>
<para>Key values are regularly updated from the upstream X.org X11 implementation,
so new values are added regularly. They will be prefixed with GDK_KEY_ rather
than XF86XK_ or XK_ (for older symbols).</para>
<para>Key values can be converted into a string representation using
<link linkend="gdk-keyval-name"><function>gdk_keyval_name()</function></link>. The reverse function, converting a string to a key value,
is provided by <link linkend="gdk-keyval-from-name"><function>gdk_keyval_from_name()</function></link>.</para>
<para>The case of key values can be determined using <link linkend="gdk-keyval-is-upper"><function>gdk_keyval_is_upper()</function></link> and
<link linkend="gdk-keyval-is-lower"><function>gdk_keyval_is_lower()</function></link>. Key values can be converted to upper or lower case
using <link linkend="gdk-keyval-to-upper"><function>gdk_keyval_to_upper()</function></link> and <link linkend="gdk-keyval-to-lower"><function>gdk_keyval_to_lower()</function></link>.</para>
<para>When it makes sense, key values can be converted to and from
Unicode characters with <link linkend="gdk-keyval-to-unicode"><function>gdk_keyval_to_unicode()</function></link> and <link linkend="gdk-unicode-to-keyval"><function>gdk_unicode_to_keyval()</function></link>.</para>
<refsect2 id="key-group-explanation"><title>Groups</title><para>One <link linkend="GdkKeymap"><type>GdkKeymap</type></link> object exists for each user display. To obtain keymaps for
a display, use <link linkend="gdk-display-get-keymap"><function>gdk_display_get_keymap()</function></link>. A keymap is a mapping from
<link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> to key values. You can think of a <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> as a
representation of a symbol printed on a physical keyboard key. That is, it
contains three pieces of information. First, it contains the hardware keycode;
this is an identifying number for a physical key. Second, it contains the
“level” of the key. The level indicates which symbol on the
key will be used, in a vertical direction. So on a standard US keyboard, the key
with the number “1“ on it also has the exclamation point (”!”) character on
it. The level indicates whether to use the “1” or the “!” symbol.  The letter
keys are considered to have a lowercase letter at level 0, and an uppercase
letter at level 1, though only the uppercase letter is printed.  Third, the
<link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> contains a group; groups are not used on standard US keyboards,
but are used in many other countries. On a keyboard with groups, there can be 3
or 4 symbols printed on a single key. The group indicates movement in a
horizontal direction. Usually groups are used for two different languages.  In
group 0, a key might have two English characters, and in group 1 it might have
two Hebrew characters. The Hebrew characters will be printed on the key next to
the English characters.</para>
<para>In order to use a keymap to interpret a key event, it’s necessary to first
convert the keyboard state into an effective group and level. This is done via a
set of rules that varies widely according to type of keyboard and user
configuration. The function <link linkend="gdk-keymap-translate-keyboard-state"><function>gdk_keymap_translate_keyboard_state()</function></link> accepts a
keyboard state -- consisting of hardware keycode pressed, active modifiers, and
active group -- applies the appropriate rules, and returns the group/level to be
used to index the keymap, along with the modifiers which did not affect the
group and level. i.e. it returns “unconsumed modifiers.” The keyboard group may
differ from the effective group used for keymap lookups because some keys don't
have multiple groups - e.g. the Enter key is always in group 0 regardless of
keyboard state.</para>
<para>Note that <link linkend="gdk-keymap-translate-keyboard-state"><function>gdk_keymap_translate_keyboard_state()</function></link> also returns the keyval, i.e. it
goes ahead and performs the keymap lookup in addition to telling you which
effective group/level values were used for the lookup. <link linkend="GdkEventKey"><type>GdkEventKey</type></link> already
contains this keyval, however, so you don’t normally need to call
<link linkend="gdk-keymap-translate-keyboard-state"><function>gdk_keymap_translate_keyboard_state()</function></link> just to get the keyval.</para>
</refsect2>

</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gdk-keymap-lookup-key" role="function">
<title>gdk_keymap_lookup_key&#160;()</title>
<indexterm zone="gdk-keymap-lookup-key"><primary>gdk_keymap_lookup_key</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_keymap_lookup_key (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                       <parameter>const <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> *key</parameter>);</programlisting>
<para>Looks up the keyval mapped to a keycode/group/level triplet.
If no keyval is bound to <parameter>key</parameter>
, returns 0. For normal user input,
you want to use <link linkend="gdk-keymap-translate-keyboard-state"><function>gdk_keymap_translate_keyboard_state()</function></link> instead of
this function, since the effective group/level may not be
the same as the current keyboard state.</para>
<refsect3 id="gdk-keymap-lookup-key.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>key</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> with keycode, group, and level initialized</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-lookup-key.returns" role="returns">
<title>Returns</title>
<para> a keyval, or 0 if none was mapped to the given <parameter>key</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-translate-keyboard-state" role="function">
<title>gdk_keymap_translate_keyboard_state&#160;()</title>
<indexterm zone="gdk-keymap-translate-keyboard-state"><primary>gdk_keymap_translate_keyboard_state</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_translate_keyboard_state (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                                     <parameter><link linkend="guint"><type>guint</type></link> hardware_keycode</parameter>,
                                     <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> state</parameter>,
                                     <parameter><link linkend="gint"><type>gint</type></link> group</parameter>,
                                     <parameter><link linkend="guint"><type>guint</type></link> *keyval</parameter>,
                                     <parameter><link linkend="gint"><type>gint</type></link> *effective_group</parameter>,
                                     <parameter><link linkend="gint"><type>gint</type></link> *level</parameter>,
                                     <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *consumed_modifiers</parameter>);</programlisting>
<para>Translates the contents of a <link linkend="GdkEventKey"><type>GdkEventKey</type></link> into a keyval, effective
group, and level. Modifiers that affected the translation and
are thus unavailable for application use are returned in
<parameter>consumed_modifiers</parameter>
.
See <link linkend="key-group-explanation">Groups</link> for an explanation of
groups and levels. The <parameter>effective_group</parameter>
 is the group that was
actually used for the translation; some keys such as Enter are not
affected by the active keyboard group. The <parameter>level</parameter>
 is derived from
<parameter>state</parameter>
. For convenience, <link linkend="GdkEventKey"><type>GdkEventKey</type></link> already contains the translated
keyval, so this function isn’t as useful as you might think.</para>
<para><parameter>consumed_modifiers</parameter>
 gives modifiers that should be masked outfrom <parameter>state</parameter>

when comparing this key press to a hot key. For instance, on a US keyboard,
the <literal>plus</literal> symbol is shifted, so when comparing a key press to a
<literal>&amp;lt;Control>plus</literal> accelerator <literal>&amp;lt;Shift></literal> should be masked out.</para>
<informalexample><programlisting><![CDATA[
// We want to ignore irrelevant modifiers like ScrollLock
#define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
                                     event->state, event->group,
                                     &keyval, NULL, NULL, &consumed);
if (keyval == GDK_PLUS &&
    (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
  // Control was pressed
]]></programlisting></informalexample>
<para></para>
<para>An older interpretation <parameter>consumed_modifiers</parameter>
 was that it contained
all modifiers that might affect the translation of the key;
this allowed accelerators to be stored with irrelevant consumed
modifiers, by doing:</para>
<informalexample><programlisting><![CDATA[
// XXX Don’t do this XXX
if (keyval == accel_keyval &&
    (event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
  // Accelerator was pressed
]]></programlisting></informalexample>
<para></para>
<para>However, this did not work if multi-modifier combinations were
used in the keymap, since, for instance, <literal>&amp;lt;Control></literal> would be
masked out even if only <literal>&amp;lt;Control>&amp;lt;Alt></literal> was used in the keymap.
To support this usage as well as well as possible, all single
modifier combinations that could affect the key for any combination
of modifiers will be returned in <parameter>consumed_modifiers</parameter>
; multi-modifier
combinations are returned only when actually found in <parameter>state</parameter>
. When
you store accelerators, you should always store them with consumed
modifiers removed. Store <literal>&amp;lt;Control>plus</literal>, not <literal>&amp;lt;Control>&amp;lt;Shift>plus</literal>,</para>
<refsect3 id="gdk-keymap-translate-keyboard-state.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hardware_keycode</para></entry>
<entry role="parameter_description"><para>a keycode</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>a modifier state</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>group</para></entry>
<entry role="parameter_description"><para>active keyboard group</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>return location for keyval, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>effective_group</para></entry>
<entry role="parameter_description"><para>return location for effective
group, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>level</para></entry>
<entry role="parameter_description"><para>return location for level, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>consumed_modifiers</para></entry>
<entry role="parameter_description"><para>return location for modifiers
that were used to determine the group or level, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-translate-keyboard-state.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if there was a keyval bound to the keycode/state/group</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-entries-for-keyval" role="function">
<title>gdk_keymap_get_entries_for_keyval&#160;()</title>
<indexterm zone="gdk-keymap-get-entries-for-keyval"><primary>gdk_keymap_get_entries_for_keyval</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_get_entries_for_keyval (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                                   <parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>,
                                   <parameter><link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> **keys</parameter>,
                                   <parameter><link linkend="gint"><type>gint</type></link> *n_keys</parameter>);</programlisting>
<para>Obtains a list of keycode/group/level combinations that will
generate <parameter>keyval</parameter>
. Groups and levels are two kinds of keyboard mode;
in general, the level determines whether the top or bottom symbol
on a key is used, and the group determines whether the left or
right symbol is used. On US keyboards, the shift key changes the
keyboard level, and there are no groups. A group switch key might
convert a keyboard between Hebrew to English modes, for example.
<link linkend="GdkEventKey"><type>GdkEventKey</type></link> contains a <link linkend="group"><literal>group</literal></link> field that indicates the active
keyboard group. The level is computed from the modifier mask.
The returned array should be freed
with <link linkend="g-free"><function>g_free()</function></link>.</para>
<refsect3 id="gdk-keymap-get-entries-for-keyval.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a keyval, such as <link linkend="GDK-KEY-a"><literal>GDK_KEY_a</literal></link>, <link linkend="GDK-KEY-Up"><literal>GDK_KEY_Up</literal></link>, <link linkend="GDK-KEY-Return"><literal>GDK_KEY_Return</literal></link>, etc.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keys</para></entry>
<entry role="parameter_description"><para>return location
for an array of <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>array</acronym> length=n_keys][<acronym>transfer full</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>n_keys</para></entry>
<entry role="parameter_description"><para>return location for number of elements in returned array</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-entries-for-keyval.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if keys were found and returned</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-entries-for-keycode" role="function">
<title>gdk_keymap_get_entries_for_keycode&#160;()</title>
<indexterm zone="gdk-keymap-get-entries-for-keycode"><primary>gdk_keymap_get_entries_for_keycode</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_get_entries_for_keycode (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                                    <parameter><link linkend="guint"><type>guint</type></link> hardware_keycode</parameter>,
                                    <parameter><link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> **keys</parameter>,
                                    <parameter><link linkend="guint"><type>guint</type></link> **keyvals</parameter>,
                                    <parameter><link linkend="gint"><type>gint</type></link> *n_entries</parameter>);</programlisting>
<para>Returns the keyvals bound to <parameter>hardware_keycode</parameter>
.
The Nth <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> in <parameter>keys</parameter>
 is bound to the Nth
keyval in <parameter>keyvals</parameter>
. Free the returned arrays with <link linkend="g-free"><function>g_free()</function></link>.
When a keycode is pressed by the user, the keyval from
this list of entries is selected by considering the effective
keyboard group and level. See <link linkend="gdk-keymap-translate-keyboard-state"><function>gdk_keymap_translate_keyboard_state()</function></link>.</para>
<refsect3 id="gdk-keymap-get-entries-for-keycode.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hardware_keycode</para></entry>
<entry role="parameter_description"><para>a keycode</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>keys</para></entry>
<entry role="parameter_description"><para>return
location for array of <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>array</acronym> length=n_entries][<acronym>transfer full</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>keyvals</para></entry>
<entry role="parameter_description"><para>return
location for array of keyvals, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>array</acronym> length=n_entries][<acronym>transfer full</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>n_entries</para></entry>
<entry role="parameter_description"><para>length of <parameter>keys</parameter>
and <parameter>keyvals</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-entries-for-keycode.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if there were any entries</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-direction" role="function">
<title>gdk_keymap_get_direction&#160;()</title>
<indexterm zone="gdk-keymap-get-direction"><primary>gdk_keymap_get_direction</primary></indexterm>
<programlisting language="C"><link linkend="PangoDirection"><returnvalue>PangoDirection</returnvalue></link>
gdk_keymap_get_direction (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Returns the direction of effective layout of the keymap.
The direction of a layout is the direction of the majority of its
symbols. See <link linkend="pango-unichar-direction"><function>pango_unichar_direction()</function></link>.</para>
<refsect3 id="gdk-keymap-get-direction.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-direction.returns" role="returns">
<title>Returns</title>
<para> <link linkend="PANGO-DIRECTION-LTR:CAPS"><literal>PANGO_DIRECTION_LTR</literal></link> or <link linkend="PANGO-DIRECTION-RTL:CAPS"><literal>PANGO_DIRECTION_RTL</literal></link>
if it can determine the direction. <link linkend="PANGO-DIRECTION-NEUTRAL:CAPS"><literal>PANGO_DIRECTION_NEUTRAL</literal></link>
otherwise.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-have-bidi-layouts" role="function">
<title>gdk_keymap_have_bidi_layouts&#160;()</title>
<indexterm zone="gdk-keymap-have-bidi-layouts"><primary>gdk_keymap_have_bidi_layouts</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_have_bidi_layouts (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Determines if keyboard layouts for both right-to-left and left-to-right
languages are in use.</para>
<refsect3 id="gdk-keymap-have-bidi-layouts.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-have-bidi-layouts.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if there are layouts in both directions, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-caps-lock-state" role="function">
<title>gdk_keymap_get_caps_lock_state&#160;()</title>
<indexterm zone="gdk-keymap-get-caps-lock-state"><primary>gdk_keymap_get_caps_lock_state</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_get_caps_lock_state (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Returns whether the Caps Lock modifer is locked.</para>
<refsect3 id="gdk-keymap-get-caps-lock-state.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-caps-lock-state.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if Caps Lock is on</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-num-lock-state" role="function">
<title>gdk_keymap_get_num_lock_state&#160;()</title>
<indexterm zone="gdk-keymap-get-num-lock-state"><primary>gdk_keymap_get_num_lock_state</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_get_num_lock_state (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Returns whether the Num Lock modifer is locked.</para>
<refsect3 id="gdk-keymap-get-num-lock-state.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-num-lock-state.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if Num Lock is on</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-scroll-lock-state" role="function">
<title>gdk_keymap_get_scroll_lock_state&#160;()</title>
<indexterm zone="gdk-keymap-get-scroll-lock-state"><primary>gdk_keymap_get_scroll_lock_state</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_get_scroll_lock_state (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Returns whether the Scroll Lock modifer is locked.</para>
<refsect3 id="gdk-keymap-get-scroll-lock-state.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-scroll-lock-state.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if Scroll Lock is on</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-modifier-state" role="function">
<title>gdk_keymap_get_modifier_state&#160;()</title>
<indexterm zone="gdk-keymap-get-modifier-state"><primary>gdk_keymap_get_modifier_state</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_keymap_get_modifier_state (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>);</programlisting>
<para>Returns the current modifier state.</para>
<refsect3 id="gdk-keymap-get-modifier-state.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-modifier-state.returns" role="returns">
<title>Returns</title>
<para> the current modifier state.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-add-virtual-modifiers" role="function">
<title>gdk_keymap_add_virtual_modifiers&#160;()</title>
<indexterm zone="gdk-keymap-add-virtual-modifiers"><primary>gdk_keymap_add_virtual_modifiers</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gdk_keymap_add_virtual_modifiers (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                                  <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *state</parameter>);</programlisting>
<para>Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
in <parameter>state</parameter>
 to the virtual modifiers (i.e. Super, Hyper and Meta) and
set the corresponding bits in <parameter>state</parameter>
.</para>
<para>GDK already does this before delivering key events, but for
compatibility reasons, it only sets the first virtual modifier
it finds, whereas this function sets all matching virtual modifiers.</para>
<para>This function is useful when matching key events against
accelerators.</para>
<refsect3 id="gdk-keymap-add-virtual-modifiers.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>pointer to the modifier mask to change. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-map-virtual-modifiers" role="function">
<title>gdk_keymap_map_virtual_modifiers&#160;()</title>
<indexterm zone="gdk-keymap-map-virtual-modifiers"><primary>gdk_keymap_map_virtual_modifiers</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keymap_map_virtual_modifiers (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                                  <parameter><link linkend="GdkModifierType"><type>GdkModifierType</type></link> *state</parameter>);</programlisting>
<para>Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
are set in <parameter>state</parameter>
 to their non-virtual counterparts (i.e. Mod2,
Mod3,...) and set the corresponding bits in <parameter>state</parameter>
.</para>
<para>This function is useful when matching key events against
accelerators.</para>
<refsect3 id="gdk-keymap-map-virtual-modifiers.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>state</para></entry>
<entry role="parameter_description"><para>pointer to the modifier state to map. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>inout</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-map-virtual-modifiers.returns" role="returns">
<title>Returns</title>
<para> <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if two virtual modifiers were mapped to the
same non-virtual modifier. Note that <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> is also returned
if a virtual modifier is mapped to a non-virtual modifier that
was already set in <parameter>state</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keymap-get-modifier-mask" role="function">
<title>gdk_keymap_get_modifier_mask&#160;()</title>
<indexterm zone="gdk-keymap-get-modifier-mask"><primary>gdk_keymap_get_modifier_mask</primary></indexterm>
<programlisting language="C"><link linkend="GdkModifierType"><returnvalue>GdkModifierType</returnvalue></link>
gdk_keymap_get_modifier_mask (<parameter><link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap</parameter>,
                              <parameter><link linkend="GdkModifierIntent"><type>GdkModifierIntent</type></link> intent</parameter>);</programlisting>
<para>Returns the modifier mask the <parameter>keymap</parameter>
’s windowing system backend
uses for a particular purpose.</para>
<para>Note that this function always returns real hardware modifiers, not
virtual ones (e.g. it will return <link linkend="GDK-MOD1-MASK:CAPS"><type>GDK_MOD1_MASK</type></link> rather than
<link linkend="GDK-META-MASK:CAPS"><type>GDK_META_MASK</type></link> if the backend maps MOD1 to META), so there are use
cases where the return value of this function has to be transformed
by <link linkend="gdk-keymap-add-virtual-modifiers"><function>gdk_keymap_add_virtual_modifiers()</function></link> in order to contain the
expected result.</para>
<refsect3 id="gdk-keymap-get-modifier-mask.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkKeymap"><type>GdkKeymap</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>intent</para></entry>
<entry role="parameter_description"><para>the use case for the modifier mask</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keymap-get-modifier-mask.returns" role="returns">
<title>Returns</title>
<para> the modifier mask used for <parameter>intent</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-name" role="function">
<title>gdk_keyval_name&#160;()</title>
<indexterm zone="gdk-keyval-name"><primary>gdk_keyval_name</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gdk_keyval_name (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Converts a key value into a symbolic name.</para>
<para>The names are the same as those in the
<literal>gdk/gdkkeysyms.h</literal> header file
but without the leading “GDK_KEY_”.</para>
<refsect3 id="gdk-keyval-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a key value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-name.returns" role="returns">
<title>Returns</title>
<para>a string containing the name
of the key, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>keyval</parameter>
is not a valid key. The string
should not be modified. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>][<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-from-name" role="function">
<title>gdk_keyval_from_name&#160;()</title>
<indexterm zone="gdk-keyval-from-name"><primary>gdk_keyval_from_name</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_keyval_from_name (<parameter>const <link linkend="gchar"><type>gchar</type></link> *keyval_name</parameter>);</programlisting>
<para>Converts a key name to a key value.</para>
<para>The names are the same as those in the
<literal>gdk/gdkkeysyms.h</literal> header file
but without the leading “GDK_KEY_”.</para>
<refsect3 id="gdk-keyval-from-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval_name</para></entry>
<entry role="parameter_description"><para>a key name</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-from-name.returns" role="returns">
<title>Returns</title>
<para> the corresponding key value, or <link linkend="GDK-KEY-VoidSymbol"><literal>GDK_KEY_VoidSymbol</literal></link>
if the key name is not a valid key</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-convert-case" role="function">
<title>gdk_keyval_convert_case&#160;()</title>
<indexterm zone="gdk-keyval-convert-case"><primary>gdk_keyval_convert_case</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gdk_keyval_convert_case (<parameter><link linkend="guint"><type>guint</type></link> symbol</parameter>,
                         <parameter><link linkend="guint"><type>guint</type></link> *lower</parameter>,
                         <parameter><link linkend="guint"><type>guint</type></link> *upper</parameter>);</programlisting>
<para>Obtains the upper- and lower-case versions of the keyval <parameter>symbol</parameter>
.
Examples of keyvals are <link linkend="GDK-KEY-a"><type>GDK_KEY_a</type></link>, <link linkend="GDK-KEY-Enter"><type>GDK_KEY_Enter</type></link>, <link linkend="GDK-KEY-F1:CAPS"><type>GDK_KEY_F1</type></link>, etc.</para>
<refsect3 id="gdk-keyval-convert-case.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>symbol</para></entry>
<entry role="parameter_description"><para>a keyval</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>lower</para></entry>
<entry role="parameter_description"><para>return location for lowercase version of <parameter>symbol</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>upper</para></entry>
<entry role="parameter_description"><para>return location for uppercase version of <parameter>symbol</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-to-upper" role="function">
<title>gdk_keyval_to_upper&#160;()</title>
<indexterm zone="gdk-keyval-to-upper"><primary>gdk_keyval_to_upper</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_keyval_to_upper (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Converts a key value to upper case, if applicable.</para>
<refsect3 id="gdk-keyval-to-upper.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a key value.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-to-upper.returns" role="returns">
<title>Returns</title>
<para> the upper case form of <parameter>keyval</parameter>
, or <parameter>keyval</parameter>
itself if it is already
in upper case or it is not subject to case conversion.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-to-lower" role="function">
<title>gdk_keyval_to_lower&#160;()</title>
<indexterm zone="gdk-keyval-to-lower"><primary>gdk_keyval_to_lower</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_keyval_to_lower (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Converts a key value to lower case, if applicable.</para>
<refsect3 id="gdk-keyval-to-lower.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a key value.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-to-lower.returns" role="returns">
<title>Returns</title>
<para> the lower case form of <parameter>keyval</parameter>
, or <parameter>keyval</parameter>
itself if it is already
in lower case or it is not subject to case conversion.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-is-upper" role="function">
<title>gdk_keyval_is_upper&#160;()</title>
<indexterm zone="gdk-keyval-is-upper"><primary>gdk_keyval_is_upper</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keyval_is_upper (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the given key value is in upper case.</para>
<refsect3 id="gdk-keyval-is-upper.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a key value.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-is-upper.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>keyval</parameter>
is in upper case, or if <parameter>keyval</parameter>
is not subject to
case conversion.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-is-lower" role="function">
<title>gdk_keyval_is_lower&#160;()</title>
<indexterm zone="gdk-keyval-is-lower"><primary>gdk_keyval_is_lower</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_keyval_is_lower (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the given key value is in lower case.</para>
<refsect3 id="gdk-keyval-is-lower.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a key value.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-is-lower.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>keyval</parameter>
is in lower case, or if <parameter>keyval</parameter>
is not
subject to case conversion.</para>
</refsect3></refsect2>
<refsect2 id="gdk-keyval-to-unicode" role="function">
<title>gdk_keyval_to_unicode&#160;()</title>
<indexterm zone="gdk-keyval-to-unicode"><primary>gdk_keyval_to_unicode</primary></indexterm>
<programlisting language="C"><link linkend="guint32"><returnvalue>guint32</returnvalue></link>
gdk_keyval_to_unicode (<parameter><link linkend="guint"><type>guint</type></link> keyval</parameter>);</programlisting>
<para>Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
character.</para>
<refsect3 id="gdk-keyval-to-unicode.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keyval</para></entry>
<entry role="parameter_description"><para>a GDK key symbol </para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-keyval-to-unicode.returns" role="returns">
<title>Returns</title>
<para> the corresponding unicode character, or 0 if there
is no corresponding character.</para>
</refsect3></refsect2>
<refsect2 id="gdk-unicode-to-keyval" role="function">
<title>gdk_unicode_to_keyval&#160;()</title>
<indexterm zone="gdk-unicode-to-keyval"><primary>gdk_unicode_to_keyval</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_unicode_to_keyval (<parameter><link linkend="guint32"><type>guint32</type></link> wc</parameter>);</programlisting>
<para>Convert from a ISO10646 character to a key symbol.</para>
<refsect3 id="gdk-unicode-to-keyval.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>wc</para></entry>
<entry role="parameter_description"><para>a ISO10646 encoded character</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-unicode-to-keyval.returns" role="returns">
<title>Returns</title>
<para> the corresponding GDK key symbol, if one exists.
or, if there is no corresponding symbol,
wc | 0x01000000</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GdkKeymap-struct" role="struct">
<title>GdkKeymap</title>
<indexterm zone="GdkKeymap-struct"><primary>GdkKeymap</primary></indexterm>
<programlisting language="C">typedef struct _GdkKeymap GdkKeymap;</programlisting>
<para>A <link linkend="GdkKeymap"><type>GdkKeymap</type></link> defines the translation from keyboard state
(including a hardware key, a modifier mask, and active keyboard group)
to a keyval. This translation has two phases. The first phase is
to determine the effective keyboard group and level for the keyboard
state; the second phase is to look up the keycode/group/level triplet
in the keymap and see what keyval it corresponds to.</para>
</refsect2>
<refsect2 id="GdkKeymapKey" role="struct">
<title>struct GdkKeymapKey</title>
<indexterm zone="GdkKeymapKey"><primary>GdkKeymapKey</primary></indexterm>
<programlisting language="C">struct GdkKeymapKey {
  guint keycode;
  gint  group;
  gint  level;
};
</programlisting>
<para>A <link linkend="GdkKeymapKey"><type>GdkKeymapKey</type></link> is a hardware key that can be mapped to a keyval.</para>
<refsect3 id="GdkKeymapKey.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="guint"><type>guint</type></link>&#160;<structfield id="GdkKeymapKey.keycode">keycode</structfield>;</para></entry>
<entry role="struct_member_description"><para>the hardware keycode. This is an identifying number for a
physical key.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="gint"><type>gint</type></link>&#160;<structfield id="GdkKeymapKey.group">group</structfield>;</para></entry>
<entry role="struct_member_description"><para>indicates movement in a horizontal direction. Usually groups are used
for two different languages. In group 0, a key might have two English
characters, and in group 1 it might have two Hebrew characters. The Hebrew
characters will be printed on the key next to the English characters.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="gint"><type>gint</type></link>&#160;<structfield id="GdkKeymapKey.level">level</structfield>;</para></entry>
<entry role="struct_member_description"><para>indicates which symbol on the key will be used, in a vertical direction.
So on a standard US keyboard, the key with the number “1” on it also has the
exclamation point ("!") character on it. The level indicates whether to use
the “1” or the “!” symbol. The letter keys are considered to have a lowercase
letter at level 0, and an uppercase letter at level 1, though only the
uppercase letter is printed.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>

</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GdkKeymap--display" role="property"><title>The <literal>“display”</literal> property</title>
<indexterm zone="GdkKeymap--display"><primary>GdkKeymap:display</primary></indexterm>
<programlisting>  “display”                  <link linkend="GdkDisplay"><type>GdkDisplay</type></link>&#160;*</programlisting>
<para>The display of the keymap.</para><para>Flags: Read / Write / Construct Only</para>
</refsect2>

</refsect1>
<refsect1 id="gdk4-Keyboard-Handling.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GdkKeymap-direction-changed" role="signal"><title>The <literal>“direction-changed”</literal> signal</title>
<indexterm zone="GdkKeymap-direction-changed"><primary>GdkKeymap::direction-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap,
               <link linkend="gpointer"><type>gpointer</type></link>   user_data)</programlisting>
<para>The ::direction-changed signal gets emitted when the direction
of the keymap changes. See <link linkend="gdk-keymap-get-direction"><function>gdk_keymap_get_direction()</function></link>.</para>
<refsect3 id="GdkKeymap-direction-changed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GdkKeymap-keys-changed" role="signal"><title>The <literal>“keys-changed”</literal> signal</title>
<indexterm zone="GdkKeymap-keys-changed"><primary>GdkKeymap::keys-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap,
               <link linkend="gpointer"><type>gpointer</type></link>   user_data)</programlisting>
<para>The ::keys-changed signal is emitted when the mapping represented by
<parameter>keymap</parameter>
 changes.</para>
<refsect3 id="GdkKeymap-keys-changed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GdkKeymap-state-changed" role="signal"><title>The <literal>“state-changed”</literal> signal</title>
<indexterm zone="GdkKeymap-state-changed"><primary>GdkKeymap::state-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GdkKeymap"><type>GdkKeymap</type></link> *keymap,
               <link linkend="gpointer"><type>gpointer</type></link>   user_data)</programlisting>
<para>The ::state-changed signal is emitted when the state of the
keyboard changes, e.g when Caps Lock is turned on or off.
See <link linkend="gdk-keymap-get-caps-lock-state"><function>gdk_keymap_get_caps_lock_state()</function></link>.</para>
<refsect3 id="GdkKeymap-state-changed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>keymap</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2>
</refsect1>

</refentry>
